summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2013-08-24 22:50:00 +0200
committerTannin <devnull@localhost>2013-08-24 22:50:00 +0200
commite91eebefbea450a447b44a81dcabcc6ac8000a48 (patch)
tree25a6e1674f859249699d8242b7a611ae9d627890 /src
parent87f4e2df260e502bce61783a66e062af1b46e789 (diff)
- download size is now displayed
- multiple esps/mods can now be enabled/disabled at once using space - bugfix: fomod installer didn't compile because of changes to condition checking - bugfix: broken inverse virtual name resolution in case of non-default mod directory
Diffstat (limited to 'src')
-rw-r--r--src/downloadlistwidget.cpp2
-rw-r--r--src/downloadlistwidget.h1
-rw-r--r--src/downloadlistwidget.ui65
-rw-r--r--src/downloadlistwidgetcompact.cpp7
-rw-r--r--src/downloadlistwidgetcompact.h1
-rw-r--r--src/downloadlistwidgetcompact.ui64
-rw-r--r--src/downloadmanager.cpp10
-rw-r--r--src/downloadmanager.h8
-rw-r--r--src/mainwindow.cpp2
-rw-r--r--src/mainwindow.ui59
-rw-r--r--src/modinfo.cpp2
-rw-r--r--src/modlist.cpp20
-rw-r--r--src/pluginlist.cpp31
13 files changed, 184 insertions, 88 deletions
diff --git a/src/downloadlistwidget.cpp b/src/downloadlistwidget.cpp
index 743fc159..3a7dac66 100644
--- a/src/downloadlistwidget.cpp
+++ b/src/downloadlistwidget.cpp
@@ -44,6 +44,7 @@ DownloadListWidgetDelegate::DownloadListWidgetDelegate(DownloadManager *manager,
: QItemDelegate(parent), m_Manager(manager), m_ItemWidget(new DownloadListWidget), m_ContextRow(0), m_View(view)
{
m_NameLabel = m_ItemWidget->findChild<QLabel*>("nameLabel");
+ m_SizeLabel = m_ItemWidget->findChild<QLabel*>("sizeLabel");
m_Progress = m_ItemWidget->findChild<QProgressBar*>("downloadProgress");
m_InstallLabel = m_ItemWidget->findChild<QLabel*>("installLabel");
@@ -100,6 +101,7 @@ void DownloadListWidgetDelegate::paint(QPainter *painter, const QStyleOptionView
name.append("...");
}
m_NameLabel->setText(name);
+ m_SizeLabel->setText(QString::number(m_Manager->getFileSize(downloadIndex) / 1024));
DownloadManager::DownloadState state = m_Manager->getState(downloadIndex);
if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR)) {
QPalette labelPalette;
diff --git a/src/downloadlistwidget.h b/src/downloadlistwidget.h
index 5379356f..c80200fb 100644
--- a/src/downloadlistwidget.h
+++ b/src/downloadlistwidget.h
@@ -101,6 +101,7 @@ private:
DownloadManager *m_Manager;
QLabel *m_NameLabel;
+ QLabel *m_SizeLabel;
QProgressBar *m_Progress;
QLabel *m_InstallLabel;
int m_ContextRow;
diff --git a/src/downloadlistwidget.ui b/src/downloadlistwidget.ui
index 5f169215..01b2ee07 100644
--- a/src/downloadlistwidget.ui
+++ b/src/downloadlistwidget.ui
@@ -42,23 +42,54 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
- <widget class="QLabel" name="nameLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>1</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize">
- <size>
- <width>323</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string>Placeholder</string>
- </property>
- </widget>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="nameLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>323</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Placeholder</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="sizeLabel">
+ <property name="text">
+ <string>0</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>KB</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
diff --git a/src/downloadlistwidgetcompact.cpp b/src/downloadlistwidgetcompact.cpp
index 39e8010b..f3e395da 100644
--- a/src/downloadlistwidgetcompact.cpp
+++ b/src/downloadlistwidgetcompact.cpp
@@ -44,6 +44,7 @@ DownloadListWidgetCompactDelegate::DownloadListWidgetCompactDelegate(DownloadMan
: QItemDelegate(parent), m_Manager(manager), m_ItemWidget(new DownloadListWidgetCompact), m_View(view)
{
m_NameLabel = m_ItemWidget->findChild<QLabel*>("nameLabel");
+ m_SizeLabel = m_ItemWidget->findChild<QLabel*>("sizeLabel");
m_Progress = m_ItemWidget->findChild<QProgressBar*>("downloadProgress");
m_DoneLabel = m_ItemWidget->findChild<QLabel*>("doneLabel");
@@ -106,7 +107,13 @@ void DownloadListWidgetCompactDelegate::paint(QPainter *painter, const QStyleOpt
name.append("...");
}
m_NameLabel->setText(name);
+
DownloadManager::DownloadState state = m_Manager->getState(downloadIndex);
+
+ if (state >= DownloadManager::STATE_READY) {
+ m_SizeLabel->setText(QString::number(m_Manager->getFileSize(downloadIndex) / 1048576));
+ }
+
if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR)) {
m_DoneLabel->setVisible(true);
m_Progress->setVisible(false);
diff --git a/src/downloadlistwidgetcompact.h b/src/downloadlistwidgetcompact.h
index 3ac36e8d..78f51840 100644
--- a/src/downloadlistwidgetcompact.h
+++ b/src/downloadlistwidgetcompact.h
@@ -100,6 +100,7 @@ private:
DownloadManager *m_Manager;
QLabel *m_NameLabel;
+ QLabel *m_SizeLabel;
QProgressBar *m_Progress;
QLabel *m_DoneLabel;
diff --git a/src/downloadlistwidgetcompact.ui b/src/downloadlistwidgetcompact.ui
index b905706c..bc960c8e 100644
--- a/src/downloadlistwidgetcompact.ui
+++ b/src/downloadlistwidgetcompact.ui
@@ -29,7 +29,7 @@
<item>
<widget class="QLabel" name="nameLabel">
<property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -49,6 +49,40 @@
</widget>
</item>
<item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>(</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="sizeLabel">
+ <property name="text">
+ <string>0</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>MB)</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
<widget class="QLabel" name="doneLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
@@ -60,24 +94,24 @@
<palette>
<active>
<colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>0</red>
- <green>118</green>
- <blue>0</blue>
- </color>
- </brush>
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>118</green>
+ <blue>0</blue>
+ </color>
+ </brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>0</red>
- <green>118</green>
- <blue>0</blue>
- </color>
- </brush>
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>118</green>
+ <blue>0</blue>
+ </color>
+ </brush>
</colorrole>
</inactive>
<disabled>
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp
index 07048ada..ca6744aa 100644
--- a/src/downloadmanager.cpp
+++ b/src/downloadmanager.cpp
@@ -97,6 +97,7 @@ DownloadManager::DownloadInfo *DownloadManager::DownloadInfo::createFromMeta(con
info->m_DownloadID = s_NextDownloadID++;
info->m_Output.setFileName(filePath);
+ info->m_TotalSize = QFileInfo(filePath).size();
info->m_ModID = metaFile.value("modID", 0).toInt();
info->m_FileID = metaFile.value("fileID", 0).toInt();
info->m_CurrentUrl = 0;
@@ -596,6 +597,15 @@ QString DownloadManager::getFileName(int index) const
return m_ActiveDownloads.at(index)->m_FileName;
}
+qint64 DownloadManager::getFileSize(int index) const
+{
+ if ((index < 0) || (index >= m_ActiveDownloads.size())) {
+ throw MyException(tr("invalid index"));
+ }
+
+ return m_ActiveDownloads.at(index)->m_TotalSize;
+}
+
int DownloadManager::getProgress(int index) const
{
diff --git a/src/downloadmanager.h b/src/downloadmanager.h
index 4d493085..b4cb2786 100644
--- a/src/downloadmanager.h
+++ b/src/downloadmanager.h
@@ -207,6 +207,14 @@ public:
QString getFileName(int index) const;
/**
+ * @brief retrieve the file size of the download specified by index
+ *
+ * @param index index of the file to look up
+ * @return size of the file (total size during download)
+ */
+ qint64 getFileSize(int index) const;
+
+ /**
* @brief retrieve the current progress of the download specified by index
*
* @param index index of the file to look up
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index c4842738..4c9d388a 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -945,7 +945,7 @@ bool MainWindow::registerPlugin(QObject *plugin)
QObject *proxiedPlugin = proxy->instantiate(pluginName);
if (proxiedPlugin != NULL) {
if (registerPlugin(proxiedPlugin)) {
- qDebug("loaded plugin \"%s\"", pluginName.toUtf8().constData());
+ qDebug("loaded plugin \"%s\"", QDir::toNativeSeparators(pluginName).toUtf8().constData());
} else {
qWarning("plugin \"%s\" failed to load", pluginName.toUtf8().constData());
}
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 14f00336..eb587911 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -31,16 +31,7 @@
<property name="spacing">
<number>4</number>
</property>
- <property name="leftMargin">
- <number>6</number>
- </property>
- <property name="topMargin">
- <number>6</number>
- </property>
- <property name="rightMargin">
- <number>6</number>
- </property>
- <property name="bottomMargin">
+ <property name="margin">
<number>6</number>
</property>
<item>
@@ -320,7 +311,7 @@ p, li { white-space: pre-wrap; }
<bool>false</bool>
</property>
<attribute name="headerDefaultSectionSize">
- <number>10</number>
+ <number>20</number>
</attribute>
<attribute name="headerShowSortIndicator" stdset="0">
<bool>true</bool>
@@ -730,16 +721,7 @@ p, li { white-space: pre-wrap; }
<string notr="true">Archives</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_9">
- <property name="leftMargin">
- <number>6</number>
- </property>
- <property name="topMargin">
- <number>6</number>
- </property>
- <property name="rightMargin">
- <number>6</number>
- </property>
- <property name="bottomMargin">
+ <property name="margin">
<number>6</number>
</property>
<item>
@@ -818,16 +800,7 @@ BSAs checked here are loaded in such a way that your installation order is obeye
<string>Data</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
- <property name="leftMargin">
- <number>6</number>
- </property>
- <property name="topMargin">
- <number>6</number>
- </property>
- <property name="rightMargin">
- <number>6</number>
- </property>
- <property name="bottomMargin">
+ <property name="margin">
<number>6</number>
</property>
<item>
@@ -861,7 +834,7 @@ BSAs checked here are loaded in such a way that your installation order is obeye
<bool>true</bool>
</property>
<attribute name="headerDefaultSectionSize">
- <number>200</number>
+ <number>400</number>
</attribute>
<column>
<property name="text">
@@ -897,16 +870,7 @@ BSAs checked here are loaded in such a way that your installation order is obeye
<string>Saves</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
- <property name="leftMargin">
- <number>6</number>
- </property>
- <property name="topMargin">
- <number>6</number>
- </property>
- <property name="rightMargin">
- <number>6</number>
- </property>
- <property name="bottomMargin">
+ <property name="margin">
<number>6</number>
</property>
<item>
@@ -935,16 +899,7 @@ p, li { white-space: pre-wrap; }
<string>Downloads</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_7">
- <property name="leftMargin">
- <number>2</number>
- </property>
- <property name="topMargin">
- <number>2</number>
- </property>
- <property name="rightMargin">
- <number>2</number>
- </property>
- <property name="bottomMargin">
+ <property name="margin">
<number>2</number>
</property>
<item>
diff --git a/src/modinfo.cpp b/src/modinfo.cpp
index f6043d97..5cae62be 100644
--- a/src/modinfo.cpp
+++ b/src/modinfo.cpp
@@ -759,7 +759,7 @@ std::vector<QString> ModInfoRegular::getIniTweaks() const
if (numTweaks != 0) {
qDebug("%d active ini tweaks in %s",
- numTweaks, metaFileName.toUtf8().constData());
+ numTweaks, QDir::toNativeSeparators(metaFileName).toUtf8().constData());
}
for (int i = 0; i < numTweaks; ++i) {
diff --git a/src/modlist.cpp b/src/modlist.cpp
index 9c537300..a08162e7 100644
--- a/src/modlist.cpp
+++ b/src/modlist.cpp
@@ -801,6 +801,26 @@ bool ModList::eventFilter(QObject *obj, QEvent *event)
removeRow(rows[0].data(Qt::UserRole + 1).toInt(), QModelIndex());
}
return true;
+ } else if (keyEvent->key() == Qt::Key_Space) {
+ QItemSelectionModel *selectionModel = itemView->selectionModel();
+ const QSortFilterProxyModel *proxyModel = qobject_cast<const QSortFilterProxyModel*>(selectionModel->model());
+
+ QModelIndex minRow, maxRow;
+ foreach (QModelIndex idx, selectionModel->selectedRows()) {
+ if (proxyModel != NULL) {
+ idx = proxyModel->mapToSource(idx);
+ }
+ if (!minRow.isValid() || (idx.row() < minRow.row())) {
+ minRow = idx;
+ }
+ if (!maxRow.isValid() || (idx.row() > maxRow.row())) {
+ maxRow = idx;
+ }
+ int oldState = idx.data(Qt::CheckStateRole).toInt();
+ setData(idx, oldState == Qt::Unchecked ? Qt::Checked : Qt::Unchecked, Qt::CheckStateRole);
+ }
+ emit dataChanged(minRow, maxRow);
+ return true;
}
}
return QObject::eventFilter(obj, event);
diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp
index 61069c2f..dc2410ee 100644
--- a/src/pluginlist.cpp
+++ b/src/pluginlist.cpp
@@ -823,9 +823,15 @@ bool PluginList::eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::KeyPress) {
QAbstractItemView *itemView = qobject_cast<QAbstractItemView*>(obj);
+
+ if (itemView == NULL) {
+ return QObject::eventFilter(obj, event);
+ }
+
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
- if ((itemView != NULL) &&
- (keyEvent->modifiers() == Qt::ControlModifier) &&
+
+ // ctrl+up and ctrl+down -> increase or decrease priority of selected plugins
+ if ((keyEvent->modifiers() == Qt::ControlModifier) &&
((keyEvent->key() == Qt::Key_Up) || (keyEvent->key() == Qt::Key_Down))) {
QItemSelectionModel *selectionModel = itemView->selectionModel();
const QSortFilterProxyModel *proxyModel = qobject_cast<const QSortFilterProxyModel*>(selectionModel->model());
@@ -852,6 +858,27 @@ bool PluginList::eventFilter(QObject *obj, QEvent *event)
}
refreshLoadOrder();
return true;
+ } else if (keyEvent->key() == Qt::Key_Space) {
+ QItemSelectionModel *selectionModel = itemView->selectionModel();
+ const QSortFilterProxyModel *proxyModel = qobject_cast<const QSortFilterProxyModel*>(selectionModel->model());
+
+ QModelIndex minRow, maxRow;
+ foreach (QModelIndex idx, selectionModel->selectedRows()) {
+ if (proxyModel != NULL) {
+ idx = proxyModel->mapToSource(idx);
+ }
+ if (!minRow.isValid() || (idx.row() < minRow.row())) {
+ minRow = idx;
+ }
+ if (!maxRow.isValid() || (idx.row() > maxRow.row())) {
+ maxRow = idx;
+ }
+ int oldState = idx.data(Qt::CheckStateRole).toInt();
+ setData(idx, oldState == Qt::Unchecked ? Qt::Checked : Qt::Unchecked, Qt::CheckStateRole);
+ }
+ emit dataChanged(minRow, maxRow);
+
+ return true;
}
}
return QObject::eventFilter(obj, event);