diff options
| author | Tannin <devnull@localhost> | 2013-10-20 16:51:40 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2013-10-20 16:51:40 +0200 |
| commit | bc7c42dbe8dd85a77a2eb8c1d094c77aa5cb7b1f (patch) | |
| tree | 63ed11fb562f87cbe815fb78978c6c801a1119e0 | |
| parent | 9a03783f491505940a20d006055a5427bf364807 (diff) | |
- directories in data-view are now sorted
- questionbox with selection memory is now exposed to plugins
- the choice to run fnis from the checker can now be memorized
| -rw-r--r-- | src/mainwindow.cpp | 11 | ||||
| -rw-r--r-- | src/organizer.pro | 3 | ||||
| -rw-r--r-- | src/questionboxmemory.cpp | 72 | ||||
| -rw-r--r-- | src/questionboxmemory.h | 63 | ||||
| -rw-r--r-- | src/questionboxmemory.ui | 139 | ||||
| -rw-r--r-- | src/shared/directoryentry.cpp | 7 |
6 files changed, 14 insertions, 281 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 4c72ada3..14bb3b59 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -59,14 +59,15 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <appconfig.h> #include <utility.h> #include <ipluginproxy.h> +#include <questionboxmemory.h> #include <map> #include <ctime> -#include <QTime> #include <util.h> +#include <wchar.h> +#include <QTime> #include <QInputDialog> #include <QSettings> #include <QWhatsThis> -#include <wchar.h> #include <sstream> #include <QProcess> #include <QMenu> @@ -162,6 +163,8 @@ MainWindow::MainWindow(const QString &exeName, QSettings &initSettings, QWidget ui->actionEndorseMO->setVisible(false); + MOBase::QuestionBoxMemory::init(initSettings.fileName()); + updateProblemsButton(); updateToolBar(); @@ -1264,7 +1267,7 @@ HANDLE MainWindow::spawnBinaryDirect(const QFileInfo &binary, const QString &arg (m_Settings.getLoadMechanism() == LoadMechanism::LOAD_MODORGANIZER)) { if (!testForSteam()) { if (QuestionBoxMemory::query(this->isVisible() ? this : NULL, - m_Settings.directInterface(), "steamQuery", tr("Start Steam?"), + "steamQuery", tr("Start Steam?"), tr("Steam is required to be running already to correctly start the game. " "Should MO try to start steam now?"), QDialogButtonBox::Yes | QDialogButtonBox::No) == QDialogButtonBox::Yes) { @@ -3094,7 +3097,7 @@ void MainWindow::testExtractBSA(int modIndex) QFileInfoList archives = dir.entryInfoList(QStringList("*.bsa")); if (archives.length() != 0 && - (QuestionBoxMemory::query(this, m_Settings.directInterface(), "unpackBSA", tr("Extract BSA"), + (QuestionBoxMemory::query(this, "unpackBSA", tr("Extract BSA"), tr("This mod contains at least one BSA. Do you want to unpack it?\n" "(This removes the BSA after completion. If you don't know about BSAs, just select no)"), QDialogButtonBox::Yes | QDialogButtonBox::No, QDialogButtonBox::No) == QMessageBox::Yes)) { diff --git a/src/organizer.pro b/src/organizer.pro index c817f2da..907979ee 100644 --- a/src/organizer.pro +++ b/src/organizer.pro @@ -27,7 +27,6 @@ SOURCES += \ savegamegamebryo.cpp \
savegame.cpp \
report.cpp \
- questionboxmemory.cpp \
queryoverwritedialog.cpp \
profilesdialog.cpp \
profile.cpp \
@@ -95,7 +94,6 @@ HEADERS += \ savegamegamebyro.h \
savegame.h \
report.h \
- questionboxmemory.h \
queryoverwritedialog.h \
profilesdialog.h \
profile.h \
@@ -156,7 +154,6 @@ FORMS += \ settingsdialog.ui \
selectiondialog.ui \
savegameinfowidget.ui \
- questionboxmemory.ui \
queryoverwritedialog.ui \
profilesdialog.ui \
overwriteinfodialog.ui \
diff --git a/src/questionboxmemory.cpp b/src/questionboxmemory.cpp deleted file mode 100644 index a7bb72b6..00000000 --- a/src/questionboxmemory.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* -Copyright (C) 2012 Sebastian Herbord. All rights reserved. - -This file is part of Mod Organizer. - -Mod Organizer is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Mod Organizer is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include "questionboxmemory.h"
-#include "ui_questionboxmemory.h"
-
-#include <QMessageBox>
-#include <QPushButton>
-
-QuestionBoxMemory::QuestionBoxMemory(QWidget *parent, const QString &title, const QString &text,
- const QDialogButtonBox::StandardButtons buttons, QDialogButtonBox::StandardButton defaultButton)
- : QDialog(parent), ui(new Ui::QuestionBoxMemory)
-{
- ui->setupUi(this);
-
- this->setWindowTitle(title);
-
- QIcon icon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion);
- ui->iconLabel->setPixmap(icon.pixmap(128));
- ui->messageLabel->setText(text);
- ui->buttonBox->setStandardButtons(buttons);
- if (defaultButton != QDialogButtonBox::NoButton) {
- ui->buttonBox->button(defaultButton)->setDefault(true);
- }
- connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*)));
-}
-
-
-QuestionBoxMemory::~QuestionBoxMemory()
-{
- delete ui;
-}
-
-
-void QuestionBoxMemory::buttonClicked(QAbstractButton *button)
-{
- m_Button = ui->buttonBox->standardButton(button);
-}
-
-
-QDialogButtonBox::StandardButton QuestionBoxMemory::query(QWidget *parent,
- QSettings &settings, const QString &name,
- const QString &title, const QString &text, QDialogButtonBox::StandardButtons buttons,
- QDialogButtonBox::StandardButton defaultButton)
-{
- if (settings.contains(QString("DialogChoices/") + name)) {
- return static_cast<QDialogButtonBox::StandardButton>(settings.value(QString("DialogChoices/") + name).toInt());
- } else {
- QuestionBoxMemory dialog(parent, title, text, buttons, defaultButton);
- dialog.exec();
- if (dialog.ui->rememberCheckBox->isChecked()) {
- settings.setValue(QString("DialogChoices/") + name, dialog.m_Button);
- }
- return dialog.m_Button;
- }
-}
diff --git a/src/questionboxmemory.h b/src/questionboxmemory.h deleted file mode 100644 index 72351830..00000000 --- a/src/questionboxmemory.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -Copyright (C) 2012 Sebastian Herbord. All rights reserved. - -This file is part of Mod Organizer. - -Mod Organizer is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Mod Organizer is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef QUESTIONBOXMEMORY_H
-#define QUESTIONBOXMEMORY_H
-
-#include <QDialog>
-#include <QSettings>
-#include <QDialogButtonBox>
-
-
-namespace Ui {
- class QuestionBoxMemory;
-}
-
-
-class QuestionBoxMemory : public QDialog
-{
- Q_OBJECT
-
-public:
-
- virtual ~QuestionBoxMemory();
- static QDialogButtonBox::StandardButton query(QWidget *parent,
- QSettings &settings, const QString &name,
- const QString &title, const QString &text,
- QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::Yes | QDialogButtonBox::No,
- QDialogButtonBox::StandardButton defaultButton = QDialogButtonBox::NoButton);
-private slots:
-
- void buttonClicked(QAbstractButton *button);
-
-private:
-
- explicit QuestionBoxMemory(QWidget *parent, const QString &title, const QString &text, const QDialogButtonBox::StandardButtons buttons,
- QDialogButtonBox::StandardButton defaultButton);
-
-private:
-
- Ui::QuestionBoxMemory *ui;
- QDialogButtonBox::StandardButton m_Button;
-
-};
-
-#endif // QUESTIONBOXMEMORY_H
-
-
diff --git a/src/questionboxmemory.ui b/src/questionboxmemory.ui deleted file mode 100644 index 9c211fe8..00000000 --- a/src/questionboxmemory.ui +++ /dev/null @@ -1,139 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>QuestionBoxMemory</class>
- <widget class="QDialog" name="QuestionBoxMemory">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>374</width>
- <height>130</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string notr="true">Placeholder</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout" stretch="1,0">
- <property name="spacing">
- <number>1</number>
- </property>
- <property name="margin">
- <number>2</number>
- </property>
- <item>
- <widget class="QFrame" name="frame">
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0">
- <item>
- <widget class="QLabel" name="iconLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>36</width>
- <height>36</height>
- </size>
- </property>
- <property name="autoFillBackground">
- <bool>false</bool>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="messageLabel">
- <property name="font">
- <font>
- <pointsize>9</pointsize>
- </font>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <property name="margin">
- <number>7</number>
- </property>
- <item>
- <widget class="QCheckBox" name="rememberCheckBox">
- <property name="text">
- <string>Remember selection</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::No|QDialogButtonBox::Yes</set>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>QuestionBoxMemory</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>248</x>
- <y>254</y>
- </hint>
- <hint type="destinationlabel">
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>QuestionBoxMemory</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>316</x>
- <y>260</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/src/shared/directoryentry.cpp b/src/shared/directoryentry.cpp index b3a12498..dde8a69e 100644 --- a/src/shared/directoryentry.cpp +++ b/src/shared/directoryentry.cpp @@ -492,6 +492,12 @@ static bool SupportOptimizedFind() }
+static bool DirCompareByName(const DirectoryEntry *lhs, const DirectoryEntry *rhs)
+{
+ return wcsicmp(lhs->getName().c_str(), rhs->getName().c_str()) < 0;
+}
+
+
void DirectoryEntry::addFiles(FilesOrigin &origin, wchar_t *buffer, int bufferOffset)
{
WIN32_FIND_DATAW findData;
@@ -523,6 +529,7 @@ void DirectoryEntry::addFiles(FilesOrigin &origin, wchar_t *buffer, int bufferOf result = ::FindNextFileW(searchHandle, &findData);
}
}
+ std::sort(m_SubDirectories.begin(), m_SubDirectories.end(), &DirCompareByName);
::FindClose(searchHandle);
}
|
