From 49cbe0349184419530d22782cc670946b61c9f01 Mon Sep 17 00:00:00 2001 From: Tannin Date: Sat, 15 Jun 2013 14:42:20 +0200 Subject: - completed Qt5 compatibility - added GetFileVerisonInfoW hook for Windows 8 compatibility - fixed BossDummy to compile correctly with current version of the RGiesecke.DllExport assembly - fixed NCC components compiling with different Framewerk versions - dropped files-list in Nexus-tab of modinfo dialog --- src/activatemodsdialog.cpp | 166 ++++++++++++++++++++++---------------------- src/categoriesdialog.cpp | 2 +- src/downloadlistwidget.cpp | 6 +- src/installationmanager.cpp | 9 +++ src/logbuffer.cpp | 8 +-- src/logbuffer.h | 114 +++++++++++++++--------------- src/main.cpp | 1 - src/mainwindow.cpp | 12 ++-- src/modinfodialog.cpp | 64 ----------------- src/modinfodialog.h | 1 - src/modinfodialog.ui | 76 ++++---------------- src/modlist.cpp | 5 +- src/modlistsortproxy.h | 2 - src/modlistview.cpp | 1 + src/nexusdialog.h | 3 - src/nexusview.cpp | 1 - src/nxmaccessmanager.cpp | 21 ++++-- src/nxmaccessmanager.h | 152 ++++++++++++++++++++-------------------- src/organizer.pro | 2 + src/pluginlist.cpp | 2 +- src/syncoverwritedialog.cpp | 2 +- 21 files changed, 276 insertions(+), 374 deletions(-) (limited to 'src') diff --git a/src/activatemodsdialog.cpp b/src/activatemodsdialog.cpp index fe085c49..cf798189 100644 --- a/src/activatemodsdialog.cpp +++ b/src/activatemodsdialog.cpp @@ -17,86 +17,86 @@ You should have received a copy of the GNU General Public License along with Mod Organizer. If not, see . */ -#include "activatemodsdialog.h" -#include "ui_activatemodsdialog.h" - -#include -#include - -ActivateModsDialog::ActivateModsDialog(const std::map > &missingPlugins, QWidget *parent) - : TutorableDialog("ActivateMods", parent), ui(new Ui::ActivateModsDialog) -{ - ui->setupUi(this); - - QTableWidget *modsTable = findChild("modsTable"); - QHeaderView *headerView = modsTable->horizontalHeader(); -#if QT_VERSION >= 0x050000 - headerView->setSectionResizeMode(0, QHeaderView::Stretch); - headerView->setSectionResizeMode(1, QHeaderView::Interactive); -#else - headerView->setResizeMode(0, QHeaderView::Stretch); - headerView->setResizeMode(1, QHeaderView::Interactive); -#endif - - int row = 0; - - modsTable->setRowCount(missingPlugins.size()); - - for (std::map >::const_iterator espIter = missingPlugins.begin(); - espIter != missingPlugins.end(); ++espIter, ++row) { - modsTable->setCellWidget(row, 0, new QLabel(espIter->first)); - if (espIter->second.size() == 0) { - modsTable->setCellWidget(row, 1, new QLabel(tr("not found"))); - } else { - QComboBox* combo = new QComboBox(); - for (std::vector::const_iterator modIter = espIter->second.begin(); - modIter != espIter->second.end(); ++modIter) { - combo->addItem(*modIter); - } - modsTable->setCellWidget(row, 1, combo); - } - } -} - - -ActivateModsDialog::~ActivateModsDialog() -{ - delete ui; -} - - -void ActivateModsDialog::on_buttonBox_accepted() -{ -} - - -std::set ActivateModsDialog::getModsToActivate() -{ - std::set result; - QTableWidget *modsTable = findChild("modsTable"); - - for (int row = 0; row < modsTable->rowCount(); ++row) { - QComboBox *comboBox = dynamic_cast(modsTable->cellWidget(row, 1)); - if (comboBox != NULL) { - result.insert(comboBox->currentText()); - } - } - return result; -} - - -std::set ActivateModsDialog::getESPsToActivate() -{ - std::set result; - QTableWidget *modsTable = findChild("modsTable"); - - for (int row = 0; row < modsTable->rowCount(); ++row) { - QComboBox *comboBox = dynamic_cast(modsTable->cellWidget(row, 1)); - if (comboBox != NULL) { - QLabel *espName = dynamic_cast(modsTable->cellWidget(row, 0)); - - result.insert(espName->text()); - } - } - return result; -} +#include "activatemodsdialog.h" +#include "ui_activatemodsdialog.h" + +#include +#include + +ActivateModsDialog::ActivateModsDialog(const std::map > &missingPlugins, QWidget *parent) + : TutorableDialog("ActivateMods", parent), ui(new Ui::ActivateModsDialog) +{ + ui->setupUi(this); + + QTableWidget *modsTable = findChild("modsTable"); + QHeaderView *headerView = modsTable->horizontalHeader(); +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) + headerView->setSectionResizeMode(0, QHeaderView::Stretch); + headerView->setSectionResizeMode(1, QHeaderView::Interactive); +#else + headerView->setResizeMode(0, QHeaderView::Stretch); + headerView->setResizeMode(1, QHeaderView::Interactive); +#endif + + int row = 0; + + modsTable->setRowCount(missingPlugins.size()); + + for (std::map >::const_iterator espIter = missingPlugins.begin(); + espIter != missingPlugins.end(); ++espIter, ++row) { + modsTable->setCellWidget(row, 0, new QLabel(espIter->first)); + if (espIter->second.size() == 0) { + modsTable->setCellWidget(row, 1, new QLabel(tr("not found"))); + } else { + QComboBox* combo = new QComboBox(); + for (std::vector::const_iterator modIter = espIter->second.begin(); + modIter != espIter->second.end(); ++modIter) { + combo->addItem(*modIter); + } + modsTable->setCellWidget(row, 1, combo); + } + } +} + + +ActivateModsDialog::~ActivateModsDialog() +{ + delete ui; +} + + +void ActivateModsDialog::on_buttonBox_accepted() +{ +} + + +std::set ActivateModsDialog::getModsToActivate() +{ + std::set result; + QTableWidget *modsTable = findChild("modsTable"); + + for (int row = 0; row < modsTable->rowCount(); ++row) { + QComboBox *comboBox = dynamic_cast(modsTable->cellWidget(row, 1)); + if (comboBox != NULL) { + result.insert(comboBox->currentText()); + } + } + return result; +} + + +std::set ActivateModsDialog::getESPsToActivate() +{ + std::set result; + QTableWidget *modsTable = findChild("modsTable"); + + for (int row = 0; row < modsTable->rowCount(); ++row) { + QComboBox *comboBox = dynamic_cast(modsTable->cellWidget(row, 1)); + if (comboBox != NULL) { + QLabel *espName = dynamic_cast(modsTable->cellWidget(row, 0)); + + result.insert(espName->text()); + } + } + return result; +} diff --git a/src/categoriesdialog.cpp b/src/categoriesdialog.cpp index c7f03740..793ece66 100644 --- a/src/categoriesdialog.cpp +++ b/src/categoriesdialog.cpp @@ -164,7 +164,7 @@ void CategoriesDialog::fillTable() CategoryFactory &categories = CategoryFactory::instance(); QTableWidget *table = ui->categoriesTable; -#if QT_VERSION >= 0x050000 +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) table->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed); table->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch); table->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Fixed); diff --git a/src/downloadlistwidget.cpp b/src/downloadlistwidget.cpp index 18276b0a..09187489 100644 --- a/src/downloadlistwidget.cpp +++ b/src/downloadlistwidget.cpp @@ -75,7 +75,7 @@ void DownloadListWidgetDelegate::paint(QPainter *painter, const QStyleOptionView QPalette labelPalette; m_InstallLabel->setVisible(true); m_Progress->setVisible(false); -#if QT_VERSION >= 0x050000 +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) m_InstallLabel->setText(QApplication::translate("DownloadListWidget", "Paused - Double Click to resume", 0)); #else m_InstallLabel->setText(QApplication::translate("DownloadListWidget", "Paused - Double Click to resume", 0, QApplication::UnicodeUTF8)); @@ -95,7 +95,7 @@ void DownloadListWidgetDelegate::paint(QPainter *painter, const QStyleOptionView if (state == DownloadManager::STATE_INSTALLED) { // the tr-macro doesn't work here, maybe because the translation is actually associated with DownloadListWidget instead // of DownloadListWidgetDelegate? -#if QT_VERSION >= 0x050000 +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) m_InstallLabel->setText(QApplication::translate("DownloadListWidget", "Installed - Double Click to re-install", 0)); #else m_InstallLabel->setText(QApplication::translate("DownloadListWidget", "Installed - Double Click to re-install", 0, QApplication::UnicodeUTF8)); @@ -104,7 +104,7 @@ void DownloadListWidgetDelegate::paint(QPainter *painter, const QStyleOptionView } else { // the tr-macro doesn't work here, maybe because the translation is actually associated with DownloadListWidget instead // of DownloadListWidgetDelegate? -#if QT_VERSION >= 0x050000 +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) m_InstallLabel->setText(QApplication::translate("DownloadListWidget", "Done - Double Click to install", 0)); #else m_InstallLabel->setText(QApplication::translate("DownloadListWidget", "Done - Double Click to install", 0, QApplication::UnicodeUTF8)); diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp index b8cfbcb8..7b09c7b6 100644 --- a/src/installationmanager.cpp +++ b/src/installationmanager.cpp @@ -82,6 +82,7 @@ InstallationManager::InstallationManager(QWidget *parent) throw MyException(getErrorString(m_CurrentArchive->getLastError())); } + m_InstallationProgress.setWindowFlags(m_InstallationProgress.windowFlags() & (~Qt::WindowContextHelpButtonHint)); } @@ -385,13 +386,21 @@ void InstallationManager::updateProgress(float percentage) void InstallationManager::updateProgressFile(LPCWSTR fileName) { +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) + m_InstallationProgress.setLabelText(QString::fromWCharArray(fileName)); +#else m_InstallationProgress.setLabelText(QString::fromUtf16(fileName)); +#endif } void InstallationManager::report7ZipError(LPCWSTR errorMessage) { +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) + m_InstallationProgress.setLabelText(QString::fromWCharArray(errorMessage)); +#else reportError(QString::fromUtf16(errorMessage)); +#endif } diff --git a/src/logbuffer.cpp b/src/logbuffer.cpp index d563f796..a3b6f1b5 100644 --- a/src/logbuffer.cpp +++ b/src/logbuffer.cpp @@ -36,7 +36,7 @@ LogBuffer::LogBuffer(int messageCount, QtMsgType minMsgType, const QString &outp LogBuffer::~LogBuffer() { -#if QT_VERSION >= 0x050000 +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) qInstallMessageHandler(0); #else qInstallMsgHandler(0); @@ -91,14 +91,14 @@ void LogBuffer::init(int messageCount, QtMsgType minMsgType, const QString &outp s_Instance.reset(); } s_Instance.reset(new LogBuffer(messageCount, minMsgType, outputFileName)); -#if QT_VERSION >= 0x050000 +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) qInstallMessageHandler(LogBuffer::log); #else qInstallMsgHandler(LogBuffer::log); #endif } -#if QT_VERSION >= 0x050000 +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) void LogBuffer::log(QtMsgType type, const QMessageLogContext &context, const QString &message) { @@ -106,7 +106,7 @@ void LogBuffer::log(QtMsgType type, const QMessageLogContext &context, const QSt if (!s_Instance.isNull()) { s_Instance->logMessage(type, message); } - fprintf(stdout, "(%s:%u, %s) %s\n", context.file, context.line, context.function, message.toLocal8Bit()); + fprintf(stdout, "(%s:%u) %s\n", context.file, context.line, qPrintable(message)); fflush(stdout); } diff --git a/src/logbuffer.h b/src/logbuffer.h index d1e292b9..de5e887f 100644 --- a/src/logbuffer.h +++ b/src/logbuffer.h @@ -17,60 +17,60 @@ You should have received a copy of the GNU General Public License along with Mod Organizer. If not, see . */ -#ifndef LOGBUFFER_H -#define LOGBUFFER_H - -#include -#include -#include -#include - - -class LogBuffer : public QObject -{ - Q_OBJECT - -public: - - static void init(int messageCount, QtMsgType minMsgType, const QString &outputFileName); -#if QT_VERSION >= 0x050000 - static void log(QtMsgType type, const QMessageLogContext &context, const QString &message); -#else - static void log(QtMsgType type, const char *message); -#endif - - static void writeNow(); - static void cleanQuit(); - -public: - - virtual ~LogBuffer(); - - void logMessage(QtMsgType type, const QString &message); - -signals: - -public slots: - -private: - - explicit LogBuffer(int messageCount, QtMsgType minMsgType, const QString &outputFileName); - LogBuffer(const LogBuffer &reference); // not implemented - LogBuffer &operator=(const LogBuffer &reference); // not implemented - - void write() const; - -private: - - static QScopedPointer s_Instance; - static QMutex s_Mutex; - - QString m_OutFileName; - bool m_ShutDown; - QtMsgType m_MinMsgType; - unsigned int m_NumMessages; - std::vector m_Messages; - -}; - -#endif // LOGBUFFER_H +#ifndef LOGBUFFER_H +#define LOGBUFFER_H + +#include +#include +#include +#include + + +class LogBuffer : public QObject +{ + Q_OBJECT + +public: + + static void init(int messageCount, QtMsgType minMsgType, const QString &outputFileName); +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) + static void log(QtMsgType type, const QMessageLogContext &context, const QString &message); +#else + static void log(QtMsgType type, const char *message); +#endif + + static void writeNow(); + static void cleanQuit(); + +public: + + virtual ~LogBuffer(); + + void logMessage(QtMsgType type, const QString &message); + +signals: + +public slots: + +private: + + explicit LogBuffer(int messageCount, QtMsgType minMsgType, const QString &outputFileName); + LogBuffer(const LogBuffer &reference); // not implemented + LogBuffer &operator=(const LogBuffer &reference); // not implemented + + void write() const; + +private: + + static QScopedPointer s_Instance; + static QMutex s_Mutex; + + QString m_OutFileName; + bool m_ShutDown; + QtMsgType m_MinMsgType; + unsigned int m_NumMessages; + std::vector m_Messages; + +}; + +#endif // LOGBUFFER_H diff --git a/src/main.cpp b/src/main.cpp index 3f8ea46f..93b9d5c6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -425,7 +425,6 @@ int main(int argc, char *argv[]) application.setStyleFile(settings.value("Settings/style", "").toString()); - qDebug("setting up main window"); // set up main window and its data structures MainWindow mainWindow(argv[0], settings); QObject::connect(&mainWindow, SIGNAL(styleChanged(QString)), &application, SLOT(setStyleFile(QString))); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e6f48ea5..509be36d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -184,7 +184,7 @@ MainWindow::MainWindow(const QString &exeName, QSettings &initSettings, QWidget // restoreState also seems to restores the resize mode from previous session, // I don't really like that -#if QT_VERSION >= 0x50000 +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) for (int i = 0; i < ui->modList->header()->count(); ++i) { ui->modList->header()->setSectionResizeMode(i, QHeaderView::ResizeToContents); } @@ -204,7 +204,7 @@ MainWindow::MainWindow(const QString &exeName, QSettings &initSettings, QWidget ui->espList->sortByColumn(PluginList::COL_PRIORITY, Qt::AscendingOrder); ui->espList->header()->restoreState(initSettings.value("plugin_list_state").toByteArray()); ui->espList->installEventFilter(&m_PluginList); -#if QT_VERSION >= 0x50000 +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) for (int i = 0; i < ui->espList->header()->count(); ++i) { ui->espList->header()->setSectionResizeMode(i, QHeaderView::ResizeToContents); } @@ -1498,7 +1498,7 @@ void MainWindow::refreshDirectoryStructure() QIcon MainWindow::iconForExecutable(const QString &filePath) { - HICON winIcon; +/* HICON winIcon; UINT res = ::ExtractIconExW(ToWString(filePath).c_str(), 0, &winIcon, NULL, 1); if (res == 1) { QIcon result = QIcon(QPixmap::fromWinHICON(winIcon)); @@ -1506,7 +1506,9 @@ QIcon MainWindow::iconForExecutable(const QString &filePath) return result; } else { return QIcon(":/MO/gui/executable"); - } + }*/ + + return QIcon(":/MO/gui/executable"); } @@ -1610,7 +1612,7 @@ void MainWindow::refreshBSAList() { m_ArchivesInit = false; ui->bsaList->clear(); -#if QT_VERSION >= 0x50000 +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) ui->bsaList->header()->setSectionResizeMode(QHeaderView::ResizeToContents); #else ui->bsaList->header()->setResizeMode(QHeaderView::ResizeToContents); diff --git a/src/modinfodialog.cpp b/src/modinfodialog.cpp index be3052af..4f2ad9da 100644 --- a/src/modinfodialog.cpp +++ b/src/modinfodialog.cpp @@ -764,43 +764,6 @@ void ModInfoDialog::modDetailsUpdated(bool success) updateVersionColor(); } - - QTableWidget *filesWidget = findChild("filesWidget"); - filesWidget->clearContents(); - filesWidget->setRowCount(0); - filesWidget->setColumnCount(5); -#if QT_VERSION >= 0x050000 - filesWidget->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch); -#else - filesWidget->horizontalHeader()->setResizeMode(1, QHeaderView::Stretch); -#endif - filesWidget->horizontalHeader()->setVisible(true); - filesWidget->setColumnHidden(4, true); - - - // prevent sorting while we change the table - filesWidget->setSortingEnabled(false); - int row = 0; - QList::const_iterator current, end; - m_ModInfo->getNexusFiles(current, end); - for (; current != end; ++current) { - const ModRepositoryFileInfo &fileInfo = *current; - filesWidget->insertRow(row); - int type = fileInfo.categoryID; - filesWidget->setItem(row, 4, new QTableWidgetItem(QString("%1").arg(type))); - filesWidget->setItem(row, 0, new QTableWidgetItem(getFileCategory(type))); - QTableWidgetItem *nameItem = new QTableWidgetItem(fileInfo.name); - nameItem->setToolTip(fileInfo.description); - nameItem->setData(Qt::UserRole, fileInfo.fileID); - filesWidget->setItem(row, 1, nameItem); - filesWidget->setItem(row, 2, new QTableWidgetItem(fileInfo.version.canonicalString())); - QTableWidgetItem *sizeItem = new QTableWidgetItem(); - sizeItem->setData(Qt::DisplayRole, fileInfo.fileSize); - filesWidget->setItem(row, 3, sizeItem); - ++row; - } - filesWidget->setSortingEnabled(true); - filesWidget->sortItems(4); } } @@ -859,33 +822,6 @@ void ModInfoDialog::on_versionEdit_editingFinished() updateVersionColor(); } -void ModInfoDialog::on_filesWidget_doubleClicked(const QModelIndex &index) -{ - QTableWidget *filesWidget = findChild("filesWidget"); - - QTableWidgetItem *selectedItem = filesWidget->item(index.row(), 1); - if (selectedItem == NULL) { - qDebug("no item in row %d", index.row()); - return; - } - - QString nexusLink = QString("nxm://%1/mods/%2/files/%3") - .arg(ToQString(GameInfo::instance().getGameName())) - .arg(m_Settings->value("modid").toInt()) - .arg(selectedItem->data(Qt::UserRole).toInt()); - - try { - if (QuestionBoxMemory::query(this, Settings::instance().directInterface(), "confirmNexusDownload", - tr("Confirm"), tr("Download \"%1\"?").arg(selectedItem->text()), - QDialogButtonBox::Yes | QDialogButtonBox::No) == QDialogButtonBox::Yes) { - emit downloadRequest(nexusLink); - MessageDialog::showMessage(tr("Download started"), this); - } - } catch (const std::exception &e) { - reportError(tr("Exception: %1").arg(e.what())); - } -} - bool ModInfoDialog::recursiveDelete(const QModelIndex &index) { diff --git a/src/modinfodialog.h b/src/modinfodialog.h index 7d4ddf52..176f8f75 100644 --- a/src/modinfodialog.h +++ b/src/modinfodialog.h @@ -162,7 +162,6 @@ private slots: void on_activateESP_clicked(); void on_deactivateESP_clicked(); void on_saveTXTButton_clicked(); - void on_filesWidget_doubleClicked(const QModelIndex &index); void on_visitNexusLabel_linkActivated(const QString &link); void on_modIDEdit_editingFinished(); void on_versionEdit_editingFinished(); diff --git a/src/modinfodialog.ui b/src/modinfodialog.ui index 5c58c87a..c9d413f6 100644 --- a/src/modinfodialog.ui +++ b/src/modinfodialog.ui @@ -20,7 +20,7 @@ QTabWidget::Rounded - 0 + 6 @@ -224,7 +224,16 @@ p, li { white-space: pre-wrap; } 0 - + + 0 + + + 0 + + + 0 + + 0 @@ -661,67 +670,6 @@ p, li { white-space: pre-wrap; } - - - - Files - - - - - - - - 0 - 150 - - - - - 16777215 - 150 - - - - List of files currently uploaded on nexus. Double click to download. - - - QAbstractItemView::NoEditTriggers - - - QAbstractItemView::SelectRows - - - true - - - false - - - false - - - - Type - - - - - Name - - - - - Version - - - - - Size (kB) - - - - @@ -845,7 +793,7 @@ p, li { white-space: pre-wrap; } QWebView QWidget -
QtWebKit/QWebView
+
QtWebKitWidgets/QWebView
diff --git a/src/modlist.cpp b/src/modlist.cpp index 9510fd46..f87687bb 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -656,9 +656,8 @@ void ModList::removeRow(int row, const QModelIndex&) void ModList::notifyChange(int rowStart, int rowEnd) { if (rowStart < 0) { - reset(); -// beginResetModel(); -// endResetModel(); + beginResetModel(); + endResetModel(); } else { if (rowEnd == -1) rowEnd = rowStart; emit dataChanged(this->index(rowStart, 0), this->index(rowEnd, this->columnCount() - 1)); diff --git a/src/modlistsortproxy.h b/src/modlistsortproxy.h index dbaa2533..21dc9f4d 100644 --- a/src/modlistsortproxy.h +++ b/src/modlistsortproxy.h @@ -54,8 +54,6 @@ public: bool filterMatches(ModInfo::Ptr info, bool enabled) const; -void callReset() { reset(); } - public slots: void displayColumnSelection(const QPoint &pos); diff --git a/src/modlistview.cpp b/src/modlistview.cpp index 88adcceb..44228d5b 100644 --- a/src/modlistview.cpp +++ b/src/modlistview.cpp @@ -1,5 +1,6 @@ #include "modlistview.h" #include +#include #include diff --git a/src/nexusdialog.h b/src/nexusdialog.h index d7e8ff50..8fb22029 100644 --- a/src/nexusdialog.h +++ b/src/nexusdialog.h @@ -101,8 +101,6 @@ private slots: void loginFailed(const QString &message); void loginFinished(bool necessary); -// void loginError(QNetworkReply::NetworkError errorCode); -// void loginTimeout(); void initTab(NexusView *newView); void openInNewTab(const QUrl &url); @@ -117,7 +115,6 @@ private slots: void tabCloseRequested(int index); -// void openByModID(); void on_browserTabWidget_customContextMenuRequested(const QPoint &pos); void urlChanged(const QUrl &url); diff --git a/src/nexusview.cpp b/src/nexusview.cpp index 269894c2..6d70d830 100644 --- a/src/nexusview.cpp +++ b/src/nexusview.cpp @@ -36,7 +36,6 @@ NexusView::NexusView(QWidget *parent) : QWebView(parent), m_LastSeenModID(0) { installEventFilter(this); -// this->pageAction(QWebPage::OpenLinkInNewWindow) connect(this, SIGNAL(urlChanged(QUrl)), this, SLOT(urlChanged(QUrl))); page()->settings()->setMaximumPagesInCache(10); diff --git a/src/nxmaccessmanager.cpp b/src/nxmaccessmanager.cpp index dd05116d..3f30f171 100644 --- a/src/nxmaccessmanager.cpp +++ b/src/nxmaccessmanager.cpp @@ -29,6 +29,9 @@ along with Mod Organizer. If not, see . #include #include +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) +#include +#endif using namespace MOBase; using namespace MOShared; @@ -96,14 +99,24 @@ void NXMAccessManager::login(const QString &username, const QString &password) void NXMAccessManager::pageLogin() { QString requestString = QString("http://gatekeeper.nexusmods.com/Sessions/?Login"); - QUrl postData; - postData.addQueryItem("username", m_Username); - postData.addQueryItem("password", m_Password); QNetworkRequest request(requestString); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); - m_LoginReply = post(request, postData.encodedQuery()); + QByteArray postDataQuery; +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) + QUrlQuery postData; + postData.addQueryItem("username", m_Username); + postData.addQueryItem("password", m_Password); + postDataQuery = postData.query(QUrl::FullyEncoded).toUtf8(); +#else + QUrl postData; + postData.addQueryItem("username", m_Username); + postData.addQueryItem("password", m_Password); + postDataQuery = postData.encodedQuery(); +#endif + + m_LoginReply = post(request, postDataQuery); m_LoginTimeout.start(); connect(m_LoginReply, SIGNAL(finished()), this, SLOT(loginFinished())); diff --git a/src/nxmaccessmanager.h b/src/nxmaccessmanager.h index 8b7e92a8..32829d69 100644 --- a/src/nxmaccessmanager.h +++ b/src/nxmaccessmanager.h @@ -17,79 +17,79 @@ You should have received a copy of the GNU General Public License along with Mod Organizer. If not, see . */ -#ifndef NXMACCESSMANAGER_H -#define NXMACCESSMANAGER_H - - -#include -#include -#include - - -/** - * @brief access manager extended to handle nxm links - **/ -class NXMAccessManager : public QNetworkAccessManager -{ - Q_OBJECT -public: - - explicit NXMAccessManager(QObject *parent); - - bool loggedIn() const; - - void login(const QString &username, const QString &password); - - void showCookies(); - -signals: - - /** - * @brief emitted when a nxm:// link is opened - * - * @param url the nxm-link - **/ - void requestNXMDownload(const QString &url); - - /** - * @brief emitted after a successful login or if login was not necessary - * - * @param necessary true if a login was necessary and succeeded, false if the user is still logged in - **/ - void loginSuccessful(bool necessary); - - void loginFailed(const QString &message); - - private slots: - -// void pageLoginFinished(); - void loginFinished(); - void loginError(QNetworkReply::NetworkError errorCode); - void loginTimeout(); - -public slots: - -protected: - - virtual QNetworkReply *createRequest( - QNetworkAccessManager::Operation operation, const QNetworkRequest &request, - QIODevice *device); - -private: - - void pageLogin(); -// void dlLogin(); - - bool hasLoginCookies() const; - -private: - - QTimer m_LoginTimeout; - QNetworkReply *m_LoginReply; - - QString m_Username; - QString m_Password; - -}; - -#endif // NXMACCESSMANAGER_H +#ifndef NXMACCESSMANAGER_H +#define NXMACCESSMANAGER_H + + +#include +#include +#include + + +/** + * @brief access manager extended to handle nxm links + **/ +class NXMAccessManager : public QNetworkAccessManager +{ + Q_OBJECT +public: + + explicit NXMAccessManager(QObject *parent); + + bool loggedIn() const; + + void login(const QString &username, const QString &password); + + void showCookies(); + +signals: + + /** + * @brief emitted when a nxm:// link is opened + * + * @param url the nxm-link + **/ + void requestNXMDownload(const QString &url); + + /** + * @brief emitted after a successful login or if login was not necessary + * + * @param necessary true if a login was necessary and succeeded, false if the user is still logged in + **/ + void loginSuccessful(bool necessary); + + void loginFailed(const QString &message); + + private slots: + +// void pageLoginFinished(); + void loginFinished(); + void loginError(QNetworkReply::NetworkError errorCode); + void loginTimeout(); + +public slots: + +protected: + + virtual QNetworkReply *createRequest( + QNetworkAccessManager::Operation operation, const QNetworkRequest &request, + QIODevice *device); + +private: + + void pageLogin(); +// void dlLogin(); + + bool hasLoginCookies() const; + +private: + + QTimer m_LoginTimeout; + QNetworkReply *m_LoginReply; + + QString m_Username; + QString m_Password; + +}; + +#endif // NXMACCESSMANAGER_H diff --git a/src/organizer.pro b/src/organizer.pro index ed0c817e..2e51622c 100644 --- a/src/organizer.pro +++ b/src/organizer.pro @@ -291,6 +291,8 @@ OTHER_FILES += \ tutorials/tutorial_window_installer.js \ tutorials/tutorials_installdialog.qml +INCLUDEPATH += "$(ZLIBPATH)" "$(ZLIBPATH)/build" "$(BOOSTPATH)" +LIBS += -L"$(ZLIBPATH)/build" -lzlibstatic #SOURCES += modeltest.cpp #HEADERS += modeltest.h diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 20bdbee0..d29ca585 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -122,7 +122,7 @@ void PluginList::refresh(const QString &profileName, const DirectoryEntry &baseD if (current == NULL) { continue; } - QString filename = QString::fromUtf16(current->getName().c_str()); + QString filename = ToQString(current->getName()); QString extension = filename.right(3).toLower(); if ((extension == "esp") || (extension == "esm")) { diff --git a/src/syncoverwritedialog.cpp b/src/syncoverwritedialog.cpp index be9d06c2..8a496e24 100644 --- a/src/syncoverwritedialog.cpp +++ b/src/syncoverwritedialog.cpp @@ -40,7 +40,7 @@ SyncOverwriteDialog::SyncOverwriteDialog(const QString &path, DirectoryEntry *di refresh(path); QHeaderView *headerView = ui->syncTree->header(); -#if QT_VERSION >= 0x050000 +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) headerView->setSectionResizeMode(0, QHeaderView::Stretch); headerView->setSectionResizeMode(1, QHeaderView::Interactive); #else -- cgit v1.3.1