From 8d34ae34135cfd495556a059c449a5f11ca6212c Mon Sep 17 00:00:00 2001 From: Tannin Date: Sat, 13 Jul 2013 10:10:46 +0200 Subject: - some fixes to the refreshing behaviour - "fix" buttons in problems dialog are now actually functional - python proxy now has diagnosis functionality to warn user if correct proxy version is not available - python proxy now has a configurable python path --- src/mainwindow.cpp | 11 ++++++----- src/pluginlist.cpp | 3 --- src/problemsdialog.cpp | 16 ++++++++++++++-- src/problemsdialog.h | 1 + src/qtgroupingproxy.cpp | 12 ++++-------- src/settingsdialog.cpp | 6 ++++-- src/version.rc | 4 ++-- 7 files changed, 31 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b95be745..f001f3b2 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1318,8 +1318,8 @@ void MainWindow::activateSelectedProfile() connect(m_CurrentProfile, SIGNAL(modStatusChanged(uint)), this, SLOT(modStatusChanged(uint))); - refreshModList(); refreshSaveList(); + refreshModList(); } @@ -1484,7 +1484,6 @@ void MainWindow::refreshDirectoryStructure() m_DirectoryRefresher.setMods(activeModList); statusBar()->show(); -// m_RefreshProgress->setVisible(true); m_RefreshProgress->setRange(0, 100); QTimer::singleShot(0, &m_DirectoryRefresher, SLOT(refresh())); @@ -1552,7 +1551,6 @@ void MainWindow::refreshDataTree() void MainWindow::refreshSaveList() { - refreshLists(); ui->savegameList->clear(); QDir savesDir; @@ -2191,7 +2189,9 @@ void MainWindow::directory_refreshed() return; } m_DirectoryUpdate = false; - refreshLists(); + if (m_CurrentProfile != NULL) { + refreshLists(); + } // m_RefreshProgress->setVisible(false); statusBar()->hide(); } @@ -2975,7 +2975,8 @@ void MainWindow::saveCategories() saveCategoriesFromMenu(menu, mapToModel(&m_ModList, selected.at(i)).row()); } //m_ModList.notifyChange(min, max); - refreshModList(); + m_ModList.notifyChange(-1); +// refreshModList(); // find mods by their name because indices are invalidated QAbstractItemModel *model = ui->modList->model(); diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index d29ca585..df132287 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -643,12 +643,9 @@ bool PluginList::setData(const QModelIndex &index, const QVariant &value, int ro if (role == Qt::CheckStateRole) { m_ESPs[index.row()].m_Enabled = value.toInt() == Qt::Checked; - emit layoutAboutToBeChanged(); - refreshLoadOrder(); startSaveTime(); - emit layoutChanged(); return true; } else { return false; diff --git a/src/problemsdialog.cpp b/src/problemsdialog.cpp index 8173e1e2..d5700381 100644 --- a/src/problemsdialog.cpp +++ b/src/problemsdialog.cpp @@ -20,13 +20,19 @@ ProblemsDialog::ProblemsDialog(std::vector diagnosePl QTreeWidgetItem *newItem = new QTreeWidgetItem(); newItem->setText(0, diagnose->shortDescription(key)); newItem->setData(0, Qt::UserRole, diagnose->fullDescription(key)); + newItem->setData(1, Qt::UserRole, qVariantFromValue(reinterpret_cast(diagnose))); + newItem->setData(1, Qt::UserRole + 1, key); + + ui->problemsWidget->addTopLevelItem(newItem); if (diagnose->hasGuidedFix(key)) { - ui->problemsWidget->setItemWidget(newItem, 1, new QPushButton(tr("Fix"))); + newItem->setText(1, tr("fix")); + QPushButton *fixButton = new QPushButton(tr("Fix")); + connect(fixButton, SIGNAL(clicked()), this, SLOT(startFix())); + ui->problemsWidget->setItemWidget(newItem, 1, fixButton); } else { newItem->setText(1, tr("No guided fix")); } - ui->problemsWidget->addTopLevelItem(newItem); } } connect(ui->problemsWidget, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged())); @@ -52,6 +58,12 @@ void ProblemsDialog::selectionChanged() ui->descriptionText->setLineWrapMode(text.contains('\n') ? QTextEdit::NoWrap : QTextEdit::WidgetWidth); } +void ProblemsDialog::startFix() +{ + IPluginDiagnose *plugin = reinterpret_cast(ui->problemsWidget->currentItem()->data(1, Qt::UserRole).value()); + plugin->startGuidedFix(ui->problemsWidget->currentItem()->data(1, Qt::UserRole + 1).toUInt()); +} + void ProblemsDialog::urlClicked(const QUrl &url) { ::ShellExecuteW(NULL, L"open", ToWString(url.toString()).c_str(), NULL, NULL, SW_SHOWNORMAL); diff --git a/src/problemsdialog.h b/src/problemsdialog.h index 299faf8d..050785f4 100644 --- a/src/problemsdialog.h +++ b/src/problemsdialog.h @@ -27,6 +27,7 @@ private slots: void selectionChanged(); void urlClicked(const QUrl &url); + void startFix(); private: Ui::ProblemsDialog *ui; diff --git a/src/qtgroupingproxy.cpp b/src/qtgroupingproxy.cpp index f62d45d3..45ff192b 100644 --- a/src/qtgroupingproxy.cpp +++ b/src/qtgroupingproxy.cpp @@ -215,10 +215,7 @@ QtGroupingProxy::buildTree() QList QtGroupingProxy::addSourceRow( const QModelIndex &idx ) { - // TODO: modeltest reports a discrepance between the "rowAboutToBeInserted" and "rowInserted" events - QList updatedGroups; - QList groupData = belongsTo( idx ); //an empty list here means it's supposed to go in root. @@ -265,7 +262,6 @@ QtGroupingProxy::addSourceRow( const QModelIndex &idx ) updatedGroups << updatedGroup; } - //update m_groupHash to the new source-model layout (one row added) QMutableHashIterator > i( m_groupHash ); while( i.hasNext() ) @@ -290,9 +286,7 @@ QtGroupingProxy::addSourceRow( const QModelIndex &idx ) if( updatedGroups.contains( i.key() ) ) { //the row needs to be added to this group - beginInsertRows( index( i.key() ), insertedProxyRow, insertedProxyRow ); groupList.insert( insertedProxyRow, idx.row() ); - endInsertRows(); } } @@ -337,11 +331,13 @@ QModelIndex QtGroupingProxy::index( int row, int column, const QModelIndex &parent ) const { // qDebug() << "index requested for: (" << row << "," << column << "), " << parent; - if( !hasIndex(row, column, parent) ) + if( !hasIndex(row, column, parent) ) { return QModelIndex(); + } - if( parent.column() > 0 ) + if( parent.column() > 0 ) { return QModelIndex(); + } /* We save the instructions to make the parent of the index in a struct. * The place of the struct in the list is stored in the internalId diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp index 8fb990c1..9f268455 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -145,8 +145,10 @@ void SettingsDialog::on_pluginsList_currentItemChanged(QListWidgetItem *current, ui->pluginSettingsList->setEnabled(settings.count() != 0); for (auto iter = settings.begin(); iter != settings.end(); ++iter) { QTreeWidgetItem *newItem = new QTreeWidgetItem(QStringList(iter.key())); - newItem->setData(1, Qt::DisplayRole, *iter); - newItem->setData(1, Qt::EditRole, *iter); + QVariant value = *iter; + newItem->setData(1, Qt::DisplayRole, value); + newItem->setData(1, Qt::EditRole, value); + newItem->setFlags(newItem->flags() | Qt::ItemIsEditable); ui->pluginSettingsList->addTopLevelItem(newItem); } diff --git a/src/version.rc b/src/version.rc index 4a13f65b..e23603f1 100644 --- a/src/version.rc +++ b/src/version.rc @@ -1,7 +1,7 @@ #include "Winver.h" -#define VER_FILEVERSION 0,99,1,0 -#define VER_FILEVERSION_STR "0,99,1,0\0" +#define VER_FILEVERSION 0,99,2,0 +#define VER_FILEVERSION_STR "0,99,2,0\0" VS_VERSION_INFO VERSIONINFO FILEVERSION VER_FILEVERSION -- cgit v1.3.1