mirror of
https://github.com/ModOrganizer2/modorganizer.git
synced 2026-07-27 13:58:24 -07:00
Compare commits
68
Commits
release_v1.0.5
...
1.1.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb98bfade6 | ||
|
|
00f4e1799f | ||
|
|
35fcf1c25b | ||
|
|
bed3c08a6d | ||
|
|
f9eba9dc15 | ||
|
|
9c8e43853d | ||
|
|
7aadb47637 | ||
|
|
76fbe6effe | ||
|
|
38ee6ccf0a | ||
|
|
7722a9b6df | ||
|
|
48704877ca | ||
|
|
48c944c737 | ||
|
|
af50eedbe2 | ||
|
|
52e5dd3c57 | ||
|
|
ccd5d1294f | ||
|
|
de984a4ef8 | ||
|
|
e597823337 | ||
|
|
e69210b3a7 | ||
|
|
40d20ab294 | ||
|
|
6ed82866b0 | ||
|
|
a083a2d3b6 | ||
|
|
db09b806b9 | ||
|
|
859c0aed98 | ||
|
|
0ea7d99b9f | ||
|
|
6cffbd4f27 | ||
|
|
4dc3538a7d | ||
|
|
e45b747c82 | ||
|
|
2d6bacbb6a | ||
|
|
d029e97724 | ||
|
|
a9435f637e | ||
|
|
e1e35da6fe | ||
|
|
e43f126b03 | ||
|
|
35c9fe3e98 | ||
|
|
82f7b09b40 | ||
|
|
f33d24870f | ||
|
|
14ac234daf | ||
|
|
22b8eb7c5a | ||
|
|
9ee90a35dc | ||
|
|
ff78c6a014 | ||
|
|
340edcfbca | ||
|
|
c4f0bc39c7 | ||
|
|
e71c37df37 | ||
|
|
b32457a7d2 | ||
|
|
6e1e8c37eb | ||
|
|
469cc2d945 | ||
|
|
0e90b9d233 | ||
|
|
0e19c84722 | ||
|
|
daf4ae44fa | ||
|
|
ac29aa81f2 | ||
|
|
a0335d0a63 | ||
|
|
f1515193ca | ||
|
|
db0347212a | ||
|
|
5895a1a92d | ||
|
|
c6101e34e1 | ||
|
|
75475a7984 | ||
|
|
315ed6e41a | ||
|
|
b2d613e9d1 | ||
|
|
f010c22a3b | ||
|
|
d1594798e6 | ||
|
|
09bd3dbead | ||
|
|
8c0b309bde | ||
|
|
bc7c42dbe8 | ||
|
|
9a03783f49 | ||
|
|
d73b1e38c8 | ||
|
|
b47c89661e | ||
|
|
0b84cc3d45 | ||
|
|
1bf3cc585e | ||
|
|
eae275cc84 |
@@ -13,3 +13,10 @@ source - Copy/*
|
||||
ModOrganizer-build-*
|
||||
pdbs/*
|
||||
source/NCC/BossDummy.x/*
|
||||
*.ts
|
||||
staging_prepare/*
|
||||
staging_trans/*
|
||||
tools/python_zip/*
|
||||
Makefile
|
||||
syntax: regexp
|
||||
Makefile\.(Debug|Release)
|
||||
|
||||
+168
-22
@@ -1,53 +1,125 @@
|
||||
HOW TO BUILD
|
||||
============
|
||||
|
||||
Intro:
|
||||
------
|
||||
|
||||
Building Mod Organizer can be a rather daunting task especially if you're not very comfortable with C++ development under windows.
|
||||
Please note that if you only want to work on and build a plugin you can save yourself a lot of trouble
|
||||
|
||||
Overview:
|
||||
---------
|
||||
|
||||
As of December 2013 MO consists of the following subprojects:
|
||||
- organizer: The main userinterface. heavy usage of various libraries
|
||||
- hookdll: core library of the virtual file system
|
||||
- uibase: interop between plugins and the main application as well as some reusable functionality
|
||||
- shared: functionality shared between organizer and hookdll. I'm attempting to get rid of this library over time
|
||||
- nxmhandler: tool to pass handling of nxm links to MO or other applications
|
||||
- helper: tool for doing operations requiring elevated priviledges if MO doesn't have them
|
||||
- proxydll: dll used in the "proxy dll" load mechanism
|
||||
- esptk: small library containing functionality to work with esps/esms
|
||||
- bsatk: small library containing functionality to work with bsas. Requires zlib to extract files. Requires boost_thread to provide multi-threaded extraction
|
||||
- archive: small wrapper library around 7zip for dealing with mod archives. Requires 7zip
|
||||
- NCC: extension to NMM to provide a binary with command line interface for fomod installation. This is c# code and does not build with the rest of the project. Requires the rest of NMM
|
||||
- bossdummy: dummy dll that looks like the boss.dll. This is used instead of the real boss dlls in NCC to save some disk space
|
||||
- pythonrunner: library for embedding python code. Requires boost_python, python 2.7 and pyqt4
|
||||
|
||||
And various plugins:
|
||||
- checkFNIS: Activates each time an application is started from MO and runs fnis if necessary
|
||||
- diagnoseBasic: Various diagnostic checks on the game
|
||||
- inieditor: minimalistic file editor for ini files
|
||||
- installerBain: handles non-scripted bain installers
|
||||
- installerBCF: no functionality. Supposed to eventually allow installations using bcfs (bain conversion file). python code
|
||||
- installerBundle: handles installation of archives wrapped in archives
|
||||
- installerFomod: handles installation of xml fomods
|
||||
- installerManual: handles installations of archives that aren't supported by any other plugin (or if the user chooses to do the installation manually)
|
||||
- installerNCC: handles installation of any fomod (requires NCC)
|
||||
- installerQuick: handles very simple one-click installations
|
||||
- NMMImport: importer from existing nmm installation
|
||||
- proxyPython: integrates pythonrunner as a plugin into MO
|
||||
- pyniEdit: more user-friendly ini editor. python code
|
||||
|
||||
|
||||
Requirements:
|
||||
-------------
|
||||
|
||||
Visual C++ compiler 2010 (VC 10.0) or up
|
||||
- Included in visual c++ express 2010 or windows sdk 7.0
|
||||
- Included in visual c++ express 2010 or windows sdk 7.x
|
||||
- Do install windows sdk too if only for the cdb debugger which is included in that package
|
||||
Note: If you're having trouble installing the windows sdk, you may be affected by this bug: http://support.microsoft.com/kb/2717426
|
||||
|
||||
QtSDK 4.8.x (http://qt-project.org/downloads)
|
||||
- Qt5 is not yet supported but WIP
|
||||
Qt Libraries 4.8.x (http://qt-project.org/downloads)
|
||||
- i.e. "Qt libraries 4.8.5 for Windows (VS 2010, 235 MB)"
|
||||
- tested: 4.8.5
|
||||
- Qt5 is not yet supported but WIP. You will see a few conditional qt5 pathes
|
||||
- Install according to instruction
|
||||
|
||||
boost libraries (http://www.boost.org/)
|
||||
- Compile according to their instructions (using vc++)
|
||||
- As of time of writing boost_thread is the only compiled boost library used, you can
|
||||
disable the others to safe yourself the compile time
|
||||
- tested: 1.49
|
||||
- Build according to their instructions (using vc++): http://www.boost.org/doc/libs/1_54_0/more/getting_started/windows.html
|
||||
- A few of the boost libraries need to be built (the rest is header-only). The only compiled libs MO needs (at the time of writing) are
|
||||
boost_thread (for everything that links agains bsatk) and boost_python (for pythonrunner). You can disable the others to save yourself compile time (even on a modern system compiling boost can easily take an hour)
|
||||
|
||||
zlib (http://www.zlib.net/)
|
||||
- Compile static library according to their instructions
|
||||
- You should have a "zlibstatic.lib" under "build" afterwards
|
||||
- Depending on the version of zlib and how you built you should have a file called zlibstatic.lib or zlibstat.lib in "build" or "x86\ZLibStatRelease".
|
||||
- Please copy that lib file to "build\zlibstatic.lib" (if it doesn't exist) so MO finds it.
|
||||
|
||||
7z sourcecode (http://www.7-zip.org/download.html)
|
||||
- only for "archive" subproject
|
||||
- no need to compile, will be linked into project
|
||||
|
||||
Python 2.7 (32-bit)
|
||||
- only for pythonrunner
|
||||
|
||||
PyQt4 for Python 2.7
|
||||
- tested: 4.10
|
||||
- only for pythonrunner
|
||||
|
||||
7z.dll (http://www.7-zip.org/download.html)
|
||||
- Part of the 7-zip program
|
||||
- Has to be the 32-bit dll! (approx. 893kb)
|
||||
|
||||
Recommended:
|
||||
------------
|
||||
|
||||
Qt Creator
|
||||
- Included in QtSDK but there might be a newer version as a separate download
|
||||
- http://qt-project.org/downloads#qt-creator
|
||||
- I.e. "Qt Creator 2.8.1 for Windows (53 MB)"
|
||||
- With Qt Creator usually the rule is "the newer the better"
|
||||
- Start Qt Creator and check if things are set up correctly:
|
||||
1) Go to Tools > Options > Build & Run > Qt Versions
|
||||
2.1) If the QtSDK 4.8.x you installed earlier is not auto-detected, click "Add" to add it manually
|
||||
2.2) Navigate to your <your qt4 installation>\bin\qmake.exe
|
||||
2.3) Restart qt creator
|
||||
3) Go to Tools > Options > Build & Run > Kits
|
||||
3.1) If no Kit is auto-detected (or the auto-detected ones have picked up the wrong qt or vc++ installation) click "Add"
|
||||
3.2) Enter a Name (i.e. "Qt 4.8.5 MSVC2010 32bit")
|
||||
3.3) In Compiler select the visual studio compiler installed earlier (may show up as "Microsoft Windows SDK for Windows x). Make sure you select the x86 variant
|
||||
3.4) CDB should be auto-detected
|
||||
3.5) Select the qt version set up earlier
|
||||
4) Apply and close the options
|
||||
|
||||
Set up (using Qt Creator):
|
||||
--------------------------
|
||||
|
||||
1. Using Qt Creator open source/ModOrganizer.pro from your working copy
|
||||
2. Open the "Projects" tab, open the "Details" for "Build Environment"
|
||||
3. Click "Add" to add a variable called "BOOSTPATH" with the path of your boost installation as the value (i.e. C:\code\boost_1_52_0)
|
||||
4. Click "Add" to add a variable called "ZLIBPATH" with the path of your zlib installation as the value (i.e. C:\code\zlib-1.2.7)
|
||||
5. Switch the build configuration at the very top of the same page from "debug" to "release" (or vice versa) and repeat steps 3 and 4
|
||||
6. Compile the configuration(s) you want to use (debug and/or release) (Build All). This should compile correctly.
|
||||
3a. Click "Add" to add a variable called "BOOSTPATH" with the path of your boost installation as the value (i.e. C:\code\boost_1_49_0)
|
||||
3b. Click "Add" to add a variable called "ZLIBPATH" with the path of your zlib installation as the value (i.e. C:\code\zlib-1.2.7)
|
||||
3c. Click "Add" to add a variable called "7ZIPPATH" with the path of your zlib installation as the value (i.e. C:\code\7zip)
|
||||
3d. Click "Add" to add a variable called "PYTHONPATH" with the path of your zlib installation as the value (i.e. C:\code\python)
|
||||
4. Switch the build configuration at the very top of the same page from "debug" to "release" (or vice versa) and repeat step 3
|
||||
5. Compile the configuration(s) you want to use (debug and/or release) (Build All). This should compile correctly.
|
||||
6. <reserved for future use. Maybe grab a coffee?>
|
||||
7. return to the "projects" tab and switch to "Run Settings"
|
||||
8. Determine the folder of the qt binaries in the package you downloaded. This could be "QtSDK\Desktop\Qt\4.8.5\msvc2010\bin" or "Qt4.8.5\bin"
|
||||
For Release build:
|
||||
8r. Add a "Run configuration" that points to <your working copy>\output\ModOrganizer.exe
|
||||
9r. Copy "7z.dll" to <your working copy>\output\dlls
|
||||
10r. From QtSDK\Desktop\Qt\4.8.0\msvc2010\bin copy the following files to <your working copy>\output\dlls: QtCore4.dll, QtDeclarative4.dll, QtGui4.dll, QtNetwork4.dll, QtScript4.dll, QtSql4.dll, QtWebkit4.dll, QtXml4.dll, QtXmlPatterns4.dll
|
||||
9r. Add a "Run configuration" that points to <your working copy>\output\ModOrganizer.exe
|
||||
10r. Copy "7z.dll" to <your working copy>\output\dlls
|
||||
11r. From the qt binaries directory, copy the following files to <your working copy>\output\dlls: QtCore4.dll, QtDeclarative4.dll, QtGui4.dll, QtNetwork4.dll, QtScript4.dll, QtSql4.dll, QtWebkit4.dll, QtXml4.dll, QtXmlPatterns4.dll
|
||||
For Debug build:
|
||||
8d. Add a "Run configuration" that points to <your working copy>\outputd\ModOrganizer.exe
|
||||
9d. Copy "7z.dll" to <your working copy>\outputd\dlls
|
||||
10d. From QtSDK\Desktop\Qt\4.8.0\msvc2010\bin copy the following files to <your working copy>\outputd\dlls: QtCored4.dll, QtDeclaratived4.dll, QtGuid4.dll, QtNetworkd4.dll, QtScriptd4.dll, QtSqld4.dll, QtWebkitd4.dll, QtXmld4.dll, QtXmlPatternsd4.dll
|
||||
9d. Add a "Run configuration" that points to <your working copy>\outputd\ModOrganizer.exe
|
||||
10d. Copy "7z.dll" to <your working copy>\outputd\dlls
|
||||
11d. From the qt binaries copy the following files to <your working copy>\outputd\dlls: QtCored4.dll, QtDeclaratived4.dll, QtGuid4.dll, QtNetworkd4.dll, QtScriptd4.dll, QtSqld4.dll, QtWebkitd4.dll, QtXmld4.dll, QtXmlPatternsd4.dll
|
||||
|
||||
Now you should be able to compile and run Mod Organizer.
|
||||
Please note that when you change anything apart from the "organizer" subproject, qt creator may not pick up on the changes
|
||||
@@ -65,4 +137,78 @@ Set up (without Qt Creator):
|
||||
|
||||
I'm not using this workflow so I can't give more detailed instructions.
|
||||
Please note that the primary project format of MO remains qmake, if you work with visual studio and make changes to the project (like adding
|
||||
source files) you have to manually transfer those changes to the .pro file.
|
||||
source files) you have to manually transfer those changes to the .pro file.
|
||||
|
||||
|
||||
|
||||
-----------------
|
||||
Troubleshooting (thanks to Ross):
|
||||
-----------------
|
||||
|
||||
1) When I try to build, I am seeing the error "error: LNK1104: cannot open file 'zlibstatic.lib'"
|
||||
|
||||
a) Make sure you have the following files
|
||||
{ZLIBPATH}\build\zconf.h
|
||||
{ZLIBPATH}\build\zlib.h
|
||||
{ZLIBPATH}\build\zlibstatic.lib
|
||||
|
||||
b) make sure "zlibstat.lib" was renamed to "zlibstatic.lib"
|
||||
c) currently, there are references to zlibstatic in the following 2 project files:
|
||||
./bsatk/bsatk.pro
|
||||
./hookdll/hookdll.pro
|
||||
|
||||
2) After building, I try to open {MOPROJECTPATH}\outputd\ModOragnizer.exe and get this error
|
||||
"The program can't start because QtDeclaratived4.dll is missing from your computer. Try reinstalling the program to fix this problem."
|
||||
|
||||
-> When setting up Qt4.8.x, make sure you copied the "d" (debug) versions of the dll files to {MOPROJECTPATH}\outputd\dlls
|
||||
If you copied the release version or did not copy the dlls at all, you may see this error.
|
||||
The *.dll files can be found in {QT48xPATH}\bin
|
||||
|
||||
Similiar:
|
||||
http://stackoverflow.com/questions/11196416/cant-start-qt-exe-file-on-windows-7
|
||||
|
||||
3) I am getting one or more of the the following compiler warnings...
|
||||
|
||||
"{MOPROJECTPATH}\source\bsatk\bsaexception.cpp:32: warning: C4996: 'vsnprintf': This function or variable may be unsafe.
|
||||
Consider using vsnprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details."
|
||||
-> Ignore/suppress warning like this and make be ultra-careful using printf-style functions. vsnprintf_s is a visual-c++ only function so using those would make porting (i.e. to mingw) harder
|
||||
|
||||
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\stdio.h:354: see declaration of 'vsnprintf'"
|
||||
-> see previous
|
||||
|
||||
"debug\bsaarchive.obj:-1: warning: LNK4042: object specified more than once; extras ignored"
|
||||
|
||||
-> This appears to be an issue when using VC++ 2010 as the compiler. There are some posts on StackOverflow
|
||||
which suggest fixes when using VC++ as the IDE, but not sure how to apply them to Qt Creator.
|
||||
http://stackoverflow.com/questions/3729515
|
||||
http://stackoverflow.com/questions/3695174
|
||||
|
||||
-> Also, not sure if this affects VC++ 2012 / VC++ 2013 / GCC via cygwin/mingw.
|
||||
Not even sure if the project would successfully compile on these.
|
||||
|
||||
"{MOPROJECTPATH}\source\organizer\mainwindow.cpp:3995: warning: C4428: universal-character-name encountered in source"
|
||||
|
||||
-> very pointless warning.
|
||||
http://stackoverflow.com/questions/11589571
|
||||
http://stackoverflow.com/questions/7078013
|
||||
|
||||
the best solution I saw was to just disable the warning altogether...
|
||||
#pragma warning( disable : 4428 )
|
||||
|
||||
"warning: LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library"
|
||||
|
||||
-> You can always add a #pragma to ignore them :P
|
||||
http://msdn.microsoft.com/en-us/library/2c8f766e%28v=vs.80%29.aspx
|
||||
|
||||
4) I got the following error while building...
|
||||
"error: LNK1201: error writing to program database
|
||||
'{MOPROJECTPATH}\{whatever-your-build-directory-name-is}\organizer\debug\ModOrganizer.pdb';
|
||||
check for insufficient disk space, invalid path, or insufficient privilege"
|
||||
|
||||
-> I had this happen after trying to look at something in memory via Process Explorer.
|
||||
To resolve, I killed and restarted PE. Alternatively, you could probably use the
|
||||
Unlocker utility. After unlocking, I manually deleted everything in the directory.
|
||||
|
||||
Unlocker: http://www.filehippo.com/download_unlocker/ or http://www.emptyloop.com/unlocker/
|
||||
Warning: With Unlocker v1.9.2, you must select "Advanced" then uncheck everything to
|
||||
avoid having some Delta toolbar garbage installed...
|
||||
|
||||
+12
-11
@@ -1,23 +1,24 @@
|
||||
TEMPLATE = subdirs
|
||||
CONFIG += ordered
|
||||
|
||||
|
||||
SUBDIRS = bsatk \
|
||||
shared \
|
||||
uibase \
|
||||
organizer \
|
||||
hookdll \
|
||||
archive \
|
||||
helper \
|
||||
shared \
|
||||
uibase \
|
||||
organizer \
|
||||
hookdll \
|
||||
archive \
|
||||
helper \
|
||||
plugins \
|
||||
proxydll \
|
||||
nxmhandler \
|
||||
BossDummy \
|
||||
pythonRunner \
|
||||
esptk
|
||||
BossDummy \
|
||||
pythonRunner \
|
||||
boss_modified \
|
||||
esptk
|
||||
|
||||
plugins.depends = pythonRunner
|
||||
hookdll.depends = shared
|
||||
organizer.depends = shared, uibase, plugins
|
||||
organizer.depends = shared uibase plugins boss_modified
|
||||
|
||||
CONFIG(debug, debug|release) {
|
||||
DESTDIR = outputd
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
Copyright (C) 2014 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 "aboutdialog.h"
|
||||
#include "ui_aboutdialog.h"
|
||||
#include <utility.h>
|
||||
|
||||
|
||||
AboutDialog::AboutDialog(const QString &version, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::AboutDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
m_LicenseFiles[LICENSE_LGPL3] = "lgpl-3.0.txt";
|
||||
m_LicenseFiles[LICENSE_GPL3] = "gpl-3.0.txt";
|
||||
m_LicenseFiles[LICENSE_BSD3] = "bsd3.txt";
|
||||
m_LicenseFiles[LICENSE_BOOST] = "boost.txt";
|
||||
m_LicenseFiles[LICENSE_CCBY3] = "by-sa3.txt";
|
||||
m_LicenseFiles[LICENSE_ZLIB] = "zlib.txt";
|
||||
|
||||
addLicense("Qt 4.8.5", LICENSE_LGPL3);
|
||||
addLicense("Qt Json", LICENSE_GPL3);
|
||||
addLicense("Boost Library", LICENSE_BOOST);
|
||||
addLicense("Tango Icon Theme", LICENSE_NONE);
|
||||
addLicense("RRZE Icon Set", LICENSE_CCBY3);
|
||||
addLicense("7-zip", LICENSE_LGPL3);
|
||||
addLicense("ZLib", LICENSE_ZLIB);
|
||||
addLicense("NIF File Format Library", LICENSE_BSD3);
|
||||
addLicense("BOSS (modified)", LICENSE_GPL3);
|
||||
addLicense("Alphanum Algorithm", LICENSE_ZLIB);
|
||||
|
||||
ui->nameLabel->setText(QString("<span style=\"font-size:12pt; font-weight:600;\">%1 %2</span>").arg(ui->nameLabel->text()).arg(version));
|
||||
#ifdef HGID
|
||||
ui->revisionLabel->setText(ui->revisionLabel->text() + " " + HGID);
|
||||
#else
|
||||
ui->revisionLabel->setText(ui->revisionLabel->text() + " unknown");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
AboutDialog::~AboutDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void AboutDialog::addLicense(const QString &name, Licenses license)
|
||||
{
|
||||
QListWidgetItem *item = new QListWidgetItem(name);
|
||||
item->setData(Qt::UserRole, license);
|
||||
ui->creditsList->addItem(item);
|
||||
}
|
||||
|
||||
|
||||
void AboutDialog::on_creditsList_currentItemChanged(QListWidgetItem *current, QListWidgetItem*)
|
||||
{
|
||||
auto iter = m_LicenseFiles.find(current->data(Qt::UserRole).toInt());
|
||||
if (iter != m_LicenseFiles.end()) {
|
||||
QString filePath = qApp->applicationDirPath() + "/license/" + iter->second;
|
||||
QString text = MOBase::readFileText(filePath);
|
||||
ui->licenseText->setText(text);
|
||||
} else {
|
||||
ui->licenseText->setText(tr("No license"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
#ifndef ABOUTDIALOG_H
|
||||
/*
|
||||
Copyright (C) 2014 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/>.
|
||||
*/
|
||||
|
||||
|
||||
#define ABOUTDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QListWidgetItem>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
namespace Ui {
|
||||
class AboutDialog;
|
||||
}
|
||||
|
||||
class AboutDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AboutDialog(const QString &version, QWidget *parent = 0);
|
||||
~AboutDialog();
|
||||
|
||||
private:
|
||||
|
||||
enum Licenses {
|
||||
LICENSE_NONE,
|
||||
LICENSE_LGPL3,
|
||||
LICENSE_GPL3,
|
||||
LICENSE_BSD3,
|
||||
LICENSE_BOOST,
|
||||
LICENSE_CCBY3,
|
||||
LICENSE_ZLIB
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
void addLicense(const QString &name, Licenses license);
|
||||
|
||||
private slots:
|
||||
void on_creditsList_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
|
||||
|
||||
private:
|
||||
|
||||
Ui::AboutDialog *ui;
|
||||
|
||||
std::map<int, QString> m_LicenseFiles;
|
||||
|
||||
};
|
||||
|
||||
#endif // ABOUTDIALOG_H
|
||||
@@ -0,0 +1,295 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AboutDialog</class>
|
||||
<widget class="QDialog" name="AboutDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>508</width>
|
||||
<height>335</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>About</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="iconLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="resources.qrc">:/MO/gui/mo_icon.ico</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="about">
|
||||
<attribute name="title">
|
||||
<string>About</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="nameLabel">
|
||||
<property name="text">
|
||||
<string notr="true">Mod Organizer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="revisionLabel">
|
||||
<property name="text">
|
||||
<string>Revision:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string notr="true">Copyright 2011-2014 Sebastian Herbord</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string notr="true"><html><head/><body><p>This program 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.</p><p>See the GNU General Public License for more details.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="software">
|
||||
<attribute name="title">
|
||||
<string>Used Software</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QListWidget" name="creditsList"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="licenseText"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="credits">
|
||||
<attribute name="title">
|
||||
<string>Credits</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Translators</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget_2">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">pndrev (German)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">DaWul (Spanish)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">Fiama (Spanish)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">Alyndiar (French)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">Jlkawaii (French)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">Rigoletto (French)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">Scythe1912 (Chinese)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">yc0620shen (Chinese)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">miraclefreak (Czech)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">tokcdk (Russian)</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Others</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">blacksol</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">DoubleYou</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">deathneko11</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">Bridger</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">GSDFan</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">Uhuru</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">Wolverine2710</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">z929669</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<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="QPushButton" name="closeButton">
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resources.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>closeButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>AboutDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>460</x>
|
||||
<y>313</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>253</x>
|
||||
<y>167</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -103,6 +103,7 @@ CategoryFactory &CategoryFactory::instance()
|
||||
void CategoryFactory::reset()
|
||||
{
|
||||
m_Categories.clear();
|
||||
m_IDMap.clear();
|
||||
addCategory(0, "None", MakeVector<int>(2, 28, 87), 0);
|
||||
}
|
||||
|
||||
|
||||
+12
-5
@@ -34,9 +34,10 @@ DownloadList::DownloadList(DownloadManager *manager, QObject *parent)
|
||||
|
||||
int DownloadList::rowCount(const QModelIndex&) const
|
||||
{
|
||||
return m_Manager->numTotalDownloads();
|
||||
return m_Manager->numTotalDownloads() + m_Manager->numPendingDownloads();
|
||||
}
|
||||
|
||||
|
||||
int DownloadList::columnCount(const QModelIndex&) const
|
||||
{
|
||||
return 3;
|
||||
@@ -75,11 +76,17 @@ QVariant DownloadList::data(const QModelIndex &index, int role) const
|
||||
if (role == Qt::DisplayRole) {
|
||||
return index.row();
|
||||
} else if (role == Qt::ToolTipRole) {
|
||||
if (m_Manager->isInfoIncomplete(index.row())) {
|
||||
return tr("Information missing, please select \"Query Info\" from the context menu to re-retrieve.");
|
||||
if (index.row() < m_Manager->numTotalDownloads()) {
|
||||
QString text = m_Manager->getFileName(index.row()) + "\n";
|
||||
if (m_Manager->isInfoIncomplete(index.row())) {
|
||||
text += tr("Information missing, please select \"Query Info\" from the context menu to re-retrieve.");
|
||||
} else {
|
||||
NexusInfo info = m_Manager->getNexusInfo(index.row());
|
||||
text += QString("%1 (ID %2) %3").arg(info.m_ModName).arg(m_Manager->getModID(index.row())).arg(info.m_Version);
|
||||
}
|
||||
return text;
|
||||
} else {
|
||||
NexusInfo info = m_Manager->getNexusInfo(index.row());
|
||||
return QString("%1 (ID %2) %3").arg(info.m_ModName).arg(m_Manager->getModID(index.row())).arg(info.m_Version);
|
||||
return tr("pending download");
|
||||
}
|
||||
} else {
|
||||
return QVariant();
|
||||
|
||||
@@ -37,13 +37,16 @@ bool DownloadListSortProxy::lessThan(const QModelIndex &left,
|
||||
{
|
||||
int leftIndex = sourceModel()->data(left).toInt();
|
||||
int rightIndex = sourceModel()->data(right).toInt();
|
||||
|
||||
if (left.column() == DownloadList::COL_NAME) {
|
||||
return m_Manager->getFileName(leftIndex).compare(m_Manager->getFileName(rightIndex), Qt::CaseInsensitive) < 0;
|
||||
} else if (left.column() == DownloadList::COL_FILETIME) {
|
||||
return m_Manager->getFileTime(leftIndex) < m_Manager->getFileTime(rightIndex);
|
||||
} else if (left.column() == DownloadList::COL_STATUS) {
|
||||
return m_Manager->getState(leftIndex) < m_Manager->getState(rightIndex);
|
||||
if (leftIndex < m_Manager->numTotalDownloads()) {
|
||||
if (left.column() == DownloadList::COL_NAME) {
|
||||
return m_Manager->getFileName(leftIndex).compare(m_Manager->getFileName(rightIndex), Qt::CaseInsensitive) < 0;
|
||||
} else if (left.column() == DownloadList::COL_FILETIME) {
|
||||
return m_Manager->getFileTime(leftIndex) < m_Manager->getFileTime(rightIndex);
|
||||
} else if (left.column() == DownloadList::COL_STATUS) {
|
||||
return m_Manager->getState(leftIndex) < m_Manager->getState(rightIndex);
|
||||
} else {
|
||||
return leftIndex < rightIndex;
|
||||
}
|
||||
} else {
|
||||
return leftIndex < rightIndex;
|
||||
}
|
||||
@@ -54,6 +57,9 @@ bool DownloadListSortProxy::filterAcceptsRow(int source_row, const QModelIndex&)
|
||||
{
|
||||
if (m_CurrentFilter.length() == 0) {
|
||||
return true;
|
||||
} else if (source_row < m_Manager->numTotalDownloads()) {
|
||||
return m_Manager->getFileName(source_row).contains(m_CurrentFilter, Qt::CaseInsensitive);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return m_Manager->getFileName(source_row).contains(m_CurrentFilter, Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
+103
-80
@@ -82,6 +82,83 @@ void DownloadListWidgetDelegate::drawCache(QPainter *painter, const QStyleOption
|
||||
}
|
||||
|
||||
|
||||
void DownloadListWidgetDelegate::paintPendingDownload(int downloadIndex) const
|
||||
{
|
||||
std::pair<int, int> nexusids = m_Manager->getPendingDownload(downloadIndex);
|
||||
m_NameLabel->setText(tr("< mod %1 file %2 >").arg(nexusids.first).arg(nexusids.second));
|
||||
m_SizeLabel->setText("???");
|
||||
m_InstallLabel->setVisible(true);
|
||||
m_InstallLabel->setText(tr("Pending"));
|
||||
m_Progress->setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
void DownloadListWidgetDelegate::paintRegularDownload(int downloadIndex) const
|
||||
{
|
||||
QString name = m_Manager->getFileName(downloadIndex);
|
||||
if (name.length() > 53) {
|
||||
name.truncate(50);
|
||||
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;
|
||||
m_InstallLabel->setVisible(true);
|
||||
m_Progress->setVisible(false);
|
||||
#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));
|
||||
#endif
|
||||
labelPalette.setColor(QPalette::WindowText, Qt::darkRed);
|
||||
m_InstallLabel->setPalette(labelPalette);
|
||||
} else if (state == DownloadManager::STATE_FETCHINGMODINFO) {
|
||||
m_InstallLabel->setText(tr("Fetching Info 1"));
|
||||
m_Progress->setVisible(false);
|
||||
} else if (state == DownloadManager::STATE_FETCHINGFILEINFO) {
|
||||
m_InstallLabel->setText(tr("Fetching Info 2"));
|
||||
m_Progress->setVisible(false);
|
||||
} else if (state >= DownloadManager::STATE_READY) {
|
||||
QPalette labelPalette;
|
||||
m_InstallLabel->setVisible(true);
|
||||
m_Progress->setVisible(false);
|
||||
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 >= 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));
|
||||
#endif
|
||||
labelPalette.setColor(QPalette::WindowText, Qt::darkGray);
|
||||
} else if (state == DownloadManager::STATE_UNINSTALLED) {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||
m_InstallLabel->setText(QApplication::translate("DownloadListWidget", "Uninstalled - Double Click to re-install", 0));
|
||||
#else
|
||||
m_InstallLabel->setText(QApplication::translate("DownloadListWidget", "Uninstalled - Double Click to re-install", 0, QApplication::UnicodeUTF8));
|
||||
#endif
|
||||
labelPalette.setColor(QPalette::WindowText, Qt::lightGray);
|
||||
} else {
|
||||
#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));
|
||||
#endif
|
||||
labelPalette.setColor(QPalette::WindowText, Qt::darkGreen);
|
||||
}
|
||||
m_InstallLabel->setPalette(labelPalette);
|
||||
if (m_Manager->isInfoIncomplete(downloadIndex)) {
|
||||
m_NameLabel->setText("<img src=\":/MO/gui/warning_16\" /> " + m_NameLabel->text());
|
||||
}
|
||||
} else {
|
||||
m_InstallLabel->setVisible(false);
|
||||
m_Progress->setVisible(true);
|
||||
m_Progress->setValue(m_Manager->getProgress(downloadIndex));
|
||||
}
|
||||
}
|
||||
|
||||
void DownloadListWidgetDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
try {
|
||||
@@ -95,67 +172,10 @@ void DownloadListWidgetDelegate::paint(QPainter *painter, const QStyleOptionView
|
||||
|
||||
int downloadIndex = index.data().toInt();
|
||||
|
||||
QString name = m_Manager->getFileName(downloadIndex);
|
||||
if (name.length() > 53) {
|
||||
name.truncate(50);
|
||||
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;
|
||||
m_InstallLabel->setVisible(true);
|
||||
m_Progress->setVisible(false);
|
||||
#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));
|
||||
#endif
|
||||
labelPalette.setColor(QPalette::WindowText, Qt::darkRed);
|
||||
m_InstallLabel->setPalette(labelPalette);
|
||||
} else if (state == DownloadManager::STATE_FETCHINGMODINFO) {
|
||||
m_InstallLabel->setText(tr("Fetching Info 1"));
|
||||
m_Progress->setVisible(false);
|
||||
} else if (state == DownloadManager::STATE_FETCHINGFILEINFO) {
|
||||
m_InstallLabel->setText(tr("Fetching Info 2"));
|
||||
m_Progress->setVisible(false);
|
||||
} else if (state >= DownloadManager::STATE_READY) {
|
||||
QPalette labelPalette;
|
||||
m_InstallLabel->setVisible(true);
|
||||
m_Progress->setVisible(false);
|
||||
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 >= 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));
|
||||
#endif
|
||||
labelPalette.setColor(QPalette::WindowText, Qt::darkGray);
|
||||
} else if (state == DownloadManager::STATE_UNINSTALLED) {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||
m_InstallLabel->setText(QApplication::translate("DownloadListWidget", "Uninstalled - Double Click to re-install", 0));
|
||||
#else
|
||||
m_InstallLabel->setText(QApplication::translate("DownloadListWidget", "Uninstalled - Double Click to re-install", 0, QApplication::UnicodeUTF8));
|
||||
#endif
|
||||
labelPalette.setColor(QPalette::WindowText, Qt::lightGray);
|
||||
} else {
|
||||
#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));
|
||||
#endif
|
||||
labelPalette.setColor(QPalette::WindowText, Qt::darkGreen);
|
||||
}
|
||||
m_InstallLabel->setPalette(labelPalette);
|
||||
if (m_Manager->isInfoIncomplete(downloadIndex)) {
|
||||
m_NameLabel->setText("<img src=\":/MO/gui/warning_16\" /> " + m_NameLabel->text());
|
||||
}
|
||||
if (downloadIndex >= m_Manager->numTotalDownloads()) {
|
||||
paintPendingDownload(downloadIndex - m_Manager->numTotalDownloads());
|
||||
} else {
|
||||
m_InstallLabel->setVisible(false);
|
||||
m_Progress->setVisible(true);
|
||||
m_Progress->setValue(m_Manager->getProgress(downloadIndex));
|
||||
paintRegularDownload(downloadIndex);
|
||||
}
|
||||
|
||||
#pragma message("caching disabled because changes in the list (including resorting) doesn't work correctly")
|
||||
@@ -280,29 +300,32 @@ bool DownloadListWidgetDelegate::editorEvent(QEvent *event, QAbstractItemModel *
|
||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
|
||||
if (mouseEvent->button() == Qt::RightButton) {
|
||||
QMenu menu(m_View);
|
||||
bool hidden = false;
|
||||
m_ContextRow = qobject_cast<QSortFilterProxyModel*>(model)->mapToSource(index).row();
|
||||
DownloadManager::DownloadState state = m_Manager->getState(m_ContextRow);
|
||||
bool hidden = m_Manager->isHidden(m_ContextRow);
|
||||
if (state >= DownloadManager::STATE_READY) {
|
||||
menu.addAction(tr("Install"), this, SLOT(issueInstall()));
|
||||
if (m_Manager->isInfoIncomplete(m_ContextRow)) {
|
||||
menu.addAction(tr("Query Info"), this, SLOT(issueQueryInfo()));
|
||||
if (m_ContextRow < m_Manager->numTotalDownloads()) {
|
||||
DownloadManager::DownloadState state = m_Manager->getState(m_ContextRow);
|
||||
hidden = m_Manager->isHidden(m_ContextRow);
|
||||
if (state >= DownloadManager::STATE_READY) {
|
||||
menu.addAction(tr("Install"), this, SLOT(issueInstall()));
|
||||
if (m_Manager->isInfoIncomplete(m_ContextRow)) {
|
||||
menu.addAction(tr("Query Info"), this, SLOT(issueQueryInfo()));
|
||||
}
|
||||
menu.addAction(tr("Delete"), this, SLOT(issueDelete()));
|
||||
if (hidden) {
|
||||
menu.addAction(tr("Un-Hide"), this, SLOT(issueRestoreToView()));
|
||||
} else {
|
||||
menu.addAction(tr("Remove from View"), this, SLOT(issueRemoveFromView()));
|
||||
}
|
||||
} else if (state == DownloadManager::STATE_DOWNLOADING){
|
||||
menu.addAction(tr("Cancel"), this, SLOT(issueCancel()));
|
||||
menu.addAction(tr("Pause"), this, SLOT(issuePause()));
|
||||
} else if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR)) {
|
||||
menu.addAction(tr("Remove"), this, SLOT(issueDelete()));
|
||||
menu.addAction(tr("Resume"), this, SLOT(issueResume()));
|
||||
}
|
||||
menu.addAction(tr("Delete"), this, SLOT(issueDelete()));
|
||||
if (hidden) {
|
||||
menu.addAction(tr("Un-Hide"), this, SLOT(issueRestoreToView()));
|
||||
} else {
|
||||
menu.addAction(tr("Remove from View"), this, SLOT(issueRemoveFromView()));
|
||||
}
|
||||
} else if (state == DownloadManager::STATE_DOWNLOADING){
|
||||
menu.addAction(tr("Cancel"), this, SLOT(issueCancel()));
|
||||
menu.addAction(tr("Pause"), this, SLOT(issuePause()));
|
||||
} else if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR)) {
|
||||
menu.addAction(tr("Remove"), this, SLOT(issueDelete()));
|
||||
menu.addAction(tr("Resume"), this, SLOT(issueResume()));
|
||||
}
|
||||
|
||||
menu.addSeparator();
|
||||
menu.addSeparator();
|
||||
}
|
||||
menu.addAction(tr("Delete Installed..."), this, SLOT(issueDeleteCompleted()));
|
||||
menu.addAction(tr("Delete All..."), this, SLOT(issueDeleteAll()));
|
||||
if (!hidden) {
|
||||
|
||||
@@ -60,6 +60,9 @@ public:
|
||||
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
|
||||
void paintPendingDownload(int downloadIndex) const;
|
||||
void paintRegularDownload(int downloadIndex) const;
|
||||
|
||||
signals:
|
||||
|
||||
void installDownload(int index);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>315</width>
|
||||
<height>75</height>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
@@ -78,14 +78,14 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="sizeLabel">
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
<string notr="true">0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>KB</string>
|
||||
<string notr="true">KB</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -82,6 +82,66 @@ void DownloadListWidgetCompactDelegate::drawCache(QPainter *painter, const QStyl
|
||||
}
|
||||
|
||||
|
||||
void DownloadListWidgetCompactDelegate::paintPendingDownload(int downloadIndex) const
|
||||
{
|
||||
std::pair<int, int> nexusids = m_Manager->getPendingDownload(downloadIndex);
|
||||
m_NameLabel->setText(tr("< mod %1 file %2 >").arg(nexusids.first).arg(nexusids.second));
|
||||
if (m_SizeLabel != NULL) {
|
||||
m_SizeLabel->setText("???");
|
||||
}
|
||||
m_DoneLabel->setVisible(true);
|
||||
m_DoneLabel->setText(tr("Pending"));
|
||||
m_Progress->setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
void DownloadListWidgetCompactDelegate::paintRegularDownload(int downloadIndex) const
|
||||
{
|
||||
QString name = m_Manager->getFileName(downloadIndex);
|
||||
if (name.length() > 53) {
|
||||
name.truncate(50);
|
||||
name.append("...");
|
||||
}
|
||||
m_NameLabel->setText(name);
|
||||
|
||||
DownloadManager::DownloadState state = m_Manager->getState(downloadIndex);
|
||||
|
||||
if ((m_SizeLabel != NULL) && (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);
|
||||
m_DoneLabel->setText(tr("Paused"));
|
||||
m_DoneLabel->setForegroundRole(QPalette::Link);
|
||||
} else if (state == DownloadManager::STATE_FETCHINGMODINFO) {
|
||||
m_DoneLabel->setText(tr("Fetching Info 1"));
|
||||
} else if (state == DownloadManager::STATE_FETCHINGFILEINFO) {
|
||||
m_DoneLabel->setText(tr("Fetching Info 2"));
|
||||
} else if (state >= DownloadManager::STATE_READY) {
|
||||
m_DoneLabel->setVisible(true);
|
||||
m_Progress->setVisible(false);
|
||||
if (state == DownloadManager::STATE_INSTALLED) {
|
||||
m_DoneLabel->setText(tr("Installed"));
|
||||
m_DoneLabel->setForegroundRole(QPalette::Mid);
|
||||
} else if (state == DownloadManager::STATE_UNINSTALLED) {
|
||||
m_DoneLabel->setText(tr("Uninstalled"));
|
||||
m_DoneLabel->setForegroundRole(QPalette::Dark);
|
||||
} else {
|
||||
m_DoneLabel->setText(tr("Done"));
|
||||
m_DoneLabel->setForegroundRole(QPalette::WindowText);
|
||||
}
|
||||
if (m_Manager->isInfoIncomplete(downloadIndex)) {
|
||||
m_NameLabel->setText("<img src=\":/MO/gui/warning_16\"/> " + m_NameLabel->text());
|
||||
}
|
||||
} else {
|
||||
m_DoneLabel->setVisible(false);
|
||||
m_Progress->setVisible(true);
|
||||
m_Progress->setValue(m_Manager->getProgress(downloadIndex));
|
||||
}
|
||||
}
|
||||
|
||||
void DownloadListWidgetCompactDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
#pragma message("This is quite costy - room for optimization?")
|
||||
@@ -100,49 +160,10 @@ void DownloadListWidgetCompactDelegate::paint(QPainter *painter, const QStyleOpt
|
||||
}
|
||||
|
||||
int downloadIndex = index.data().toInt();
|
||||
|
||||
QString name = m_Manager->getFileName(downloadIndex);
|
||||
if (name.length() > 53) {
|
||||
name.truncate(50);
|
||||
name.append("...");
|
||||
}
|
||||
m_NameLabel->setText(name);
|
||||
|
||||
DownloadManager::DownloadState state = m_Manager->getState(downloadIndex);
|
||||
|
||||
if ((m_SizeLabel != NULL) && (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);
|
||||
m_DoneLabel->setText(tr("Paused"));
|
||||
m_DoneLabel->setForegroundRole(QPalette::Link);
|
||||
} else if (state == DownloadManager::STATE_FETCHINGMODINFO) {
|
||||
m_DoneLabel->setText(tr("Fetching Info 1"));
|
||||
} else if (state == DownloadManager::STATE_FETCHINGFILEINFO) {
|
||||
m_DoneLabel->setText(tr("Fetching Info 2"));
|
||||
} else if (state >= DownloadManager::STATE_READY) {
|
||||
m_DoneLabel->setVisible(true);
|
||||
m_Progress->setVisible(false);
|
||||
if (state == DownloadManager::STATE_INSTALLED) {
|
||||
m_DoneLabel->setText(tr("Installed"));
|
||||
m_DoneLabel->setForegroundRole(QPalette::Mid);
|
||||
} else if (state == DownloadManager::STATE_UNINSTALLED) {
|
||||
m_DoneLabel->setText(tr("Uninstalled"));
|
||||
m_DoneLabel->setForegroundRole(QPalette::Dark);
|
||||
} else {
|
||||
m_DoneLabel->setText(tr("Done"));
|
||||
m_DoneLabel->setForegroundRole(QPalette::WindowText);
|
||||
}
|
||||
if (m_Manager->isInfoIncomplete(downloadIndex)) {
|
||||
m_NameLabel->setText("<img src=\":/MO/gui/warning_16\"/> " + m_NameLabel->text());
|
||||
}
|
||||
if (downloadIndex >= m_Manager->numTotalDownloads()) {
|
||||
paintPendingDownload(downloadIndex - m_Manager->numTotalDownloads());
|
||||
} else {
|
||||
m_DoneLabel->setVisible(false);
|
||||
m_Progress->setVisible(true);
|
||||
m_Progress->setValue(m_Manager->getProgress(downloadIndex));
|
||||
paintRegularDownload(downloadIndex);
|
||||
}
|
||||
|
||||
#pragma message("caching disabled because changes in the list (including resorting) doesn't work correctly")
|
||||
@@ -268,29 +289,32 @@ bool DownloadListWidgetCompactDelegate::editorEvent(QEvent *event, QAbstractItem
|
||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
|
||||
if (mouseEvent->button() == Qt::RightButton) {
|
||||
QMenu menu;
|
||||
bool hidden = false;
|
||||
m_ContextIndex = qobject_cast<QSortFilterProxyModel*>(model)->mapToSource(index);
|
||||
DownloadManager::DownloadState state = m_Manager->getState(m_ContextIndex.row());
|
||||
bool hidden = m_Manager->isHidden(m_ContextIndex.row());
|
||||
if (state >= DownloadManager::STATE_READY) {
|
||||
menu.addAction(tr("Install"), this, SLOT(issueInstall()));
|
||||
if (m_Manager->isInfoIncomplete(m_ContextIndex.row())) {
|
||||
menu.addAction(tr("Query Info"), this, SLOT(issueQueryInfo()));
|
||||
if (m_ContextIndex.row() < m_Manager->numTotalDownloads()) {
|
||||
DownloadManager::DownloadState state = m_Manager->getState(m_ContextIndex.row());
|
||||
hidden = m_Manager->isHidden(m_ContextIndex.row());
|
||||
if (state >= DownloadManager::STATE_READY) {
|
||||
menu.addAction(tr("Install"), this, SLOT(issueInstall()));
|
||||
if (m_Manager->isInfoIncomplete(m_ContextIndex.row())) {
|
||||
menu.addAction(tr("Query Info"), this, SLOT(issueQueryInfo()));
|
||||
}
|
||||
menu.addAction(tr("Delete"), this, SLOT(issueDelete()));
|
||||
if (hidden) {
|
||||
menu.addAction(tr("Un-Hide"), this, SLOT(issueRestoreToView()));
|
||||
} else {
|
||||
menu.addAction(tr("Remove from View"), this, SLOT(issueRemoveFromView()));
|
||||
}
|
||||
} else if (state == DownloadManager::STATE_DOWNLOADING){
|
||||
menu.addAction(tr("Cancel"), this, SLOT(issueCancel()));
|
||||
menu.addAction(tr("Pause"), this, SLOT(issuePause()));
|
||||
} else if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR)) {
|
||||
menu.addAction(tr("Remove"), this, SLOT(issueDelete()));
|
||||
menu.addAction(tr("Resume"), this, SLOT(issueResume()));
|
||||
}
|
||||
menu.addAction(tr("Delete"), this, SLOT(issueDelete()));
|
||||
if (hidden) {
|
||||
menu.addAction(tr("Un-Hide"), this, SLOT(issueRestoreToView()));
|
||||
} else {
|
||||
menu.addAction(tr("Remove from View"), this, SLOT(issueRemoveFromView()));
|
||||
}
|
||||
} else if (state == DownloadManager::STATE_DOWNLOADING){
|
||||
menu.addAction(tr("Cancel"), this, SLOT(issueCancel()));
|
||||
menu.addAction(tr("Pause"), this, SLOT(issuePause()));
|
||||
} else if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR)) {
|
||||
menu.addAction(tr("Remove"), this, SLOT(issueDelete()));
|
||||
menu.addAction(tr("Resume"), this, SLOT(issueResume()));
|
||||
}
|
||||
|
||||
menu.addSeparator();
|
||||
menu.addSeparator();
|
||||
}
|
||||
menu.addAction(tr("Delete Installed..."), this, SLOT(issueDeleteCompleted()));
|
||||
menu.addAction(tr("Delete All..."), this, SLOT(issueDeleteAll()));
|
||||
if (!hidden) {
|
||||
|
||||
@@ -78,6 +78,8 @@ protected:
|
||||
private:
|
||||
|
||||
void drawCache(QPainter *painter, const QStyleOptionViewItem &option, const QPixmap &cache) const;
|
||||
void paintPendingDownload(int downloadIndex) const;
|
||||
void paintRegularDownload(int downloadIndex) const;
|
||||
|
||||
private slots:
|
||||
|
||||
|
||||
+104
-26
@@ -26,18 +26,18 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "utility.h"
|
||||
#include "json.h"
|
||||
#include "selectiondialog.h"
|
||||
#include <utility.h>
|
||||
#include <QTimer>
|
||||
#include <QFileInfo>
|
||||
#include <QRegExp>
|
||||
#include <QDirIterator>
|
||||
#include <QInputDialog>
|
||||
#include <boost/bind.hpp>
|
||||
#include <regex>
|
||||
#include <QMessageBox>
|
||||
#include <QCoreApplication>
|
||||
#include <boost/bind.hpp>
|
||||
#include <regex>
|
||||
|
||||
|
||||
using QtJson::Json;
|
||||
using namespace MOBase;
|
||||
|
||||
|
||||
@@ -153,7 +153,8 @@ QString DownloadManager::DownloadInfo::currentURL()
|
||||
|
||||
|
||||
DownloadManager::DownloadManager(NexusInterface *nexusInterface, QObject *parent)
|
||||
: IDownloadManager(parent), m_NexusInterface(nexusInterface), m_DirWatcher(), m_ShowHidden(false)
|
||||
: IDownloadManager(parent), m_NexusInterface(nexusInterface), m_DirWatcher(), m_ShowHidden(false),
|
||||
m_DateExpression("/Date\\((\\d+)\\)/")
|
||||
{
|
||||
connect(&m_DirWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(directoryChanged(QString)));
|
||||
}
|
||||
@@ -217,8 +218,8 @@ void DownloadManager::setOutputDirectory(const QString &outputDirectory)
|
||||
m_DirWatcher.removePaths(directories);
|
||||
}
|
||||
m_OutputDirectory = QDir::fromNativeSeparators(outputDirectory);
|
||||
m_DirWatcher.addPath(m_OutputDirectory);
|
||||
refreshList();
|
||||
m_DirWatcher.addPath(m_OutputDirectory);
|
||||
}
|
||||
|
||||
|
||||
@@ -242,9 +243,11 @@ void DownloadManager::setShowHidden(bool showHidden)
|
||||
|
||||
void DownloadManager::refreshList()
|
||||
{
|
||||
int downloadsBefore = m_ActiveDownloads.size();
|
||||
|
||||
// remove finished downloads
|
||||
for (QVector<DownloadInfo*>::iterator Iter = m_ActiveDownloads.begin(); Iter != m_ActiveDownloads.end();) {
|
||||
if (((*Iter)->m_State == STATE_READY) || ((*Iter)->m_State == STATE_INSTALLED)) {
|
||||
if (((*Iter)->m_State == STATE_READY) || ((*Iter)->m_State == STATE_INSTALLED) || ((*Iter)->m_State == STATE_UNINSTALLED)) {
|
||||
delete *Iter;
|
||||
Iter = m_ActiveDownloads.erase(Iter);
|
||||
} else {
|
||||
@@ -258,9 +261,22 @@ void DownloadManager::refreshList()
|
||||
}
|
||||
|
||||
nameFilters.append(QString("*").append(UNFINISHED));
|
||||
|
||||
QDir dir(QDir::fromNativeSeparators(m_OutputDirectory));
|
||||
|
||||
// find orphaned meta files and delete them (sounds cruel but it's better for everyone)
|
||||
QStringList orphans;
|
||||
QStringList metaFiles = dir.entryList(QStringList() << "*.meta");
|
||||
foreach (const QString &metaFile, metaFiles) {
|
||||
QString baseFile = metaFile.left(metaFile.length() - 5);
|
||||
if (!QFile::exists(dir.absoluteFilePath(baseFile))) {
|
||||
orphans.append(dir.absoluteFilePath(metaFile));
|
||||
}
|
||||
}
|
||||
if (orphans.size() > 0) {
|
||||
qDebug("%d orphaned meta files will be deleted", orphans.size());
|
||||
shellDelete(orphans, true);
|
||||
}
|
||||
|
||||
// add existing downloads to list
|
||||
foreach (QString file, dir.entryList(nameFilters, QDir::Files, QDir::Time)) {
|
||||
bool Exists = false;
|
||||
@@ -272,6 +288,7 @@ void DownloadManager::refreshList()
|
||||
}
|
||||
}
|
||||
if (Exists) {
|
||||
qDebug("%s exists", qPrintable(file));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -282,7 +299,10 @@ void DownloadManager::refreshList()
|
||||
m_ActiveDownloads.push_front(info);
|
||||
}
|
||||
}
|
||||
qDebug("downloads after refresh: %d", m_ActiveDownloads.size());
|
||||
|
||||
if (m_ActiveDownloads.size() != downloadsBefore) {
|
||||
qDebug("downloads after refresh: %d", m_ActiveDownloads.size());
|
||||
}
|
||||
emit update(-1);
|
||||
}
|
||||
|
||||
@@ -322,6 +342,7 @@ bool DownloadManager::addDownload(QNetworkReply *reply, const QStringList &URLs,
|
||||
(QMessageBox::question(NULL, tr("Download again?"), tr("A file with the same name has already been downloaded. "
|
||||
"Do you want to download it again? The new file will receive a different name."),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)) {
|
||||
removePending(modID, fileID);
|
||||
delete newDownload;
|
||||
return false;
|
||||
}
|
||||
@@ -330,11 +351,24 @@ bool DownloadManager::addDownload(QNetworkReply *reply, const QStringList &URLs,
|
||||
|
||||
startDownload(reply, newDownload, false);
|
||||
|
||||
emit update(-1);
|
||||
// emit update(-1);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void DownloadManager::removePending(int modID, int fileID)
|
||||
{
|
||||
emit aboutToUpdate();
|
||||
for (auto iter = m_PendingDownloads.begin(); iter != m_PendingDownloads.end(); ++iter) {
|
||||
if ((iter->first == modID) && (iter->second == fileID)) {
|
||||
m_PendingDownloads.erase(iter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
emit update(-1);
|
||||
}
|
||||
|
||||
|
||||
void DownloadManager::startDownload(QNetworkReply *reply, DownloadInfo *newDownload, bool resume)
|
||||
{
|
||||
newDownload->m_Reply = reply;
|
||||
@@ -364,11 +398,14 @@ void DownloadManager::startDownload(QNetworkReply *reply, DownloadInfo *newDownl
|
||||
if (!resume) {
|
||||
newDownload->m_PreResumeSize = newDownload->m_Output.size();
|
||||
|
||||
removePending(newDownload->m_ModID, newDownload->m_FileID);
|
||||
|
||||
emit aboutToUpdate();
|
||||
|
||||
m_ActiveDownloads.append(newDownload);
|
||||
|
||||
emit update(-1);
|
||||
emit downloadAdded();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -378,14 +415,21 @@ void DownloadManager::addNXMDownload(const QString &url)
|
||||
NXMUrl nxmInfo(url);
|
||||
|
||||
QString managedGame = ToQString(MOShared::GameInfo::instance().getGameShortName());
|
||||
|
||||
qDebug("add nxm download: %s", qPrintable(url));
|
||||
if (nxmInfo.game().compare(managedGame, Qt::CaseInsensitive) != 0) {
|
||||
qDebug("download requested for wrong game (game: %s, url: %s)", qPrintable(managedGame), qPrintable(nxmInfo.game()));
|
||||
QMessageBox::information(NULL, tr("Wrong Game"), tr("The download link is for a mod for \"%1\" but this instance of MO "
|
||||
"has been set up for \"%2\".").arg(nxmInfo.game()).arg(managedGame), QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
|
||||
m_RequestIDs.insert(m_NexusInterface->requestFileInfo(nxmInfo.getModId(), nxmInfo.getFileId(), this, QVariant()));
|
||||
emit aboutToUpdate();
|
||||
|
||||
m_PendingDownloads.append(std::make_pair(nxmInfo.modId(), nxmInfo.fileId()));
|
||||
|
||||
emit update(-1);
|
||||
emit downloadAdded();
|
||||
m_RequestIDs.insert(m_NexusInterface->requestFileInfo(nxmInfo.modId(), nxmInfo.fileId(), this, nxmInfo.fileId()));
|
||||
}
|
||||
|
||||
|
||||
@@ -627,6 +671,19 @@ int DownloadManager::numTotalDownloads() const
|
||||
return m_ActiveDownloads.size();
|
||||
}
|
||||
|
||||
int DownloadManager::numPendingDownloads() const
|
||||
{
|
||||
return m_PendingDownloads.size();
|
||||
}
|
||||
|
||||
std::pair<int, int> DownloadManager::getPendingDownload(int index)
|
||||
{
|
||||
if ((index < 0) || (index >= m_PendingDownloads.size())) {
|
||||
throw MyException(tr("invalid index"));
|
||||
}
|
||||
|
||||
return m_PendingDownloads.at(index);
|
||||
}
|
||||
|
||||
QString DownloadManager::getFilePath(int index) const
|
||||
{
|
||||
@@ -851,7 +908,6 @@ void DownloadManager::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
|
||||
setState(info, STATE_PAUSED);
|
||||
} else {
|
||||
if (bytesTotal > info->m_TotalSize) {
|
||||
qDebug("file size %s: %lld", qPrintable(info->m_FileName), bytesTotal);
|
||||
info->m_TotalSize = bytesTotal;
|
||||
}
|
||||
int oldProgress = info->m_Progress;
|
||||
@@ -883,6 +939,7 @@ void DownloadManager::createMetaFile(DownloadInfo *info)
|
||||
metaFile.setValue("name", info->m_NexusInfo.m_Name);
|
||||
metaFile.setValue("modName", info->m_NexusInfo.m_ModName);
|
||||
metaFile.setValue("version", info->m_NexusInfo.m_Version);
|
||||
metaFile.setValue("fileTime", info->m_NexusInfo.m_FileTime);
|
||||
metaFile.setValue("fileCategory", info->m_NexusInfo.m_FileCategory);
|
||||
metaFile.setValue("newestVersion", info->m_NexusInfo.m_NewestVersion);
|
||||
metaFile.setValue("category", info->m_NexusInfo.m_Category);
|
||||
@@ -914,11 +971,9 @@ void DownloadManager::nxmDescriptionAvailable(int, QVariant userData, QVariant r
|
||||
|
||||
DownloadInfo *info = downloadInfoByID(userData.toInt());
|
||||
if (info == NULL) return;
|
||||
|
||||
info->m_NexusInfo.m_Category = result["category_id"].toInt();
|
||||
info->m_NexusInfo.m_ModName = result["name"].toString().trimmed();
|
||||
info->m_NexusInfo.m_NewestVersion = result["version"].toString();
|
||||
|
||||
if (info->m_FileID != 0) {
|
||||
setState(info, STATE_READY);
|
||||
} else {
|
||||
@@ -927,6 +982,17 @@ void DownloadManager::nxmDescriptionAvailable(int, QVariant userData, QVariant r
|
||||
}
|
||||
|
||||
|
||||
QDateTime DownloadManager::matchDate(const QString &timeString)
|
||||
{
|
||||
if (m_DateExpression.exactMatch(timeString)) {
|
||||
return QDateTime::fromMSecsSinceEpoch(m_DateExpression.cap(1).toLongLong());
|
||||
} else {
|
||||
qWarning("date not matched: %s", qPrintable(timeString));
|
||||
return QDateTime::currentDateTime();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DownloadManager::nxmFilesAvailable(int, QVariant userData, QVariant resultData, int requestID)
|
||||
{
|
||||
std::set<int>::iterator idIter = m_RequestIDs.find(requestID);
|
||||
@@ -960,7 +1026,11 @@ void DownloadManager::nxmFilesAvailable(int, QVariant userData, QVariant resultD
|
||||
(fileNameVariant == info->m_FileName) || (fileNameVariant == alternativeLocalName)) {
|
||||
info->m_NexusInfo.m_Name = fileInfo["name"].toString();
|
||||
info->m_NexusInfo.m_Version = fileInfo["version"].toString();
|
||||
if (info->m_NexusInfo.m_Version.isEmpty()) {
|
||||
info->m_NexusInfo.m_Version = info->m_NexusInfo.m_NewestVersion;
|
||||
}
|
||||
info->m_NexusInfo.m_FileCategory = fileInfo["category_id"].toInt();
|
||||
info->m_NexusInfo.m_FileTime = matchDate(fileInfo["date"].toString());
|
||||
info->m_FileID = fileInfo["id"].toInt();
|
||||
found = true;
|
||||
break;
|
||||
@@ -1011,16 +1081,16 @@ void DownloadManager::nxmFileInfoAvailable(int modID, int fileID, QVariant userD
|
||||
NexusInfo info;
|
||||
|
||||
QVariantMap result = resultData.toMap();
|
||||
|
||||
info.m_Name = result["name"].toString();
|
||||
qDebug("file info received for %s", qPrintable(info.m_Name));
|
||||
info.m_Version = result["version"].toString();
|
||||
info.m_FileName = result["uri"].toString();
|
||||
|
||||
if (userData.isValid()) {
|
||||
m_RequestIDs.insert(m_NexusInterface->requestDownloadURL(modID, fileID, this, qVariantFromValue(info), userData.toString()));
|
||||
} else {
|
||||
m_RequestIDs.insert(m_NexusInterface->requestDownloadURL(modID, fileID, this, qVariantFromValue(info)));
|
||||
if (info.m_Version.isEmpty()) {
|
||||
info.m_Version = info.m_NewestVersion;
|
||||
}
|
||||
info.m_FileName = result["uri"].toString();
|
||||
info.m_FileTime = matchDate(result["date"].toString());
|
||||
|
||||
m_RequestIDs.insert(m_NexusInterface->requestDownloadURL(modID, fileID, this, QVariant::fromValue(info)));
|
||||
}
|
||||
|
||||
|
||||
@@ -1106,6 +1176,7 @@ void DownloadManager::nxmDownloadURLsAvailable(int modID, int fileID, QVariant u
|
||||
NexusInfo info = userData.value<NexusInfo>();
|
||||
QVariantList resultList = resultData.toList();
|
||||
if (resultList.length() == 0) {
|
||||
removePending(modID, fileID);
|
||||
emit showMessage(tr("No download server available. Please try again later."));
|
||||
return;
|
||||
}
|
||||
@@ -1124,7 +1195,7 @@ void DownloadManager::nxmDownloadURLsAvailable(int modID, int fileID, QVariant u
|
||||
}
|
||||
|
||||
|
||||
void DownloadManager::nxmRequestFailed(int modID, QVariant, int requestID, const QString &errorString)
|
||||
void DownloadManager::nxmRequestFailed(int modID, int fileID, QVariant userData, int requestID, const QString &errorString)
|
||||
{
|
||||
std::set<int>::iterator idIter = m_RequestIDs.find(requestID);
|
||||
if (idIter == m_RequestIDs.end()) {
|
||||
@@ -1148,6 +1219,8 @@ void DownloadManager::nxmRequestFailed(int modID, QVariant, int requestID, const
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
removePending(modID, fileID);
|
||||
emit showMessage(tr("Failed to request file info from nexus: %1").arg(errorString));
|
||||
}
|
||||
|
||||
@@ -1165,14 +1238,18 @@ void DownloadManager::downloadFinished()
|
||||
TaskProgressManager::instance().forgetMe(info->m_TaskProgressId);
|
||||
|
||||
bool error = false;
|
||||
|
||||
if ((info->m_State != STATE_CANCELING) &&
|
||||
(info->m_State != STATE_PAUSING)) {
|
||||
bool textData = reply->header(QNetworkRequest::ContentTypeHeader).toString().startsWith("text", Qt::CaseInsensitive);
|
||||
if ((info->m_Output.size() == 0) ||
|
||||
((reply->error() != QNetworkReply::NoError) && (reply->error() != QNetworkReply::OperationCanceledError)) ||
|
||||
reply->header(QNetworkRequest::ContentTypeHeader).toString().startsWith("text", Qt::CaseInsensitive)) {
|
||||
textData) {
|
||||
if (info->m_Tries == 0) {
|
||||
emit showMessage(tr("Download failed: %1 (%2)").arg(reply->errorString()).arg(reply->error()));
|
||||
if (textData && (reply->error() == QNetworkReply::NoError)) {
|
||||
emit showMessage(tr("Download failed. Server reported: %1").arg(readFileText(info->m_Output.fileName())));
|
||||
} else {
|
||||
emit showMessage(tr("Download failed: %1 (%2)").arg(reply->errorString()).arg(reply->error()));
|
||||
}
|
||||
}
|
||||
error = true;
|
||||
setState(info, STATE_PAUSING);
|
||||
@@ -1232,7 +1309,7 @@ void DownloadManager::downloadFinished()
|
||||
|
||||
if ((info->m_Tries > 0) && error) {
|
||||
--info->m_Tries;
|
||||
resumeDownload(index);
|
||||
resumeDownloadInt(index);
|
||||
}
|
||||
} else {
|
||||
qWarning("no download index %d", index);
|
||||
@@ -1264,3 +1341,4 @@ void DownloadManager::directoryChanged(const QString&)
|
||||
{
|
||||
refreshList();
|
||||
}
|
||||
|
||||
|
||||
+31
-1
@@ -46,6 +46,7 @@ struct NexusInfo {
|
||||
QString m_NewestVersion;
|
||||
QString m_FileName;
|
||||
QVariantList m_DownloadMap;
|
||||
QDateTime m_FileTime;
|
||||
bool m_Set;
|
||||
};
|
||||
Q_DECLARE_METATYPE(NexusInfo)
|
||||
@@ -204,6 +205,19 @@ public:
|
||||
**/
|
||||
int numTotalDownloads() const;
|
||||
|
||||
/**
|
||||
* @brief retrieve number of pending downloads (nexus downloads for which we don't know the name and url yet)
|
||||
* @return number of pending downloads
|
||||
*/
|
||||
int numPendingDownloads() const;
|
||||
|
||||
/**
|
||||
* @brief retrieve the info of a pending download
|
||||
* @param index index of the pending download (index in the range [0, numPendingDownloads()[)
|
||||
* @return pair of modid, fileid
|
||||
*/
|
||||
std::pair<int, int> getPendingDownload(int index);
|
||||
|
||||
/**
|
||||
* @brief retrieve the full path to the download specified by index
|
||||
*
|
||||
@@ -356,6 +370,11 @@ signals:
|
||||
*/
|
||||
void downloadSpeed(const QString &serverName, int bytesPerSecond);
|
||||
|
||||
/**
|
||||
* @brief emitted whenever a new download is added to the list
|
||||
*/
|
||||
void downloadAdded();
|
||||
|
||||
public slots:
|
||||
|
||||
/**
|
||||
@@ -393,7 +412,7 @@ public slots:
|
||||
|
||||
void nxmDownloadURLsAvailable(int modID, int fileID, QVariant userData, QVariant resultData, int requestID);
|
||||
|
||||
void nxmRequestFailed(int modID, QVariant userData, int requestID, const QString &errorString);
|
||||
void nxmRequestFailed(int modID, int fileID, QVariant userData, int requestID, const QString &errorString);
|
||||
|
||||
private slots:
|
||||
|
||||
@@ -437,6 +456,10 @@ private:
|
||||
|
||||
DownloadInfo *downloadInfoByID(unsigned int id);
|
||||
|
||||
QDateTime matchDate(const QString &timeString);
|
||||
|
||||
void removePending(int modID, int fileID);
|
||||
|
||||
private:
|
||||
|
||||
static const int AUTOMATIC_RETRIES = 3;
|
||||
@@ -444,6 +467,9 @@ private:
|
||||
private:
|
||||
|
||||
NexusInterface *m_NexusInterface;
|
||||
|
||||
QVector<std::pair<int, int> > m_PendingDownloads;
|
||||
|
||||
QVector<DownloadInfo*> m_ActiveDownloads;
|
||||
|
||||
QString m_OutputDirectory;
|
||||
@@ -458,6 +484,10 @@ private:
|
||||
|
||||
bool m_ShowHidden;
|
||||
|
||||
QRegExp m_DateExpression;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // DOWNLOADMANAGER_H
|
||||
|
||||
@@ -30,7 +30,7 @@ using namespace MOShared;
|
||||
|
||||
EditExecutablesDialog::EditExecutablesDialog(const ExecutablesList &executablesList, QWidget *parent)
|
||||
: TutorableDialog("EditExecutables", parent),
|
||||
ui(new Ui::EditExecutablesDialog), m_ExecutablesList(executablesList)
|
||||
ui(new Ui::EditExecutablesDialog), m_CurrentItem(NULL), m_ExecutablesList(executablesList)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@@ -68,21 +68,15 @@ void EditExecutablesDialog::refreshExecutablesWidget()
|
||||
executablesWidget->addItem(newItem);
|
||||
}
|
||||
|
||||
QPushButton *addButton = findChild<QPushButton*>("addButton");
|
||||
QPushButton *removeButton = findChild<QPushButton*>("removeButton");
|
||||
|
||||
addButton->setEnabled(false);
|
||||
removeButton->setEnabled(false);
|
||||
ui->addButton->setEnabled(false);
|
||||
ui->removeButton->setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
void EditExecutablesDialog::on_binaryEdit_textChanged(const QString &arg1)
|
||||
{
|
||||
QPushButton *addButton = findChild<QPushButton*>("addButton");
|
||||
// QPushButton *removeButton = findChild<QPushButton*>("removeButton");
|
||||
|
||||
QFileInfo fileInfo(arg1);
|
||||
addButton->setEnabled(fileInfo.exists() && fileInfo.isFile());
|
||||
ui->addButton->setEnabled(fileInfo.exists() && fileInfo.isFile());
|
||||
}
|
||||
|
||||
void EditExecutablesDialog::resetInput()
|
||||
@@ -91,23 +85,35 @@ void EditExecutablesDialog::resetInput()
|
||||
ui->titleEdit->setText("");
|
||||
ui->workingDirEdit->clear();
|
||||
ui->argumentsEdit->setText("");
|
||||
ui->appIDOverwriteEdit->clear();
|
||||
ui->overwriteAppIDBox->setChecked(false);
|
||||
ui->closeCheckBox->setChecked(false);
|
||||
m_CurrentItem = NULL;
|
||||
}
|
||||
|
||||
|
||||
void EditExecutablesDialog::saveExecutable()
|
||||
{
|
||||
m_ExecutablesList.addExecutable(ui->titleEdit->text(), QDir::fromNativeSeparators(ui->binaryEdit->text()),
|
||||
ui->argumentsEdit->text(), QDir::fromNativeSeparators(ui->workingDirEdit->text()),
|
||||
(ui->closeCheckBox->checkState() == Qt::Checked) ? DEFAULT_CLOSE : DEFAULT_STAY,
|
||||
ui->overwriteAppIDBox->isChecked() ? ui->appIDOverwriteEdit->text() : "",
|
||||
true, false);
|
||||
}
|
||||
|
||||
|
||||
void EditExecutablesDialog::delayedRefresh()
|
||||
{
|
||||
int index = ui->executablesListBox->currentIndex().row();
|
||||
resetInput();
|
||||
refreshExecutablesWidget();
|
||||
ui->executablesListBox->setCurrentRow(index);
|
||||
}
|
||||
|
||||
|
||||
void EditExecutablesDialog::on_addButton_clicked()
|
||||
{
|
||||
QLineEdit *titleEdit = findChild<QLineEdit*>("titleEdit");
|
||||
QLineEdit *binaryEdit = findChild<QLineEdit*>("binaryEdit");
|
||||
QLineEdit *argumentsEdit = findChild<QLineEdit*>("argumentsEdit");
|
||||
QLineEdit *workingDirEdit = findChild<QLineEdit*>("workingDirEdit");
|
||||
QCheckBox *closeCheckBox = findChild<QCheckBox*>("closeCheckBox");
|
||||
|
||||
m_ExecutablesList.addExecutable(titleEdit->text(), QDir::fromNativeSeparators(binaryEdit->text()),
|
||||
argumentsEdit->text(), QDir::fromNativeSeparators(workingDirEdit->text()),
|
||||
(closeCheckBox->checkState() == Qt::Checked) ? DEFAULT_CLOSE : DEFAULT_STAY,
|
||||
ui->overwriteAppIDBox->isChecked() ? ui->appIDOverwriteEdit->text() : "",
|
||||
true, false);
|
||||
saveExecutable();
|
||||
|
||||
resetInput();
|
||||
refreshExecutablesWidget();
|
||||
@@ -196,37 +202,88 @@ void EditExecutablesDialog::on_titleEdit_textChanged(const QString &arg1)
|
||||
}
|
||||
}
|
||||
|
||||
void EditExecutablesDialog::on_executablesListBox_itemClicked(QListWidgetItem *item)
|
||||
|
||||
bool EditExecutablesDialog::executableChanged()
|
||||
{
|
||||
QLineEdit *titleEdit = findChild<QLineEdit*>("titleEdit");
|
||||
QLineEdit *binaryEdit = findChild<QLineEdit*>("binaryEdit");
|
||||
QLineEdit *argumentsEdit = findChild<QLineEdit*>("argumentsEdit");
|
||||
QLineEdit *workingDirEdit = findChild<QLineEdit*>("workingDirEdit");
|
||||
QPushButton *removeButton = findChild<QPushButton*>("removeButton");
|
||||
QCheckBox *closeCheckBox = findChild<QCheckBox*>("closeCheckBox");
|
||||
if (m_CurrentItem != NULL) {
|
||||
const Executable &selectedExecutable = m_CurrentItem->data(Qt::UserRole).value<Executable>();
|
||||
|
||||
const Executable &selectedExecutable = item->data(Qt::UserRole).value<Executable>();
|
||||
|
||||
titleEdit->setText(selectedExecutable.m_Title);
|
||||
binaryEdit->setText(QDir::toNativeSeparators(selectedExecutable.m_BinaryInfo.absoluteFilePath()));
|
||||
argumentsEdit->setText(selectedExecutable.m_Arguments);
|
||||
workingDirEdit->setText(QDir::toNativeSeparators(selectedExecutable.m_WorkingDirectory));
|
||||
closeCheckBox->setChecked(selectedExecutable.m_CloseMO == DEFAULT_CLOSE);
|
||||
if (selectedExecutable.m_CloseMO == NEVER_CLOSE) {
|
||||
closeCheckBox->setEnabled(false);
|
||||
closeCheckBox->setToolTip(tr("MO must be kept running or this application will not work correctly."));
|
||||
return selectedExecutable.m_Arguments != ui->argumentsEdit->text()
|
||||
|| selectedExecutable.m_SteamAppID != ui->appIDOverwriteEdit->text()
|
||||
|| selectedExecutable.m_WorkingDirectory != QDir::fromNativeSeparators(ui->workingDirEdit->text())
|
||||
|| selectedExecutable.m_BinaryInfo.absoluteFilePath() != QDir::fromNativeSeparators(ui->binaryEdit->text())
|
||||
|| (selectedExecutable.m_CloseMO == DEFAULT_CLOSE) != ui->closeCheckBox->isChecked();
|
||||
} else {
|
||||
closeCheckBox->setEnabled(true);
|
||||
closeCheckBox->setToolTip(tr("If checked, MO will be closed once the specified executable is run."));
|
||||
return false;
|
||||
}
|
||||
removeButton->setEnabled(selectedExecutable.m_Custom);
|
||||
}
|
||||
|
||||
|
||||
void EditExecutablesDialog::on_executablesListBox_currentItemChanged(QListWidgetItem *current, QListWidgetItem*)
|
||||
{
|
||||
if (current == NULL) {
|
||||
resetInput();
|
||||
return;
|
||||
}
|
||||
|
||||
if (executableChanged()) {
|
||||
QMessageBox::StandardButton res = QMessageBox::question(this, tr("Save Changes?"),
|
||||
tr("You made changes to the current executable, do you want to save them?"),
|
||||
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
|
||||
if (res == QMessageBox::Cancel) {
|
||||
return;
|
||||
} else if (res == QMessageBox::Yes) {
|
||||
// this invalidates the item passed as a a parameter
|
||||
saveExecutable();
|
||||
|
||||
QTimer::singleShot(50, this, SLOT(delayedRefresh()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_CurrentItem = current;
|
||||
|
||||
const Executable &selectedExecutable = current->data(Qt::UserRole).value<Executable>();
|
||||
|
||||
ui->titleEdit->setText(selectedExecutable.m_Title);
|
||||
ui->binaryEdit->setText(QDir::toNativeSeparators(selectedExecutable.m_BinaryInfo.absoluteFilePath()));
|
||||
ui->argumentsEdit->setText(selectedExecutable.m_Arguments);
|
||||
ui->workingDirEdit->setText(QDir::toNativeSeparators(selectedExecutable.m_WorkingDirectory));
|
||||
ui->closeCheckBox->setChecked(selectedExecutable.m_CloseMO == DEFAULT_CLOSE);
|
||||
if (selectedExecutable.m_CloseMO == NEVER_CLOSE) {
|
||||
ui->closeCheckBox->setEnabled(false);
|
||||
ui->closeCheckBox->setToolTip(tr("MO must be kept running or this application will not work correctly."));
|
||||
} else {
|
||||
ui->closeCheckBox->setEnabled(true);
|
||||
ui->closeCheckBox->setToolTip(tr("If checked, MO will be closed once the specified executable is run."));
|
||||
}
|
||||
ui->removeButton->setEnabled(selectedExecutable.m_Custom);
|
||||
ui->overwriteAppIDBox->setChecked(selectedExecutable.m_SteamAppID != 0);
|
||||
if (selectedExecutable.m_SteamAppID != 0) {
|
||||
ui->appIDOverwriteEdit->setText(selectedExecutable.m_SteamAppID);
|
||||
} else {
|
||||
ui->appIDOverwriteEdit->clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EditExecutablesDialog::on_overwriteAppIDBox_toggled(bool checked)
|
||||
{
|
||||
ui->appIDOverwriteEdit->setEnabled(checked);
|
||||
}
|
||||
|
||||
void EditExecutablesDialog::on_closeButton_clicked()
|
||||
{
|
||||
if (executableChanged()) {
|
||||
QMessageBox::StandardButton res = QMessageBox::question(this, tr("Save Changes?"),
|
||||
tr("You made changes to the current executable, do you want to save them?"),
|
||||
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
|
||||
if (res == QMessageBox::Cancel) {
|
||||
return;
|
||||
} else if (res == QMessageBox::Yes) {
|
||||
saveExecutable();
|
||||
}
|
||||
}
|
||||
this->accept();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "tutorabledialog.h"
|
||||
#include <QListWidgetItem>
|
||||
#include <QTimer>
|
||||
#include "executableslist.h"
|
||||
|
||||
namespace Ui {
|
||||
@@ -54,6 +55,7 @@ public:
|
||||
**/
|
||||
ExecutablesList getExecutablesList() const;
|
||||
|
||||
void saveExecutable();
|
||||
private slots:
|
||||
|
||||
void on_binaryEdit_textChanged(const QString &arg1);
|
||||
@@ -66,21 +68,31 @@ private slots:
|
||||
|
||||
void on_titleEdit_textChanged(const QString &arg1);
|
||||
|
||||
void on_executablesListBox_itemClicked(QListWidgetItem *item);
|
||||
|
||||
void on_overwriteAppIDBox_toggled(bool checked);
|
||||
|
||||
void on_browseDirButton_clicked();
|
||||
|
||||
void on_closeButton_clicked();
|
||||
|
||||
void on_executablesListBox_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
|
||||
|
||||
void delayedRefresh();
|
||||
|
||||
private:
|
||||
|
||||
void resetInput();
|
||||
|
||||
void refreshExecutablesWidget();
|
||||
|
||||
bool executableChanged();
|
||||
|
||||
private:
|
||||
Ui::EditExecutablesDialog *ui;
|
||||
|
||||
QListWidgetItem *m_CurrentItem;
|
||||
|
||||
ExecutablesList m_ExecutablesList;
|
||||
|
||||
};
|
||||
|
||||
#endif // EDITEXECUTABLESDIALOG_H
|
||||
|
||||
@@ -213,50 +213,31 @@ Right now the only case I know of where this needs to be overwritten is for the
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<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="QPushButton" name="closeButton">
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>EditExecutablesDialog</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>EditExecutablesDialog</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>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -106,7 +106,7 @@ const Executable &ExecutablesList::find(const QString &title) const
|
||||
Executable &ExecutablesList::find(const QString &title)
|
||||
{
|
||||
for (std::vector<Executable>::iterator iter = m_Executables.begin(); iter != m_Executables.end(); ++iter) {
|
||||
if (iter->m_Title == title) {
|
||||
if (QString::compare(iter->m_Title, title, Qt::CaseInsensitive) == 0) {
|
||||
return *iter;
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user