summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2014-11-11 21:46:16 +0100
committerTannin <devnull@localhost>2014-11-11 21:46:16 +0100
commit2237d7c10349064b740923ba142f41a1ded15562 (patch)
tree84877162552de03db3fa64219b850296dc3d95c2 /src
parent1eea3bd90e5e5cc3b05cf9c963533c3630f9ae52 (diff)
- re-enabled use of img-tags in bbcode converter
- addded a workaround for cases where, after a MO update, the stored modlist layout has no size for new columns - using a webview again for the nexus view of the modinfo dialog
Diffstat (limited to 'src')
-rw-r--r--src/bbcode.cpp4
-rw-r--r--src/mainwindow.cpp11
-rw-r--r--src/modinfodialog.cpp3
-rw-r--r--src/modinfodialog.ui35
-rw-r--r--src/modlistsortproxy.cpp30
-rw-r--r--src/modlistsortproxy.h1
6 files changed, 27 insertions, 57 deletions
diff --git a/src/bbcode.cpp b/src/bbcode.cpp
index 2e22859d..0f9170d4 100644
--- a/src/bbcode.cpp
+++ b/src/bbcode.cpp
@@ -177,9 +177,9 @@ private:
m_TagMap["url="] = std::make_pair(QRegExp("\\[url=([^\\]]*)\\](.*)\\[/url\\]"),
"<a href=\"\\1\">\\2</a>");
m_TagMap["img"] = std::make_pair(QRegExp("\\[img\\](.*)\\[/img\\]"),
- "<a href=\"\\1\">\\1</a>");
+ "<img src=\"\\1\">");
m_TagMap["img="] = std::make_pair(QRegExp("\\[img=([^\\]]*)\\](.*)\\[/img\\]"),
- "<a href=\"\\1\">\\2</a>");
+ "<img src=\"\\2\" alt=\"\\1\">");
m_TagMap["email="] = std::make_pair(QRegExp("\\[email=\"?([^\\]]*)\"?\\](.*)\\[/email\\]"),
"<a href=\"mailto:\\1\">\\2</a>");
m_TagMap["youtube"] = std::make_pair(QRegExp("\\[youtube\\](.*)\\[/youtube\\]"),
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 20738a99..935ed995 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -223,8 +223,8 @@ MainWindow::MainWindow(const QString &exeName, QSettings &initSettings, QWidget
ui->modList->header()->restoreState(initSettings.value("mod_list_state").toByteArray());
// hack: force the resize-signal to be triggered because restoreState doesn't seem to do that
- ui->modList->header()->resizeSection(ModList::COL_CONTENT, ui->modList->header()->sectionSize(ModList::COL_CONTENT) + 1);
- ui->modList->header()->resizeSection(ModList::COL_CONTENT, ui->modList->header()->sectionSize(ModList::COL_CONTENT) - 1);
+ ui->modList->header()->resizeSection(ModList::COL_CONTENT, sectionSize + 1);
+ ui->modList->header()->resizeSection(ModList::COL_CONTENT, sectionSize - 1);
} else {
// hide these columns by default
ui->modList->header()->setSectionHidden(ModList::COL_CONTENT, true);
@@ -395,6 +395,13 @@ void MainWindow::resizeLists(bool modListCustom, bool pluginListCustom)
#endif
}
+ // ensure the columns aren't so small you can't see them any more
+ for (int i = 0; i < ui->modList->header()->count(); ++i) {
+ if (ui->modList->header()->sectionSize(i) < 10) {
+ ui->modList->header()->resizeSection(i, 10);
+ }
+ }
+
if (!pluginListCustom) {
// resize plugin list to fit content
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
diff --git a/src/modinfodialog.cpp b/src/modinfodialog.cpp
index 0c9ec206..e6fb6f10 100644
--- a/src/modinfodialog.cpp
+++ b/src/modinfodialog.cpp
@@ -84,7 +84,8 @@ ModInfoDialog::ModInfoDialog(ModInfo::Ptr modInfo, const DirectoryEntry *directo
connect(&m_ThumbnailMapper, SIGNAL(mapped(const QString&)), this, SIGNAL(thumbnailClickedSignal(const QString&)));
connect(this, SIGNAL(thumbnailClickedSignal(const QString&)), this, SLOT(thumbnailClicked(const QString&)));
connect(m_ModInfo.data(), SIGNAL(modDetailsUpdated(bool)), this, SLOT(modDetailsUpdated(bool)));
- connect(ui->descriptionView, SIGNAL(anchorClicked(QUrl)), this, SLOT(linkClicked(QUrl)));
+ connect(ui->descriptionView, SIGNAL(linkClicked(QUrl)), this, SLOT(linkClicked(QUrl)));
+ ui->descriptionView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
if (directory->originExists(ToWString(modInfo->name()))) {
m_Origin = &directory->getOriginByName(ToWString(modInfo->name()));
diff --git a/src/modinfodialog.ui b/src/modinfodialog.ui
index d3862b58..a03edef7 100644
--- a/src/modinfodialog.ui
+++ b/src/modinfodialog.ui
@@ -232,8 +232,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>676</width>
- <height>126</height>
+ <width>98</width>
+ <height>28</height>
</rect>
</property>
<property name="toolTip">
@@ -678,25 +678,11 @@ p, li { white-space: pre-wrap; }
</layout>
</item>
<item>
- <widget class="QTextBrowser" name="descriptionView">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>200</height>
- </size>
- </property>
- <property name="html">
- <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
-&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::TextBrowserInteraction</set>
- </property>
- <property name="openLinks">
- <bool>false</bool>
+ <widget class="QWebView" name="descriptionView">
+ <property name="url">
+ <url>
+ <string>about:blank</string>
+ </url>
</property>
</widget>
</item>
@@ -819,6 +805,13 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</widget>
+ <customwidgets>
+ <customwidget>
+ <class>QWebView</class>
+ <extends>QWidget</extends>
+ <header>QtWebKitWidgets/QWebView</header>
+ </customwidget>
+ </customwidgets>
<resources>
<include location="resources.qrc"/>
</resources>
diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp
index d5ea157f..2f3d21ab 100644
--- a/src/modlistsortproxy.cpp
+++ b/src/modlistsortproxy.cpp
@@ -72,36 +72,6 @@ Qt::ItemFlags ModListSortProxy::flags(const QModelIndex &modelIndex) const
return flags;
}
-void ModListSortProxy::displayColumnSelection(const QPoint &pos)
-{
- QMenu menu;
-
- for (int i = 0; i <= ModList::COL_LASTCOLUMN; ++i) {
- QCheckBox *checkBox = new QCheckBox(&menu);
- checkBox->setText(ModList::getColumnName(i));
- checkBox->setChecked(m_EnabledColumns.test(i) ? Qt::Checked : Qt::Unchecked);
- QWidgetAction *checkableAction = new QWidgetAction(&menu);
- checkableAction->setDefaultWidget(checkBox);
- menu.addAction(checkableAction);
- }
- menu.exec(pos);
- int i = 0;
-
- emit layoutAboutToBeChanged();
- m_EnabledColumns.reset();
- foreach (const QAction *action, menu.actions()) {
- const QWidgetAction *widgetAction = qobject_cast<const QWidgetAction*>(action);
- if (widgetAction != NULL) {
- const QCheckBox *checkBox = qobject_cast<const QCheckBox*>(widgetAction->defaultWidget());
- if (checkBox != NULL) {
- m_EnabledColumns.set(i, checkBox->checkState() == Qt::Checked);
- }
- }
- ++i;
- }
- emit layoutChanged();
-}
-
void ModListSortProxy::enableAllVisible()
{
if (m_Profile == NULL) return;
diff --git a/src/modlistsortproxy.h b/src/modlistsortproxy.h
index cb474200..ed98f71c 100644
--- a/src/modlistsortproxy.h
+++ b/src/modlistsortproxy.h
@@ -87,7 +87,6 @@ public:
public slots:
- void displayColumnSelection(const QPoint &pos);
void updateFilter(const QString &filter);
signals: