diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/downloadlistwidget.cpp | 11 | ||||
| -rw-r--r-- | src/downloadlistwidget.h | 4 | ||||
| -rw-r--r-- | src/downloadlistwidgetcompact.cpp | 10 | ||||
| -rw-r--r-- | src/downloadlistwidgetcompact.h | 4 | ||||
| -rw-r--r-- | src/downloadmanager.cpp | 38 | ||||
| -rw-r--r-- | src/downloadmanager.h | 12 | ||||
| -rw-r--r-- | src/executableslist.cpp | 1 | ||||
| -rw-r--r-- | src/main.cpp | 5 | ||||
| -rw-r--r-- | src/mainwindow.cpp | 116 | ||||
| -rw-r--r-- | src/mainwindow.h | 2 | ||||
| -rw-r--r-- | src/mainwindow.ui | 20 | ||||
| -rw-r--r-- | src/modinfodialog.ui | 22 | ||||
| -rw-r--r-- | src/nexusinterface.cpp | 3 | ||||
| -rw-r--r-- | src/settings.cpp | 18 | ||||
| -rw-r--r-- | src/settings.h | 10 | ||||
| -rw-r--r-- | src/settingsdialog.ui | 29 | ||||
| -rw-r--r-- | src/shared/directoryentry.h | 1 |
17 files changed, 223 insertions, 83 deletions
diff --git a/src/downloadlistwidget.cpp b/src/downloadlistwidget.cpp index 68dd2adf..953cdacd 100644 --- a/src/downloadlistwidget.cpp +++ b/src/downloadlistwidget.cpp @@ -40,8 +40,13 @@ DownloadListWidget::~DownloadListWidget() } -DownloadListWidgetDelegate::DownloadListWidgetDelegate(DownloadManager *manager, QTreeView *view, QObject *parent) - : QItemDelegate(parent), m_Manager(manager), m_ItemWidget(new DownloadListWidget), m_ContextRow(0), m_View(view) +DownloadListWidgetDelegate::DownloadListWidgetDelegate(DownloadManager *manager, bool metaDisplay, QTreeView *view, QObject *parent) + : QItemDelegate(parent) + , m_Manager(manager) + , m_MetaDisplay(metaDisplay) + , m_ItemWidget(new DownloadListWidget) + , m_ContextRow(0) + , m_View(view) { m_NameLabel = m_ItemWidget->findChild<QLabel*>("nameLabel"); m_SizeLabel = m_ItemWidget->findChild<QLabel*>("sizeLabel"); @@ -95,7 +100,7 @@ void DownloadListWidgetDelegate::paintPendingDownload(int downloadIndex) const void DownloadListWidgetDelegate::paintRegularDownload(int downloadIndex) const { - QString name = m_Manager->getFileName(downloadIndex); + QString name = m_MetaDisplay ? m_Manager->getDisplayName(downloadIndex) : m_Manager->getFileName(downloadIndex); if (name.length() > 53) { name.truncate(50); name.append("..."); diff --git a/src/downloadlistwidget.h b/src/downloadlistwidget.h index 80c4430a..fa7cc845 100644 --- a/src/downloadlistwidget.h +++ b/src/downloadlistwidget.h @@ -54,7 +54,7 @@ class DownloadListWidgetDelegate : public QItemDelegate public: - DownloadListWidgetDelegate(DownloadManager *manager, QTreeView *view, QObject *parent = 0); + DownloadListWidgetDelegate(DownloadManager *manager, bool metaDisplay, QTreeView *view, QObject *parent = 0); ~DownloadListWidgetDelegate(); virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; @@ -105,6 +105,8 @@ private: DownloadListWidget *m_ItemWidget; DownloadManager *m_Manager; + bool m_MetaDisplay; + QLabel *m_NameLabel; QLabel *m_SizeLabel; QProgressBar *m_Progress; diff --git a/src/downloadlistwidgetcompact.cpp b/src/downloadlistwidgetcompact.cpp index e2fbcd24..818d339b 100644 --- a/src/downloadlistwidgetcompact.cpp +++ b/src/downloadlistwidgetcompact.cpp @@ -40,8 +40,12 @@ DownloadListWidgetCompact::~DownloadListWidgetCompact() } -DownloadListWidgetCompactDelegate::DownloadListWidgetCompactDelegate(DownloadManager *manager, QTreeView *view, QObject *parent) - : QItemDelegate(parent), m_Manager(manager), m_ItemWidget(new DownloadListWidgetCompact), m_View(view) +DownloadListWidgetCompactDelegate::DownloadListWidgetCompactDelegate(DownloadManager *manager, bool metaDisplay, QTreeView *view, QObject *parent) + : QItemDelegate(parent) + , m_Manager(manager) + , m_MetaDisplay(metaDisplay) + , m_ItemWidget(new DownloadListWidgetCompact) + , m_View(view) { m_NameLabel = m_ItemWidget->findChild<QLabel*>("nameLabel"); m_SizeLabel = m_ItemWidget->findChild<QLabel*>("sizeLabel"); @@ -97,7 +101,7 @@ void DownloadListWidgetCompactDelegate::paintPendingDownload(int downloadIndex) void DownloadListWidgetCompactDelegate::paintRegularDownload(int downloadIndex) const { - QString name = m_Manager->getFileName(downloadIndex); + QString name = m_MetaDisplay ? m_Manager->getDisplayName(downloadIndex) : m_Manager->getFileName(downloadIndex); if (name.length() > 53) { name.truncate(50); name.append("..."); diff --git a/src/downloadlistwidgetcompact.h b/src/downloadlistwidgetcompact.h index 4d7f40de..c3cd5c11 100644 --- a/src/downloadlistwidgetcompact.h +++ b/src/downloadlistwidgetcompact.h @@ -54,7 +54,7 @@ class DownloadListWidgetCompactDelegate : public QItemDelegate public: - DownloadListWidgetCompactDelegate(DownloadManager *manager, QTreeView *view, QObject *parent = 0); + DownloadListWidgetCompactDelegate(DownloadManager *manager, bool metaDisplay, QTreeView *view, QObject *parent = 0); ~DownloadListWidgetCompactDelegate(); virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; @@ -103,6 +103,8 @@ private: DownloadListWidgetCompact *m_ItemWidget; DownloadManager *m_Manager; + bool m_MetaDisplay; + QLabel *m_NameLabel; QLabel *m_SizeLabel; QProgressBar *m_Progress; diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 19470825..e79c3ba6 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -110,6 +110,10 @@ DownloadManager::DownloadInfo *DownloadManager::DownloadInfo::createFromMeta(con int fileID = metaFile.value("fileID", 0).toInt(); info->m_FileInfo = new ModRepositoryFileInfo(modID, fileID); info->m_FileInfo->name = metaFile.value("name", "").toString(); + if (info->m_FileInfo->name == "0") { + // bug in earlier version + info->m_FileInfo->name = ""; + } info->m_FileInfo->modName = metaFile.value("modName", "").toString(); info->m_FileInfo->modID = modID; info->m_FileInfo->fileID = fileID; @@ -413,8 +417,7 @@ void DownloadManager::startDownload(QNetworkReply *reply, DownloadInfo *newDownl if (!resume) { newDownload->m_PreResumeSize = newDownload->m_Output.size(); - - removePending(newDownload-> m_ModID, newDownload->m_FileID); + removePending(newDownload->m_FileInfo->modID, newDownload->m_FileInfo->fileID); emit aboutToUpdate(); @@ -440,7 +443,6 @@ void DownloadManager::addNXMDownload(const QString &url) } emit aboutToUpdate(); - m_PendingDownloads.append(std::make_pair(nxmInfo.modId(), nxmInfo.fileId())); emit update(-1); @@ -683,7 +685,6 @@ void DownloadManager::queryInfo(int index) } info->m_ReQueried = true; setState(info, STATE_FETCHINGMODINFO); -// m_RequestIDs.insert(m_NexusInterface->requestFiles(info->m_ModID, this, qVariantFromValue(static_cast<void*>(info)))); } @@ -715,6 +716,34 @@ QString DownloadManager::getFilePath(int index) const return m_OutputDirectory + "/" + m_ActiveDownloads.at(index)->m_FileName; } +QString DownloadManager::getFileTypeString(int fileType) +{ + switch (fileType) { + case 1: return tr("Main"); + case 2: return tr("Update"); + case 3: return tr("Optional"); + case 4: return tr("Old"); + case 5: return tr("Misc"); + default: return tr("Unknown"); + } +} + +QString DownloadManager::getDisplayName(int index) const +{ + if ((index < 0) || (index >= m_ActiveDownloads.size())) { + throw MyException(tr("invalid index")); + } + + DownloadInfo *info = m_ActiveDownloads.at(index); + + if (!info->m_FileInfo->name.isEmpty()) { + return QString("%1 (%2, v%3)").arg(info->m_FileInfo->name) + .arg(getFileTypeString(info->m_FileInfo->fileCategory)) + .arg(info->m_FileInfo->version.displayString()); + } else { + return info->m_FileName; + } +} QString DownloadManager::getFileName(int index) const { @@ -921,7 +950,6 @@ DownloadManager::DownloadInfo *DownloadManager::findDownload(QObject *reply, int void DownloadManager::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) { -qDebug("progress: %ldd / %ldd", bytesReceived, bytesTotal); if (bytesTotal == 0) { return; } diff --git a/src/downloadmanager.h b/src/downloadmanager.h index 27b5c526..e0cc20bd 100644 --- a/src/downloadmanager.h +++ b/src/downloadmanager.h @@ -72,8 +72,6 @@ private: QTime m_StartTime; qint64 m_PreResumeSize; int m_Progress; - int m_ModID; - int m_FileID; DownloadState m_State; int m_CurrentUrl; QStringList m_Urls; @@ -219,6 +217,14 @@ public: QString getFilePath(int index) const; /** + * @brief retrieve a descriptive name of the download specified by index + * + * @param index index of the file to look up + * @return display name of the file + **/ + QString getDisplayName(int index) const; + + /** * @brief retrieve the filename of the download specified by index * * @param index index of the file to look up @@ -450,6 +456,8 @@ private: void removePending(int modID, int fileID); + static QString getFileTypeString(int fileType); + private: static const int AUTOMATIC_RETRIES = 3; diff --git a/src/executableslist.cpp b/src/executableslist.cpp index 8f2da051..57341323 100644 --- a/src/executableslist.cpp +++ b/src/executableslist.cpp @@ -68,7 +68,6 @@ void ExecutablesList::init() { std::vector<ExecutableInfo> executables = GameInfo::instance().getExecutables(); for (std::vector<ExecutableInfo>::const_iterator iter = executables.begin(); iter != executables.end(); ++iter) { - ExecutableInfo test = *iter; addExecutableInternal(ToQString(iter->title), QDir::fromNativeSeparators(ToQString(GameInfo::instance().getGameDirectory())).append("/").append(ToQString(iter->binary)), ToQString(iter->arguments), ToQString(iter->workingDirectory), diff --git a/src/main.cpp b/src/main.cpp index 3b89e721..994dfd29 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -139,6 +139,10 @@ bool bootstrap() // verify the hook-dll exists QString dllName = qApp->applicationDirPath() + "/" + ToQString(AppConfig::hookDLLName()); + if (::GetModuleHandleW(ToWString(dllName).c_str()) != NULL) { + throw std::runtime_error("hook.dll already loaded! You can't start Mod Organizer from within itself (not even indirectly)"); + } + HMODULE dllMod = ::LoadLibraryW(ToWString(dllName).c_str()); if (dllMod == NULL) { throw windows_error("hook.dll is missing or invalid"); @@ -311,7 +315,6 @@ bool HaveWriteAccess(const std::wstring &path) } - int main(int argc, char *argv[]) { MOApplication application(argc, argv); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d947bab2..7960183c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -314,7 +314,6 @@ MainWindow::MainWindow(const QString &exeName, QSettings &initSettings, QWidget m_DirectoryRefresher.moveToThread(&m_RefresherThread); m_RefresherThread.start(); - setCompactDownloads(initSettings.value("compact_downloads", false).toBool()); m_AskForNexusPW = initSettings.value("ask_for_nexuspw", true).toBool(); setCategoryListVisible(initSettings.value("categorylist_visible", true).toBool()); FileDialogMemory::restore(initSettings); @@ -2154,53 +2153,71 @@ void MainWindow::storeSettings() m_CurrentProfile->createTweakedIniFile(); saveCurrentLists(); m_Settings.setupLoadMechanism(); - QSettings settings(ToQString(GameInfo::instance().getIniFilename()), QSettings::IniFormat); - if (m_CurrentProfile != NULL) { - settings.setValue("selected_profile", m_CurrentProfile->getName().toUtf8().constData()); - } else { - settings.remove("selected_profile"); - } - settings.setValue("mod_list_state", ui->modList->header()->saveState()); - settings.setValue("plugin_list_state", ui->espList->header()->saveState()); + QString iniFile = ToQString(GameInfo::instance().getIniFilename()); + shellCopy(iniFile, iniFile + ".new", true, this); + + QSettings::Status result = QSettings::NoError; + { + QSettings settings(iniFile + ".new", QSettings::IniFormat); + if (m_CurrentProfile != NULL) { + settings.setValue("selected_profile", m_CurrentProfile->getName().toUtf8().constData()); + } else { + settings.remove("selected_profile"); + } + + settings.setValue("mod_list_state", ui->modList->header()->saveState()); + settings.setValue("plugin_list_state", ui->espList->header()->saveState()); - settings.setValue("group_state", ui->groupCombo->currentIndex()); + settings.setValue("group_state", ui->groupCombo->currentIndex()); - settings.setValue("compact_downloads", ui->compactBox->isChecked()); - settings.setValue("ask_for_nexuspw", m_AskForNexusPW); + settings.setValue("ask_for_nexuspw", m_AskForNexusPW); - settings.setValue("window_geometry", saveGeometry()); - settings.setValue("window_split", ui->splitter->saveState()); + settings.setValue("window_geometry", saveGeometry()); + settings.setValue("window_split", ui->splitter->saveState()); - settings.setValue("browser_geometry", m_IntegratedBrowser.saveGeometry()); + settings.setValue("browser_geometry", m_IntegratedBrowser.saveGeometry()); - settings.setValue("filters_visible", ui->displayCategoriesBtn->isChecked()); + settings.setValue("filters_visible", ui->displayCategoriesBtn->isChecked()); - settings.remove("customExecutables"); - settings.beginWriteArray("customExecutables"); - std::vector<Executable>::const_iterator current, end; - m_ExecutablesList.getExecutables(current, end); - int count = 0; - for (; current != end; ++current) { - const Executable &item = *current; - if (item.m_Custom || item.m_Toolbar) { - settings.setArrayIndex(count++); - settings.setValue("binary", item.m_BinaryInfo.absoluteFilePath()); - settings.setValue("title", item.m_Title); - settings.setValue("arguments", item.m_Arguments); - settings.setValue("workingDirectory", item.m_WorkingDirectory); - settings.setValue("closeOnStart", item.m_CloseMO == DEFAULT_CLOSE); - settings.setValue("steamAppID", item.m_SteamAppID); - settings.setValue("custom", item.m_Custom); - settings.setValue("toolbar", item.m_Toolbar); + settings.remove("customExecutables"); + settings.beginWriteArray("customExecutables"); + std::vector<Executable>::const_iterator current, end; + m_ExecutablesList.getExecutables(current, end); + int count = 0; + for (; current != end; ++current) { + const Executable &item = *current; + if (item.m_Custom || item.m_Toolbar) { + settings.setArrayIndex(count++); + settings.setValue("binary", item.m_BinaryInfo.absoluteFilePath()); + settings.setValue("title", item.m_Title); + settings.setValue("arguments", item.m_Arguments); + settings.setValue("workingDirectory", item.m_WorkingDirectory); + settings.setValue("closeOnStart", item.m_CloseMO == DEFAULT_CLOSE); + settings.setValue("steamAppID", item.m_SteamAppID); + settings.setValue("custom", item.m_Custom); + settings.setValue("toolbar", item.m_Toolbar); + } } - } - settings.endArray(); + settings.endArray(); - QComboBox *executableBox = findChild<QComboBox*>("executablesListBox"); - settings.setValue("selected_executable", executableBox->currentIndex()); + QComboBox *executableBox = findChild<QComboBox*>("executablesListBox"); + settings.setValue("selected_executable", executableBox->currentIndex()); - FileDialogMemory::save(m_Settings.directInterface()); + FileDialogMemory::save(settings); + + settings.sync(); + result = settings.status(); + } + if (result == QSettings::NoError) { + shellRename(iniFile + ".new", iniFile, true, this); + } else { + QString reason = result == QSettings::AccessError ? tr("File is write protected") + : result == QSettings::FormatError ? tr("Invalid file format (probably a bug)") + : tr("Unknown error %1").arg(result); + QMessageBox::critical(this, tr("Failed to write settings"), + tr("An error occured trying to write back MO settings: %1").arg(reason)); + } } @@ -2682,12 +2699,6 @@ void MainWindow::setESPListSorting(int index) } -void MainWindow::setCompactDownloads(bool compact) -{ - ui->compactBox->setChecked(compact); -} - - bool MainWindow::queryLogin(QString &username, QString &password) { CredentialsDialog dialog(this); @@ -4253,6 +4264,8 @@ void MainWindow::on_actionSettings_triggered() } NexusInterface::instance()->setNMMVersion(m_Settings.getNMMVersion()); + + updateDownloadListDelegate(); } @@ -4768,10 +4781,12 @@ void MainWindow::on_actionEndorseMO_triggered() void MainWindow::updateDownloadListDelegate() { - if (ui->compactBox->isChecked()) { - ui->downloadView->setItemDelegate(new DownloadListWidgetCompactDelegate(&m_DownloadManager, ui->downloadView, ui->downloadView)); + if (m_Settings.compactDownloads()) { + ui->downloadView->setItemDelegate(new DownloadListWidgetCompactDelegate(&m_DownloadManager, m_Settings.metaDownloads(), + ui->downloadView, ui->downloadView)); } else { - ui->downloadView->setItemDelegate(new DownloadListWidgetDelegate(&m_DownloadManager, ui->downloadView, ui->downloadView)); + ui->downloadView->setItemDelegate(new DownloadListWidgetDelegate(&m_DownloadManager, m_Settings.metaDownloads(), + ui->downloadView, ui->downloadView)); } DownloadListSortProxy *sortProxy = new DownloadListSortProxy(&m_DownloadManager, ui->downloadView); @@ -4793,12 +4808,6 @@ void MainWindow::updateDownloadListDelegate() } -void MainWindow::on_compactBox_toggled(bool) -{ - updateDownloadListDelegate(); -} - - void MainWindow::modDetailsUpdated(bool) { --m_ModsToUpdate; @@ -5490,4 +5499,3 @@ void MainWindow::on_restoreModsButton_clicked() refreshModList(false); } } - diff --git a/src/mainwindow.h b/src/mainwindow.h index 2af84be4..83671015 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -106,7 +106,6 @@ public: void setModListSorting(int index); void setESPListSorting(int index); - void setCompactDownloads(bool compact); bool setCurrentProfile(int index); bool setCurrentProfile(const QString &name); @@ -571,7 +570,6 @@ private slots: // ui slots void bsaList_itemMoved(); void on_btnRefreshData_clicked(); void on_categoriesList_customContextMenuRequested(const QPoint &pos); - void on_compactBox_toggled(bool checked); void on_conflictsCheckBox_toggled(bool checked); void on_dataTree_customContextMenuRequested(const QPoint &pos); void on_executablesListBox_currentIndexChanged(int index); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index dc91121c..c7d35981 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1121,20 +1121,26 @@ p, li { white-space: pre-wrap; } </layout>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,2">
+ <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,2">
<item>
- <widget class="QCheckBox" name="compactBox">
+ <widget class="QCheckBox" name="showHiddenBox">
<property name="text">
- <string>Compact</string>
+ <string>Show Hidden</string>
</property>
</widget>
</item>
<item>
- <widget class="QCheckBox" name="showHiddenBox">
- <property name="text">
- <string>Show Hidden</string>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
</property>
- </widget>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
</item>
<item>
<widget class="MOBase::LineEditClear" name="downloadFilterEdit">
diff --git a/src/modinfodialog.ui b/src/modinfodialog.ui index 1d357f70..d3862b58 100644 --- a/src/modinfodialog.ui +++ b/src/modinfodialog.ui @@ -78,7 +78,7 @@ </attribute>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
- <layout class="QVBoxLayout" name="verticalLayout_5" stretch="0,0">
+ <layout class="QVBoxLayout" name="verticalLayout_5" stretch="0,0,0,0">
<property name="spacing">
<number>6</number>
</property>
@@ -86,6 +86,13 @@ <enum>QLayout::SetMinimumSize</enum>
</property>
<item>
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Ini Files</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QListWidget" name="iniFileList">
<property name="maximumSize">
<size>
@@ -102,6 +109,13 @@ </widget>
</item>
<item>
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Ini Tweaks</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QListWidget" name="iniTweaksList">
<property name="maximumSize">
<size>
@@ -112,6 +126,12 @@ <property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
+ <property name="toolTip">
+ <string>This is a list of ini tweaks (ini modifications that can be toggled).</string>
+ </property>
+ <property name="whatsThis">
+ <string>This is a list of ini tweaks. Ini Tweaks are (usually small) fragments of ini files that are applied over existing settings in skyrim.ini/skyrimprefs.ini. Each tweak can be toggled individually. You should check the description of the mod wether the tweaks are really optional.</string>
+ </property>
</widget>
</item>
</layout>
diff --git a/src/nexusinterface.cpp b/src/nexusinterface.cpp index 57c8819d..d6cf8d8f 100644 --- a/src/nexusinterface.cpp +++ b/src/nexusinterface.cpp @@ -508,7 +508,8 @@ void NexusInterface::requestError(QNetworkReply::NetworkError) return; } - qCritical("request error: %s", reply->errorString().toUtf8().constData()); + qCritical("request (%s) error: %s", + qPrintable(reply->url().toString()), qPrintable(reply->errorString())); } diff --git a/src/settings.cpp b/src/settings.cpp index d9a7e799..d63aabe4 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -242,6 +242,16 @@ bool Settings::getNexusLogin(QString &username, QString &password) const } } +bool Settings::compactDownloads() const +{ + return m_Settings.value("Settings/compact_downloads", false).toBool(); +} + +bool Settings::metaDownloads() const +{ + return m_Settings.value("Settings/meta_downloads", false).toBool(); +} + bool Settings::offlineMode() const { return m_Settings.value("Settings/offline_mode", false).toBool(); @@ -508,7 +518,8 @@ void Settings::query(QWidget *parent) QComboBox *languageBox = dialog.findChild<QComboBox*>("languageBox"); QComboBox *styleBox = dialog.findChild<QComboBox*>("styleBox"); QComboBox *logLevelBox = dialog.findChild<QComboBox*>("logLevelBox"); -// QCheckBox *handleNXMBox = dialog.findChild<QCheckBox*>("handleNXMBox"); + QCheckBox *compactBox = dialog.findChild<QCheckBox*>("compactBox"); + QCheckBox *showMetaBox = dialog.findChild<QCheckBox*>("showMetaBox"); QLineEdit *downloadDirEdit = dialog.findChild<QLineEdit*>("downloadDirEdit"); QLineEdit *modDirEdit = dialog.findChild<QLineEdit*>("modDirEdit"); @@ -587,6 +598,9 @@ void Settings::query(QWidget *parent) } } + compactBox->setChecked(compactDownloads()); + showMetaBox->setChecked(metaDownloads()); + hideUncheckedBox->setChecked(hideUncheckedPlugins()); forceEnableBox->setChecked(forceEnableCoreFiles()); @@ -651,6 +665,8 @@ void Settings::query(QWidget *parent) m_Settings.setValue("Settings/hide_unchecked_plugins", hideUncheckedBox->checkState() ? true : false); m_Settings.setValue("Settings/force_enable_core_files", forceEnableBox->checkState() ? true : false); + m_Settings.setValue("Settings/compact_downloads", compactBox->isChecked()); + m_Settings.setValue("Settings/meta_downloads", showMetaBox->isChecked()); m_Settings.setValue("Settings/load_mechanism", mechanismBox->itemData(mechanismBox->currentIndex()).toInt()); if (QDir(downloadDirEdit->text()).exists()) { m_Settings.setValue("Settings/download_directory", QDir::toNativeSeparators(downloadDirEdit->text())); diff --git a/src/settings.h b/src/settings.h index 81174440..ccb70d8a 100644 --- a/src/settings.h +++ b/src/settings.h @@ -143,6 +143,16 @@ public: bool offlineMode() const; /** + * @return true if the user chose compact downloads + */ + bool compactDownloads() const; + + /** + * @return true if the user chose meta downloads + */ + bool metaDownloads() const; + + /** * @return the configured log level */ int logLevel() const; diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui index bda6726c..2e0ffae1 100644 --- a/src/settingsdialog.ui +++ b/src/settingsdialog.ui @@ -194,6 +194,35 @@ p, li { white-space: pre-wrap; } </widget>
</item>
<item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>User interface</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_11">
+ <item>
+ <widget class="QCheckBox" name="compactBox">
+ <property name="toolTip">
+ <string>If checked, the download interface will be more compact.</string>
+ </property>
+ <property name="text">
+ <string>Compact Download Interface</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="showMetaBox">
+ <property name="toolTip">
+ <string>If checked, the download list will display meta information instead of file names.</string>
+ </property>
+ <property name="text">
+ <string>Download Meta Information</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
<widget class="QPushButton" name="resetDialogsButton">
<property name="maximumSize">
<size>
diff --git a/src/shared/directoryentry.h b/src/shared/directoryentry.h index 15af5e9e..be4bfa60 100644 --- a/src/shared/directoryentry.h +++ b/src/shared/directoryentry.h @@ -281,6 +281,7 @@ private: file = m_FileRegister->getFile(iter->second);
} else {
file = m_FileRegister->createFile(fileName, this);
+#pragma message("this has been observed to cause a crash, no clue why")
m_Files[fileName] = file->getIndex();
}
file->addOrigin(origin.getID(), fileTime, archive);
|
