mirror of
https://github.com/ModOrganizer2/modorganizer.git
synced 2026-07-27 13:58:24 -07:00
Compare commits
172
Commits
| 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 | ||
|
|
f3cb50057b | ||
|
|
5518309300 | ||
|
|
f22bb9d6a6 | ||
|
|
382226bb46 | ||
|
|
bdf04f516c | ||
|
|
54c7131a5e | ||
|
|
15e256ef44 | ||
|
|
b23a4885e0 | ||
|
|
823dfd410b | ||
|
|
ba09054e6b | ||
|
|
694e3ed279 | ||
|
|
cffd9eb4e2 | ||
|
|
640b14ef25 | ||
|
|
47293827bb | ||
|
|
0a3169b808 | ||
|
|
f4528c7aaa | ||
|
|
4f0a6e8b88 | ||
|
|
c57b172204 | ||
|
|
dfca8be71b | ||
|
|
08037bf876 | ||
|
|
500ab7f706 | ||
|
|
08309b71ba | ||
|
|
dce78b62b8 | ||
|
|
af6e1c3ab4 | ||
|
|
50325c8fc2 | ||
|
|
7a382eab75 | ||
|
|
8e6868bf88 | ||
|
|
a891146446 | ||
|
|
72f14df8a7 | ||
|
|
0fa7155eb8 | ||
|
|
c6c61ce792 | ||
|
|
ef801879ab | ||
|
|
1e6c5f7c25 | ||
|
|
49e1dd23b6 | ||
|
|
9c31cfa915 | ||
|
|
91dd38cb29 | ||
|
|
bf0db9c218 | ||
|
|
8fcf21e771 | ||
|
|
b46b2fe6f2 | ||
|
|
e91eebefbe | ||
|
|
2e605b275b | ||
|
|
5f2a49b3be | ||
|
|
c4955231cf | ||
|
|
87f4e2df26 | ||
|
|
9272013103 | ||
|
|
78c4178f2a | ||
|
|
7d79e3ad1e | ||
|
|
d0f2c4fcf7 | ||
|
|
36ac91e0b7 | ||
|
|
5c968a1242 | ||
|
|
e09cef3909 | ||
|
|
8d34ae3413 | ||
|
|
849a0a0ef4 | ||
|
|
3b3717a021 | ||
|
|
fe37b48dff | ||
|
|
f8c683f700 | ||
|
|
49cbe03491 | ||
|
|
6069decb15 | ||
|
|
30dece9093 | ||
|
|
50d0523622 | ||
|
|
067f272da3 | ||
|
|
97111de140 | ||
|
|
280691ebc3 | ||
|
|
1606c1366f | ||
|
|
8077c1ad73 | ||
|
|
aadd076269 | ||
|
|
d8cb9a4e37 | ||
|
|
3c21d1884a | ||
|
|
16bda49e06 | ||
|
|
daf8bab136 | ||
|
|
2c4ba2c62c | ||
|
|
0ae7d4753c | ||
|
|
f0ba6ce95c | ||
|
|
cdea0c9da5 | ||
|
|
0beb88760b | ||
|
|
45f6cd21a2 | ||
|
|
fc3753dcc5 | ||
|
|
9bc123e8e2 | ||
|
|
d161e1a0d6 | ||
|
|
1c9018e9fd | ||
|
|
4fbfc9aa54 | ||
|
|
528338d7bf | ||
|
|
5b04f38345 | ||
|
|
de27ab391f | ||
|
|
d9a6dbb916 | ||
|
|
f682f82db5 | ||
|
|
a47d971788 | ||
|
|
59d6b7840b | ||
|
|
b4220cf2f4 | ||
|
|
e0eb97922d | ||
|
|
10485e15e4 | ||
|
|
ec0ea9df8d | ||
|
|
24cc386191 | ||
|
|
0a19f04339 | ||
|
|
74c75e60d6 | ||
|
|
8b31996525 | ||
|
|
b3d0fcb208 | ||
|
|
93e073c324 | ||
|
|
b2f3d8e47c | ||
|
|
8b4e11060b | ||
|
|
cb297d20b6 | ||
|
|
efe4243077 | ||
|
|
2c1fad4d98 | ||
|
|
fba05e7fab |
@@ -0,0 +1,22 @@
|
||||
syntax: glob
|
||||
ModOrganizer-build-desktop*
|
||||
outputd/*
|
||||
output/*
|
||||
build-ModOrganizer-*
|
||||
source/NCC/*/bin
|
||||
source/NCC/*/obj
|
||||
source/NCC/bin
|
||||
*.orig
|
||||
source/plugins/proxyPython/build
|
||||
staging/*
|
||||
source - Copy/*
|
||||
ModOrganizer-build-*
|
||||
pdbs/*
|
||||
source/NCC/BossDummy.x/*
|
||||
*.ts
|
||||
staging_prepare/*
|
||||
staging_trans/*
|
||||
tools/python_zip/*
|
||||
Makefile
|
||||
syntax: regexp
|
||||
Makefile\.(Debug|Release)
|
||||
+214
@@ -0,0 +1,214 @@
|
||||
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.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
|
||||
|
||||
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/)
|
||||
- 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
|
||||
- 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
|
||||
|
||||
|
||||
Recommended:
|
||||
------------
|
||||
|
||||
Qt Creator
|
||||
- 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"
|
||||
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:
|
||||
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:
|
||||
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
|
||||
and not recompile the modified subproject. the "organizer" project on the other hand is always re-linked. If anyone knowledgeable enough with qmake
|
||||
can fix that that would be awesome.
|
||||
|
||||
Set up (without Qt Creator):
|
||||
----------------------------
|
||||
|
||||
1. open a command line shell and navigate to <your working copy>\source
|
||||
2. run "qmake -tp vc" to create a visual c++ solution
|
||||
3. Open that solution
|
||||
4. - 98. A miracle happens
|
||||
99. You can now compile MO using VC
|
||||
|
||||
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.
|
||||
|
||||
|
||||
|
||||
-----------------
|
||||
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...
|
||||
+14
-9
@@ -1,19 +1,24 @@
|
||||
TEMPLATE = subdirs
|
||||
CONFIG += ordered
|
||||
|
||||
|
||||
SUBDIRS = bsatk \
|
||||
shared \
|
||||
uibase \
|
||||
organizer \
|
||||
hookdll \
|
||||
archive \
|
||||
helper \
|
||||
shared \
|
||||
uibase \
|
||||
organizer \
|
||||
hookdll \
|
||||
archive \
|
||||
helper \
|
||||
plugins \
|
||||
proxydll
|
||||
proxydll \
|
||||
nxmhandler \
|
||||
BossDummy \
|
||||
pythonRunner \
|
||||
boss_modified \
|
||||
esptk
|
||||
|
||||
plugins.depends = pythonRunner
|
||||
hookdll.depends = shared
|
||||
organizer.depends = shared, uibase
|
||||
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>
|
||||
+78
-83
@@ -17,86 +17,81 @@ 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 "activatemodsdialog.h"
|
||||
#include "ui_activatemodsdialog.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
|
||||
ActivateModsDialog::ActivateModsDialog(const std::map<QString, std::vector<QString> > &missingPlugins, QWidget *parent)
|
||||
: TutorableDialog("ActivateMods", parent), ui(new Ui::ActivateModsDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
QTableWidget *modsTable = findChild<QTableWidget*>("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<QString, std::vector<QString> >::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<QString>::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<QString> ActivateModsDialog::getModsToActivate()
|
||||
{
|
||||
std::set<QString> result;
|
||||
QTableWidget *modsTable = findChild<QTableWidget*>("modsTable");
|
||||
|
||||
for (int row = 0; row < modsTable->rowCount(); ++row) {
|
||||
QComboBox *comboBox = dynamic_cast<QComboBox*>(modsTable->cellWidget(row, 1));
|
||||
if (comboBox != NULL) {
|
||||
result.insert(comboBox->currentText());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
std::set<QString> ActivateModsDialog::getESPsToActivate()
|
||||
{
|
||||
std::set<QString> result;
|
||||
QTableWidget *modsTable = findChild<QTableWidget*>("modsTable");
|
||||
|
||||
for (int row = 0; row < modsTable->rowCount(); ++row) {
|
||||
QComboBox *comboBox = dynamic_cast<QComboBox*>(modsTable->cellWidget(row, 1));
|
||||
if (comboBox != NULL) {
|
||||
QLabel *espName = dynamic_cast<QLabel*>(modsTable->cellWidget(row, 0));
|
||||
|
||||
result.insert(espName->text());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#include "activatemodsdialog.h"
|
||||
#include "ui_activatemodsdialog.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
|
||||
ActivateModsDialog::ActivateModsDialog(const std::map<QString, std::vector<QString> > &missingPlugins, QWidget *parent)
|
||||
: TutorableDialog("ActivateMods", parent), ui(new Ui::ActivateModsDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
QTableWidget *modsTable = findChild<QTableWidget*>("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<QString, std::vector<QString> >::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<QString>::const_iterator modIter = espIter->second.begin();
|
||||
modIter != espIter->second.end(); ++modIter) {
|
||||
combo->addItem(*modIter);
|
||||
}
|
||||
modsTable->setCellWidget(row, 1, combo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ActivateModsDialog::~ActivateModsDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
std::set<QString> ActivateModsDialog::getModsToActivate()
|
||||
{
|
||||
std::set<QString> result;
|
||||
QTableWidget *modsTable = findChild<QTableWidget*>("modsTable");
|
||||
|
||||
for (int row = 0; row < modsTable->rowCount(); ++row) {
|
||||
QComboBox *comboBox = dynamic_cast<QComboBox*>(modsTable->cellWidget(row, 1));
|
||||
if (comboBox != NULL) {
|
||||
result.insert(comboBox->currentText());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
std::set<QString> ActivateModsDialog::getESPsToActivate()
|
||||
{
|
||||
std::set<QString> result;
|
||||
QTableWidget *modsTable = findChild<QTableWidget*>("modsTable");
|
||||
|
||||
for (int row = 0; row < modsTable->rowCount(); ++row) {
|
||||
QComboBox *comboBox = dynamic_cast<QComboBox*>(modsTable->cellWidget(row, 1));
|
||||
if (comboBox != NULL) {
|
||||
QLabel *espName = dynamic_cast<QLabel*>(modsTable->cellWidget(row, 0));
|
||||
|
||||
result.insert(espName->text());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,6 @@ public:
|
||||
std::set<QString> getESPsToActivate();
|
||||
|
||||
private slots:
|
||||
void on_buttonBox_accepted();
|
||||
|
||||
private:
|
||||
Ui::ActivateModsDialog *ui;
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2012 Sebastian Herbord. All rights reserved.
|
||||
|
||||
This file is part of Mod Organizer.
|
||||
|
||||
Mod Organizer is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Mod Organizer is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "archivetree.h"
|
||||
#include <QDragMoveEvent>
|
||||
|
||||
ArchiveTree::ArchiveTree(QWidget *parent) :
|
||||
QTreeWidget(parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool ArchiveTree::testMovePossible(QTreeWidgetItem *source, QTreeWidgetItem *target)
|
||||
{
|
||||
if ((target == NULL) ||
|
||||
(source == NULL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((source == target) ||
|
||||
(source->parent() == target)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ArchiveTree::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
QTreeWidgetItem *source = this->currentItem();
|
||||
if ((source == NULL) || (source->parent() == NULL)) {
|
||||
// can't change top level
|
||||
event->ignore();
|
||||
return;
|
||||
} else {
|
||||
QTreeWidget::dragEnterEvent(event);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ArchiveTree::dragMoveEvent(QDragMoveEvent *event)
|
||||
{
|
||||
if (!testMovePossible(this->currentItem(), itemAt(event->pos()))) {
|
||||
event->ignore();
|
||||
} else {
|
||||
QTreeWidget::dragMoveEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ArchiveTree::dropEvent(QDropEvent *event)
|
||||
{
|
||||
event->ignore();
|
||||
|
||||
QTreeWidgetItem *target = itemAt(event->pos());
|
||||
|
||||
QList<QTreeWidgetItem*> sourceItems = this->selectedItems();
|
||||
for (QList<QTreeWidgetItem*>::iterator iter = sourceItems.begin();
|
||||
iter != sourceItems.end(); ++iter) {
|
||||
QTreeWidgetItem *source = *iter;
|
||||
if ((source->parent() != NULL) &&
|
||||
testMovePossible(source, target)) {
|
||||
source->parent()->removeChild(source);
|
||||
if (target->data(0, Qt::UserRole).toInt() != 0) {
|
||||
// target is a file
|
||||
if (target->parent() == NULL) {
|
||||
// this should really not happen, how should a
|
||||
// file get to the top level?
|
||||
return;
|
||||
}
|
||||
int index = target->parent()->indexOfChild(target);
|
||||
target->parent()->insertChild(index, source);
|
||||
emit changed();
|
||||
} else {
|
||||
// target is a directory
|
||||
target->insertChild(target->childCount(), source);
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2012 Sebastian Herbord. All rights reserved.
|
||||
|
||||
This file is part of Mod Organizer.
|
||||
|
||||
Mod Organizer is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Mod Organizer is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef ARCHIVETREE_H
|
||||
#define ARCHIVETREE_H
|
||||
|
||||
#include <QTreeWidget>
|
||||
|
||||
/**
|
||||
* @brief QT tree widget used to display the content of an archive in the manual installation dialog
|
||||
**/
|
||||
class ArchiveTree : public QTreeWidget
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
explicit ArchiveTree(QWidget *parent = 0);
|
||||
|
||||
signals:
|
||||
|
||||
void changed();
|
||||
|
||||
public slots:
|
||||
|
||||
protected:
|
||||
|
||||
virtual void dragEnterEvent(QDragEnterEvent *event);
|
||||
virtual void dragMoveEvent(QDragMoveEvent *event);
|
||||
virtual void dropEvent(QDropEvent *event);
|
||||
|
||||
private:
|
||||
|
||||
bool testMovePossible(QTreeWidgetItem *source, QTreeWidgetItem *target);
|
||||
|
||||
};
|
||||
|
||||
#endif // ARCHIVETREE_H
|
||||
@@ -1,124 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2012 Sebastian Herbord. All rights reserved.
|
||||
|
||||
This file is part of Mod Organizer.
|
||||
|
||||
Mod Organizer is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Mod Organizer is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "baincomplexinstallerdialog.h"
|
||||
#include "textviewer.h"
|
||||
#include "ui_baincomplexinstallerdialog.h"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
|
||||
using namespace MOBase;
|
||||
|
||||
|
||||
BainComplexInstallerDialog::BainComplexInstallerDialog(DirectoryTree *tree, const QString &modName, bool hasPackageTXT, QWidget *parent)
|
||||
: TutorableDialog("BainInstaller", parent), ui(new Ui::BainComplexInstallerDialog), m_Manual(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->nameEdit->setText(modName);
|
||||
|
||||
for (DirectoryTree::const_node_iterator iter = tree->nodesBegin(); iter != tree->nodesEnd(); ++iter) {
|
||||
const QString &dirName = (*iter)->getData().name;
|
||||
if ((dirName.compare("fomod", Qt::CaseInsensitive) == 0) ||
|
||||
(dirName.startsWith("--"))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
QListWidgetItem *item = new QListWidgetItem(ui->optionsList);
|
||||
item->setText((*iter)->getData().name);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
item->setCheckState(item->text().mid(0, 2) == "00" ? Qt::Checked : Qt::Unchecked);
|
||||
item->setData(Qt::UserRole, qVariantFromValue((void*)(*iter)));
|
||||
ui->optionsList->addItem(item);
|
||||
}
|
||||
|
||||
ui->packageBtn->setEnabled(hasPackageTXT);
|
||||
}
|
||||
|
||||
|
||||
BainComplexInstallerDialog::~BainComplexInstallerDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
QString BainComplexInstallerDialog::getName() const
|
||||
{
|
||||
return ui->nameEdit->text();
|
||||
}
|
||||
|
||||
|
||||
void BainComplexInstallerDialog::moveTreeUp(DirectoryTree *target, DirectoryTree::Node *child)
|
||||
{
|
||||
for (DirectoryTree::const_node_iterator iter = child->nodesBegin();
|
||||
iter != child->nodesEnd();) {
|
||||
target->addNode(*iter, true);
|
||||
iter = child->detach(iter);
|
||||
}
|
||||
|
||||
for (DirectoryTree::const_leaf_reverse_iterator iter = child->leafsRBegin();
|
||||
iter != child->leafsREnd(); ++iter) {
|
||||
target->addLeaf(*iter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DirectoryTree *BainComplexInstallerDialog::updateTree(DirectoryTree *tree)
|
||||
{
|
||||
DirectoryTree *newTree = new DirectoryTree;
|
||||
|
||||
for (DirectoryTree::const_node_reverse_iterator iter = tree->nodesRBegin();
|
||||
iter != tree->nodesREnd();) {
|
||||
QList<QListWidgetItem*> items = ui->optionsList->findItems((*iter)->getData().name, Qt::MatchFixedString);
|
||||
if ((items.count() == 1) && (items.at(0)->checkState() == Qt::Checked)) {
|
||||
moveTreeUp(newTree, *iter);
|
||||
}
|
||||
iter = tree->erase(iter);
|
||||
}
|
||||
|
||||
return newTree;
|
||||
}
|
||||
|
||||
|
||||
void BainComplexInstallerDialog::on_okBtn_clicked()
|
||||
{
|
||||
this->accept();
|
||||
}
|
||||
|
||||
|
||||
void BainComplexInstallerDialog::on_cancelBtn_clicked()
|
||||
{
|
||||
this->reject();
|
||||
}
|
||||
|
||||
|
||||
void BainComplexInstallerDialog::on_manualBtn_clicked()
|
||||
{
|
||||
m_Manual = true;
|
||||
this->reject();
|
||||
}
|
||||
|
||||
void BainComplexInstallerDialog::on_packageBtn_clicked()
|
||||
{
|
||||
TextViewer viewer("package.txt", this);
|
||||
viewer.setDescription("");
|
||||
viewer.addFile(QDir::tempPath().append("/package.txt"), false);
|
||||
viewer.exec();
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2012 Sebastian Herbord. All rights reserved.
|
||||
|
||||
This file is part of Mod Organizer.
|
||||
|
||||
Mod Organizer is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Mod Organizer is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef BAINCOMPLEXINSTALLERDIALOG_H
|
||||
#define BAINCOMPLEXINSTALLERDIALOG_H
|
||||
|
||||
|
||||
#include "mytree.h"
|
||||
#include "installdialog.h"
|
||||
#include "tutorabledialog.h"
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class BainComplexInstallerDialog;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Dialog to choose from options offered by a (complex) bain package
|
||||
**/
|
||||
class BainComplexInstallerDialog : public MOBase::TutorableDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param tree the directory tree of the archive. The caller is resonsible to verify this actually qualifies as a bain installer
|
||||
* @param modName proposed name for the mod. The dialog allows the user to change this
|
||||
* @param hasPackageTXT set to true if a package.txt is available for this archive. The file has to be unpacked to QDir::tempPath before displaying the dialog!
|
||||
* @param parent parent widget
|
||||
**/
|
||||
explicit BainComplexInstallerDialog(MOBase::DirectoryTree *tree, const QString &modName, bool hasPackageTXT, QWidget *parent);
|
||||
~BainComplexInstallerDialog();
|
||||
|
||||
/**
|
||||
* @return bool true if the user requested the manual dialog
|
||||
**/
|
||||
bool manualRequested() const { return m_Manual; }
|
||||
|
||||
/**
|
||||
* @return QString the (user-modified) name to be used for the mod
|
||||
**/
|
||||
QString getName() const;
|
||||
|
||||
/**
|
||||
* @brief retrieve the updated archive tree from the dialog. The caller is responsible to delete the returned tree.
|
||||
*
|
||||
* @note This call is destructive on the input tree!
|
||||
*
|
||||
* @param tree input tree. (TODO isn't this the same as the tree passed in the constructor?)
|
||||
* @return DataTree* a new tree with only the selected options and directories arranged correctly. The caller takes custody of this pointer!
|
||||
**/
|
||||
MOBase::DirectoryTree *updateTree(MOBase::DirectoryTree *tree);
|
||||
|
||||
private slots:
|
||||
|
||||
void on_manualBtn_clicked();
|
||||
|
||||
void on_okBtn_clicked();
|
||||
|
||||
void on_cancelBtn_clicked();
|
||||
|
||||
void on_packageBtn_clicked();
|
||||
|
||||
private:
|
||||
|
||||
void moveTreeUp(MOBase::DirectoryTree *target, MOBase::DirectoryTree::Node *child);
|
||||
|
||||
private:
|
||||
|
||||
Ui::BainComplexInstallerDialog *ui;
|
||||
|
||||
bool m_Manual;
|
||||
|
||||
};
|
||||
|
||||
#endif // BAINCOMPLEXINSTALLERDIALOG_H
|
||||
+192
-190
@@ -17,193 +17,195 @@ 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 "bbcode.h"
|
||||
|
||||
#include <QRegExp>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
namespace BBCode {
|
||||
|
||||
|
||||
class BBCodeMap {
|
||||
|
||||
typedef std::map<QString, std::pair<QRegExp, QString> > TagMap;
|
||||
|
||||
public:
|
||||
|
||||
static BBCodeMap &instance() {
|
||||
static BBCodeMap s_Instance;
|
||||
return s_Instance;
|
||||
}
|
||||
|
||||
QString convertTag(const QString &input, int &length)
|
||||
{
|
||||
// extract the tag name
|
||||
m_TagNameExp.indexIn(input, 1, QRegExp::CaretAtOffset);
|
||||
QString tagName = m_TagNameExp.cap(0).toLower();
|
||||
//qDebug("tag name %s", tagName.toUtf8().constData());
|
||||
TagMap::iterator tagIter = m_TagMap.find(tagName);
|
||||
if (tagIter != m_TagMap.end()) {
|
||||
// recognized tag
|
||||
if (tagName.endsWith('=')) {
|
||||
tagName.chop(1);
|
||||
}
|
||||
QString closeTag = tagName == "*" ? "<br/>"
|
||||
: QString("[/%1]").arg(tagName);
|
||||
|
||||
int closeTagPos = input.indexOf(closeTag, 0, Qt::CaseInsensitive);
|
||||
//qDebug("close tag %s at %d", closeTag.toUtf8().constData(), closeTagPos);
|
||||
|
||||
if (closeTagPos > -1) {
|
||||
length = closeTagPos + closeTag.length();
|
||||
QString temp = input.mid(0, length);
|
||||
if (tagIter->second.first.indexIn(temp) == 0) {
|
||||
return temp.replace(tagIter->second.first, tagIter->second.second);
|
||||
} else {
|
||||
// expression doesn't match. either the input string is invalid
|
||||
// or the expression is
|
||||
qWarning("%s doesn't match the expression for %s",
|
||||
temp.toUtf8().constData(), tagName.toUtf8().constData());
|
||||
length = 0;
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// not a recognized tag or tag invalid
|
||||
length = 0;
|
||||
return QString();
|
||||
}
|
||||
|
||||
private:
|
||||
BBCodeMap()
|
||||
: m_TagNameExp("^[a-zA-Z*]*=?")
|
||||
{
|
||||
m_TagMap["b"] = std::make_pair(QRegExp("\\[b\\](.*)\\[/b\\]"),
|
||||
"<b>\\1</b>");
|
||||
m_TagMap["i"] = std::make_pair(QRegExp("\\[i\\](.*)\\[/i\\]"),
|
||||
"<i>\\1</i>");
|
||||
m_TagMap["u"] = std::make_pair(QRegExp("\\[u\\](.*)\\[/u\\]"),
|
||||
"<u>\\1</u>");
|
||||
m_TagMap["s"] = std::make_pair(QRegExp("\\[s\\](.*)\\[/s\\]"),
|
||||
"<s>\\1</s>");
|
||||
m_TagMap["sub"] = std::make_pair(QRegExp("\\[sub\\](.*)\\[/sub\\]"),
|
||||
"<sub>\\1</sub>");
|
||||
m_TagMap["sup"] = std::make_pair(QRegExp("\\[sup\\](.*)\\[/sup\\]"),
|
||||
"<sup>\\1</sup>");
|
||||
m_TagMap["size="] = std::make_pair(QRegExp("\\[size=([^\\]]*)\\](.*)\\[/size\\]"),
|
||||
"<font size=\"\\1\">\\2</font>");
|
||||
m_TagMap["color="] = std::make_pair(QRegExp("\\[color=([^\\]]*)\\](.*)\\[/color\\]"),
|
||||
"<font style=\"color: #\\1;\">\\2</font>");
|
||||
m_TagMap["font="] = std::make_pair(QRegExp("\\[font=([^\\]]*)\\](.*)\\[/font\\]"),
|
||||
"<font face=\\1>\\2</font>");
|
||||
m_TagMap["center"] = std::make_pair(QRegExp("\\[center\\](.*)\\[/center\\]"),
|
||||
"<div align=\"center\">\\1</div>");
|
||||
m_TagMap["quote"] = std::make_pair(QRegExp("\\[quote\\](.*)\\[/quote\\]"),
|
||||
"<blockquote>\"\\1\"</blockquote>");
|
||||
m_TagMap["quote="] = std::make_pair(QRegExp("\\[quote=([^\\]]*)\\](.*)\\[/quote\\]"),
|
||||
"<blockquote>\"\\2\"<br/><span>--\\1</span></blockquote></p>");
|
||||
m_TagMap["code"] = std::make_pair(QRegExp("\\[code\\](.*)\\[/code\\]"),
|
||||
"<pre>\\1</pre>");
|
||||
m_TagMap["heading"]= std::make_pair(QRegExp("\\[heading\\](.*)\\[/heading\\]"),
|
||||
"<h2><strong>\\1</strong></h2>");
|
||||
|
||||
// lists
|
||||
m_TagMap["list"] = std::make_pair(QRegExp("\\[list\\](.*)\\[/list\\]"),
|
||||
"<ul>\\1</ul>");
|
||||
m_TagMap["list="] = std::make_pair(QRegExp("\\[list.*\\](.*)\\[/list\\]"),
|
||||
"<ol>\\1</ol>");
|
||||
m_TagMap["ul"] = std::make_pair(QRegExp("\\[ul\\](.*)\\[/ul\\]"),
|
||||
"<ul>\\1</ul>");
|
||||
m_TagMap["ol"] = std::make_pair(QRegExp("\\[ol\\](.*)\\[/ol\\]"),
|
||||
"<ol>\\1</ol>");
|
||||
m_TagMap["li"] = std::make_pair(QRegExp("\\[li\\](.*)\\[/li\\]"),
|
||||
"<li>\\1</li>");
|
||||
m_TagMap["*"] = std::make_pair(QRegExp("\\[\\*\\](.*)<br/>"),
|
||||
"<li>\\1</li>");
|
||||
|
||||
// tables
|
||||
m_TagMap["table"] = std::make_pair(QRegExp("\\[table\\](.*)\\[/table\\]"),
|
||||
"<table>\\1</table>");
|
||||
m_TagMap["tr"] = std::make_pair(QRegExp("\\[tr\\](.*)\\[/tr\\]"),
|
||||
"<tr>\\1</tr>");
|
||||
m_TagMap["th"] = std::make_pair(QRegExp("\\[th\\](.*)\\[/th\\]"),
|
||||
"<th>\\1</th>");
|
||||
m_TagMap["td"] = std::make_pair(QRegExp("\\[td\\](.*)\\[/td\\]"),
|
||||
"<td>\\1</td>");
|
||||
|
||||
// web content
|
||||
m_TagMap["url"] = std::make_pair(QRegExp("\\[url\\](.*)\\[/url\\]"),
|
||||
"<a href=\"\\1\">\\1</a>");
|
||||
m_TagMap["url="] = std::make_pair(QRegExp("\\[url=([^\\]]*)\\](.*)\\[/url\\]"),
|
||||
"<a href=\"\\1\">\\2</a>");
|
||||
m_TagMap["img"] = std::make_pair(QRegExp("\\[img\\](.*)\\[/img\\]"),
|
||||
"<img src=\"\\1\"/>");
|
||||
m_TagMap["img="] = std::make_pair(QRegExp("\\[img=([^\\]]*)\\](.*)\\[/img\\]"),
|
||||
"<img src=\"\\2\" align=\"\\1\" />");
|
||||
m_TagMap["email="] = std::make_pair(QRegExp("\\[email=\"?([^\\]]*)\"?\\](.*)\\[/email\\]"),
|
||||
"<a href=\"mailto:\\1\">\\2</a>");
|
||||
m_TagMap["youtube"] = std::make_pair(QRegExp("\\[youtube\\](.*)\\[/youtube\\]"),
|
||||
"<a href=\"http://www.youtube.com/v/\\1\">http://www.youtube.com/v/\\1</a>");
|
||||
|
||||
// make all patterns non-greedy and case-insensitive
|
||||
for (TagMap::iterator iter = m_TagMap.begin(); iter != m_TagMap.end(); ++iter) {
|
||||
iter->second.first.setCaseSensitivity(Qt::CaseInsensitive);
|
||||
iter->second.first.setMinimal(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
QRegExp m_TagNameExp;
|
||||
TagMap m_TagMap;
|
||||
};
|
||||
|
||||
|
||||
QString convertToHTML(const QString &inputParam)
|
||||
{
|
||||
// this code goes over the input string once and replaces all bbtags
|
||||
// it encounters. This function is called recursively for every replaced
|
||||
// string to convert nested tags.
|
||||
//
|
||||
// This could be implemented simpler by applying a set of regular expressions
|
||||
// for each recognized bb-tag one after the other but that would probably be
|
||||
// very inefficient (O(n^2)).
|
||||
|
||||
QString input = inputParam.mid(0).replace("\r\n", "<br/>");
|
||||
input.replace("\\\"", "\"").replace("\\'", "'");
|
||||
|
||||
QString result;
|
||||
int lastBlock = 0;
|
||||
int pos = 0;
|
||||
|
||||
// iterate over the input buffer
|
||||
while ((pos = input.indexOf('[', lastBlock)) != -1) {
|
||||
// append everything between the previous tag-block and the current one
|
||||
result.append(input.midRef(lastBlock, pos - lastBlock));
|
||||
|
||||
// convert the tag and content if necessary
|
||||
int length = -1;
|
||||
QString replacement = BBCodeMap::instance().convertTag(input.mid(pos), length);
|
||||
if (length != 0) {
|
||||
QString temp = convertToHTML(replacement);
|
||||
result.append(temp);
|
||||
// length contains the number of characters in the original tag
|
||||
pos += length;
|
||||
} else {
|
||||
// nothing replaced
|
||||
result.append('[');
|
||||
++pos;
|
||||
}
|
||||
lastBlock = pos;
|
||||
}
|
||||
|
||||
// append the remainder (everything after the last tag)
|
||||
result.append(input.midRef(lastBlock));
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace BBCode
|
||||
|
||||
#include "bbcode.h"
|
||||
|
||||
#include <QRegExp>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
namespace BBCode {
|
||||
|
||||
|
||||
class BBCodeMap {
|
||||
|
||||
typedef std::map<QString, std::pair<QRegExp, QString> > TagMap;
|
||||
|
||||
public:
|
||||
|
||||
static BBCodeMap &instance() {
|
||||
static BBCodeMap s_Instance;
|
||||
return s_Instance;
|
||||
}
|
||||
|
||||
QString convertTag(const QString &input, int &length)
|
||||
{
|
||||
// extract the tag name
|
||||
m_TagNameExp.indexIn(input, 1, QRegExp::CaretAtOffset);
|
||||
QString tagName = m_TagNameExp.cap(0).toLower();
|
||||
//qDebug("tag name %s", tagName.toUtf8().constData());
|
||||
TagMap::iterator tagIter = m_TagMap.find(tagName);
|
||||
if (tagIter != m_TagMap.end()) {
|
||||
// recognized tag
|
||||
if (tagName.endsWith('=')) {
|
||||
tagName.chop(1);
|
||||
}
|
||||
QString closeTag = tagName == "*" ? "<br/>"
|
||||
: QString("[/%1]").arg(tagName);
|
||||
|
||||
int closeTagPos = input.indexOf(closeTag, 0, Qt::CaseInsensitive);
|
||||
//qDebug("close tag %s at %d", closeTag.toUtf8().constData(), closeTagPos);
|
||||
|
||||
if (closeTagPos > -1) {
|
||||
length = closeTagPos + closeTag.length();
|
||||
QString temp = input.mid(0, length);
|
||||
if (tagIter->second.first.indexIn(temp) == 0) {
|
||||
return temp.replace(tagIter->second.first, tagIter->second.second);
|
||||
} else {
|
||||
// expression doesn't match. either the input string is invalid
|
||||
// or the expression is
|
||||
qWarning("%s doesn't match the expression for %s",
|
||||
temp.toUtf8().constData(), tagName.toUtf8().constData());
|
||||
length = 0;
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// not a recognized tag or tag invalid
|
||||
length = 0;
|
||||
return QString();
|
||||
}
|
||||
|
||||
private:
|
||||
BBCodeMap()
|
||||
: m_TagNameExp("^[a-zA-Z*]*=?")
|
||||
{
|
||||
m_TagMap["b"] = std::make_pair(QRegExp("\\[b\\](.*)\\[/b\\]"),
|
||||
"<b>\\1</b>");
|
||||
m_TagMap["i"] = std::make_pair(QRegExp("\\[i\\](.*)\\[/i\\]"),
|
||||
"<i>\\1</i>");
|
||||
m_TagMap["u"] = std::make_pair(QRegExp("\\[u\\](.*)\\[/u\\]"),
|
||||
"<u>\\1</u>");
|
||||
m_TagMap["s"] = std::make_pair(QRegExp("\\[s\\](.*)\\[/s\\]"),
|
||||
"<s>\\1</s>");
|
||||
m_TagMap["sub"] = std::make_pair(QRegExp("\\[sub\\](.*)\\[/sub\\]"),
|
||||
"<sub>\\1</sub>");
|
||||
m_TagMap["sup"] = std::make_pair(QRegExp("\\[sup\\](.*)\\[/sup\\]"),
|
||||
"<sup>\\1</sup>");
|
||||
m_TagMap["size="] = std::make_pair(QRegExp("\\[size=([^\\]]*)\\](.*)\\[/size\\]"),
|
||||
"<font size=\"\\1\">\\2</font>");
|
||||
m_TagMap["color="] = std::make_pair(QRegExp("\\[color=([^\\]]*)\\](.*)\\[/color\\]"),
|
||||
"<font style=\"color: #\\1;\">\\2</font>");
|
||||
m_TagMap["font="] = std::make_pair(QRegExp("\\[font=([^\\]]*)\\](.*)\\[/font\\]"),
|
||||
"<font face=\\1>\\2</font>");
|
||||
m_TagMap["center"] = std::make_pair(QRegExp("\\[center\\](.*)\\[/center\\]"),
|
||||
"<div align=\"center\">\\1</div>");
|
||||
m_TagMap["quote"] = std::make_pair(QRegExp("\\[quote\\](.*)\\[/quote\\]"),
|
||||
"<blockquote>\"\\1\"</blockquote>");
|
||||
m_TagMap["quote="] = std::make_pair(QRegExp("\\[quote=([^\\]]*)\\](.*)\\[/quote\\]"),
|
||||
"<blockquote>\"\\2\"<br/><span>--\\1</span></blockquote></p>");
|
||||
m_TagMap["code"] = std::make_pair(QRegExp("\\[code\\](.*)\\[/code\\]"),
|
||||
"<pre>\\1</pre>");
|
||||
m_TagMap["heading"]= std::make_pair(QRegExp("\\[heading\\](.*)\\[/heading\\]"),
|
||||
"<h2><strong>\\1</strong></h2>");
|
||||
|
||||
// lists
|
||||
m_TagMap["list"] = std::make_pair(QRegExp("\\[list\\](.*)\\[/list\\]"),
|
||||
"<ul>\\1</ul>");
|
||||
m_TagMap["list="] = std::make_pair(QRegExp("\\[list.*\\](.*)\\[/list\\]"),
|
||||
"<ol>\\1</ol>");
|
||||
m_TagMap["ul"] = std::make_pair(QRegExp("\\[ul\\](.*)\\[/ul\\]"),
|
||||
"<ul>\\1</ul>");
|
||||
m_TagMap["ol"] = std::make_pair(QRegExp("\\[ol\\](.*)\\[/ol\\]"),
|
||||
"<ol>\\1</ol>");
|
||||
m_TagMap["li"] = std::make_pair(QRegExp("\\[li\\](.*)\\[/li\\]"),
|
||||
"<li>\\1</li>");
|
||||
m_TagMap["*"] = std::make_pair(QRegExp("\\[\\*\\](.*)<br/>"),
|
||||
"<li>\\1</li>");
|
||||
|
||||
// tables
|
||||
m_TagMap["table"] = std::make_pair(QRegExp("\\[table\\](.*)\\[/table\\]"),
|
||||
"<table>\\1</table>");
|
||||
m_TagMap["tr"] = std::make_pair(QRegExp("\\[tr\\](.*)\\[/tr\\]"),
|
||||
"<tr>\\1</tr>");
|
||||
m_TagMap["th"] = std::make_pair(QRegExp("\\[th\\](.*)\\[/th\\]"),
|
||||
"<th>\\1</th>");
|
||||
m_TagMap["td"] = std::make_pair(QRegExp("\\[td\\](.*)\\[/td\\]"),
|
||||
"<td>\\1</td>");
|
||||
|
||||
// web content
|
||||
m_TagMap["url"] = std::make_pair(QRegExp("\\[url\\](.*)\\[/url\\]"),
|
||||
"<a href=\"\\1\">\\1</a>");
|
||||
m_TagMap["url="] = std::make_pair(QRegExp("\\[url=([^\\]]*)\\](.*)\\[/url\\]"),
|
||||
"<a href=\"\\1\">\\2</a>");
|
||||
/* m_TagMap["img"] = std::make_pair(QRegExp("\\[img\\](.*)\\[/img\\]"),
|
||||
"<img src=\"\\1\"/>");
|
||||
m_TagMap["img="] = std::make_pair(QRegExp("\\[img=([^\\]]*)\\](.*)\\[/img\\]"),
|
||||
"<img src=\"\\2\" align=\"\\1\" />");*/
|
||||
m_TagMap["img"] = std::make_pair(QRegExp("\\[img\\](.*)\\[/img\\]"), "");
|
||||
m_TagMap["img="] = std::make_pair(QRegExp("\\[img=([^\\]]*)\\](.*)\\[/img\\]"), "");
|
||||
m_TagMap["email="] = std::make_pair(QRegExp("\\[email=\"?([^\\]]*)\"?\\](.*)\\[/email\\]"),
|
||||
"<a href=\"mailto:\\1\">\\2</a>");
|
||||
m_TagMap["youtube"] = std::make_pair(QRegExp("\\[youtube\\](.*)\\[/youtube\\]"),
|
||||
"<a href=\"http://www.youtube.com/v/\\1\">http://www.youtube.com/v/\\1</a>");
|
||||
|
||||
// make all patterns non-greedy and case-insensitive
|
||||
for (TagMap::iterator iter = m_TagMap.begin(); iter != m_TagMap.end(); ++iter) {
|
||||
iter->second.first.setCaseSensitivity(Qt::CaseInsensitive);
|
||||
iter->second.first.setMinimal(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
QRegExp m_TagNameExp;
|
||||
TagMap m_TagMap;
|
||||
};
|
||||
|
||||
|
||||
QString convertToHTML(const QString &inputParam)
|
||||
{
|
||||
// this code goes over the input string once and replaces all bbtags
|
||||
// it encounters. This function is called recursively for every replaced
|
||||
// string to convert nested tags.
|
||||
//
|
||||
// This could be implemented simpler by applying a set of regular expressions
|
||||
// for each recognized bb-tag one after the other but that would probably be
|
||||
// very inefficient (O(n^2)).
|
||||
|
||||
QString input = inputParam.mid(0).replace("\r\n", "<br/>");
|
||||
input.replace("\\\"", "\"").replace("\\'", "'");
|
||||
|
||||
QString result;
|
||||
int lastBlock = 0;
|
||||
int pos = 0;
|
||||
|
||||
// iterate over the input buffer
|
||||
while ((pos = input.indexOf('[', lastBlock)) != -1) {
|
||||
// append everything between the previous tag-block and the current one
|
||||
result.append(input.midRef(lastBlock, pos - lastBlock));
|
||||
|
||||
// convert the tag and content if necessary
|
||||
int length = -1;
|
||||
QString replacement = BBCodeMap::instance().convertTag(input.mid(pos), length);
|
||||
if (length != 0) {
|
||||
QString temp = convertToHTML(replacement);
|
||||
result.append(temp);
|
||||
// length contains the number of characters in the original tag
|
||||
pos += length;
|
||||
} else {
|
||||
// nothing replaced
|
||||
result.append('[');
|
||||
++pos;
|
||||
}
|
||||
lastBlock = pos;
|
||||
}
|
||||
|
||||
// append the remainder (everything after the last tag)
|
||||
result.append(input.midRef(lastBlock));
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace BBCode
|
||||
|
||||
|
||||
+21
-21
@@ -17,24 +17,24 @@ You should have received a copy of the GNU General Public License
|
||||
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef BBCODE_H
|
||||
#define BBCODE_H
|
||||
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
namespace BBCode {
|
||||
|
||||
/**
|
||||
* @brief convert a string with BB Code-Tags to HTML
|
||||
* @param input the input string with BB tags
|
||||
* @param replaceOccured if not NULL, this parameter will be set to true if any bb tags were replaced
|
||||
* @return the same string in html representation
|
||||
**/
|
||||
QString convertToHTML(const QString &input);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // BBCODE_H
|
||||
#ifndef BBCODE_H
|
||||
#define BBCODE_H
|
||||
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
namespace BBCode {
|
||||
|
||||
/**
|
||||
* @brief convert a string with BB Code-Tags to HTML
|
||||
* @param input the input string with BB tags
|
||||
* @param replaceOccured if not NULL, this parameter will be set to true if any bb tags were replaced
|
||||
* @return the same string in html representation
|
||||
**/
|
||||
QString convertToHTML(const QString &input);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // BBCODE_H
|
||||
|
||||
+29
-2
@@ -25,6 +25,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
#include <QList>
|
||||
#include <QCoreApplication>
|
||||
|
||||
|
||||
using namespace MOBase;
|
||||
@@ -34,11 +35,18 @@ using namespace MOShared;
|
||||
CategoryFactory* CategoryFactory::s_Instance = NULL;
|
||||
|
||||
|
||||
QString CategoryFactory::categoriesFilePath()
|
||||
{
|
||||
return QCoreApplication::applicationDirPath() + "/categories.dat";
|
||||
}
|
||||
|
||||
|
||||
CategoryFactory::CategoryFactory()
|
||||
{
|
||||
atexit(&cleanup);
|
||||
reset();
|
||||
|
||||
QFile categoryFile(QDir::fromNativeSeparators(ToQString(GameInfo::instance().getOrganizerDirectory())).append("/categories.dat"));
|
||||
QFile categoryFile(categoriesFilePath());
|
||||
|
||||
if (!categoryFile.open(QIODevice::ReadOnly)) {
|
||||
loadDefaultCategories();
|
||||
@@ -95,6 +103,7 @@ CategoryFactory &CategoryFactory::instance()
|
||||
void CategoryFactory::reset()
|
||||
{
|
||||
m_Categories.clear();
|
||||
m_IDMap.clear();
|
||||
addCategory(0, "None", MakeVector<int>(2, 28, 87), 0);
|
||||
}
|
||||
|
||||
@@ -117,10 +126,16 @@ void CategoryFactory::setParents()
|
||||
}
|
||||
}
|
||||
|
||||
void CategoryFactory::cleanup()
|
||||
{
|
||||
delete s_Instance;
|
||||
s_Instance = NULL;
|
||||
}
|
||||
|
||||
|
||||
void CategoryFactory::saveCategories()
|
||||
{
|
||||
QFile categoryFile(QDir::fromNativeSeparators(ToQString(GameInfo::instance().getOrganizerDirectory())).append("/categories.dat"));
|
||||
QFile categoryFile(categoriesFilePath());
|
||||
|
||||
if (!categoryFile.open(QIODevice::WriteOnly)) {
|
||||
reportError(QObject::tr("Failed to save custom categories"));
|
||||
@@ -144,6 +159,18 @@ void CategoryFactory::saveCategories()
|
||||
}
|
||||
|
||||
|
||||
unsigned int CategoryFactory::countCategories(std::tr1::function<bool (const Category &category)> filter)
|
||||
{
|
||||
unsigned int result = 0;
|
||||
for (auto iter = m_Categories.begin(); iter != m_Categories.end(); ++iter) {
|
||||
if (filter(*iter)) {
|
||||
++result;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void CategoryFactory::addCategory(int id, const QString &name, const std::vector<int> &nexusIDs, int parentID)
|
||||
{
|
||||
int index = m_Categories.size();
|
||||
|
||||
+179
-161
@@ -17,164 +17,182 @@ You should have received a copy of the GNU General Public License
|
||||
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CATEGORIES_H
|
||||
#define CATEGORIES_H
|
||||
|
||||
|
||||
#include <QString>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
|
||||
/**
|
||||
* @brief Manage the available mod categories
|
||||
* @warning member functions of this class currently use a wild mix of ids and indexes to look up categories,
|
||||
* optimized to where the request comes from. Therefore be very careful which of the two you have available
|
||||
**/
|
||||
class CategoryFactory {
|
||||
|
||||
friend class CategoriesDialog;
|
||||
|
||||
public:
|
||||
|
||||
static const int CATEGORY_NONE = 0;
|
||||
|
||||
static const int CATEGORY_SPECIAL_FIRST = 10000;
|
||||
static const int CATEGORY_SPECIAL_CHECKED = CATEGORY_SPECIAL_FIRST;
|
||||
static const int CATEGORY_SPECIAL_UNCHECKED = 10001;
|
||||
static const int CATEGORY_SPECIAL_UPDATEAVAILABLE = 10002;
|
||||
static const int CATEGORY_SPECIAL_NOCATEGORY = 10003;
|
||||
static const int CATEGORY_SPECIAL_CONFLICT = 10004;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief reset the list of categories
|
||||
**/
|
||||
void reset();
|
||||
|
||||
/**
|
||||
* @brief save the categories to the categories.dat file
|
||||
**/
|
||||
void saveCategories();
|
||||
|
||||
/**
|
||||
* @brief retrieve the number of available categories
|
||||
*
|
||||
* @return unsigned int number of categories
|
||||
**/
|
||||
unsigned numCategories() const { return m_Categories.size(); }
|
||||
|
||||
/**
|
||||
* @brief get the id of the parent category
|
||||
*
|
||||
* @param index the index to look up
|
||||
* @return int id of the parent category
|
||||
**/
|
||||
int getParentID(unsigned int index) const;
|
||||
|
||||
/**
|
||||
* @brief determine if a category exists (by id)
|
||||
*
|
||||
* @param id the id to check for existance
|
||||
* @return true if the category exists, false otherwise
|
||||
**/
|
||||
bool categoryExists(int id) const;
|
||||
|
||||
/**
|
||||
* @brief test if a category is child of a second one
|
||||
* @param id the presumed child id
|
||||
* @param parentID the parent id to test for
|
||||
* @return true if id is a child of parentID
|
||||
**/
|
||||
bool isDecendantOf(int id, int parentID) const;
|
||||
|
||||
/**
|
||||
* @brief test if the specified category has child categories
|
||||
*
|
||||
* @param index index of the category to look up
|
||||
* @return bool true if the category has child categories
|
||||
**/
|
||||
bool hasChildren(unsigned int index) const;
|
||||
|
||||
/**
|
||||
* @brief retrieve the name of a category
|
||||
*
|
||||
* @param index index of the category to look up
|
||||
* @return QString name of the category
|
||||
**/
|
||||
QString getCategoryName(unsigned int index) const;
|
||||
|
||||
/**
|
||||
* @brief look up the id of a category by its index
|
||||
*
|
||||
* @param index index of the category to look up
|
||||
* @return int id of the category
|
||||
**/
|
||||
int getCategoryID(unsigned int index) const;
|
||||
|
||||
/**
|
||||
* @brief look up the index of a category by its id
|
||||
*
|
||||
* @param id index of the category to look up
|
||||
* @return unsigned int index of the category
|
||||
**/
|
||||
int getCategoryIndex(int ID) const;
|
||||
|
||||
/**
|
||||
* @brief retrieve the index of a category by its nexus id
|
||||
*
|
||||
* @param nexusID nexus id of the category to look up
|
||||
* @return unsigned int index of the category or 0 if no category matches
|
||||
**/
|
||||
unsigned int resolveNexusID(int nexusID) const;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief retrieve a reference to the singleton instance
|
||||
*
|
||||
* @return the reference to the singleton
|
||||
**/
|
||||
static CategoryFactory &instance();
|
||||
|
||||
private:
|
||||
|
||||
struct Category {
|
||||
Category(int sortValue, int id, const QString &name, const std::vector<int> &nexusIDs, int parentID)
|
||||
: m_SortValue(sortValue), m_ID(id), m_Name(name), m_HasChildren(false),
|
||||
m_NexusIDs(nexusIDs), m_ParentID(parentID) {}
|
||||
int m_SortValue;
|
||||
int m_ID;
|
||||
int m_ParentID;
|
||||
bool m_HasChildren;
|
||||
QString m_Name;
|
||||
std::vector<int> m_NexusIDs;
|
||||
|
||||
friend bool operator<(const Category &LHS, const Category &RHS) {
|
||||
return LHS.m_SortValue < RHS.m_SortValue;
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
CategoryFactory();
|
||||
|
||||
void loadDefaultCategories();
|
||||
|
||||
void addCategory(int id, const QString &name, const std::vector<int> &nexusID, int parentID);
|
||||
|
||||
void setParents();
|
||||
|
||||
private:
|
||||
|
||||
static CategoryFactory *s_Instance;
|
||||
|
||||
std::vector<Category> m_Categories;
|
||||
std::map<int, unsigned int> m_IDMap;
|
||||
std::map<int, unsigned int> m_NexusMap;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // CATEGORIES_H
|
||||
#ifndef CATEGORIES_H
|
||||
#define CATEGORIES_H
|
||||
|
||||
|
||||
#include <QString>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <functional>
|
||||
|
||||
|
||||
/**
|
||||
* @brief Manage the available mod categories
|
||||
* @warning member functions of this class currently use a wild mix of ids and indexes to look up categories,
|
||||
* optimized to where the request comes from. Therefore be very careful which of the two you have available
|
||||
**/
|
||||
class CategoryFactory {
|
||||
|
||||
friend class CategoriesDialog;
|
||||
|
||||
public:
|
||||
|
||||
static const int CATEGORY_NONE = 0;
|
||||
|
||||
static const int CATEGORY_SPECIAL_FIRST = 10000;
|
||||
static const int CATEGORY_SPECIAL_CHECKED = CATEGORY_SPECIAL_FIRST;
|
||||
static const int CATEGORY_SPECIAL_UNCHECKED = 10001;
|
||||
static const int CATEGORY_SPECIAL_UPDATEAVAILABLE = 10002;
|
||||
static const int CATEGORY_SPECIAL_NOCATEGORY = 10003;
|
||||
static const int CATEGORY_SPECIAL_CONFLICT = 10004;
|
||||
static const int CATEGORY_SPECIAL_NOTENDORSED = 10005;
|
||||
|
||||
public:
|
||||
|
||||
struct Category {
|
||||
Category(int sortValue, int id, const QString &name, const std::vector<int> &nexusIDs, int parentID)
|
||||
: m_SortValue(sortValue), m_ID(id), m_Name(name), m_HasChildren(false),
|
||||
m_NexusIDs(nexusIDs), m_ParentID(parentID) {}
|
||||
int m_SortValue;
|
||||
int m_ID;
|
||||
int m_ParentID;
|
||||
bool m_HasChildren;
|
||||
QString m_Name;
|
||||
std::vector<int> m_NexusIDs;
|
||||
|
||||
friend bool operator<(const Category &LHS, const Category &RHS) {
|
||||
return LHS.m_SortValue < RHS.m_SortValue;
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief reset the list of categories
|
||||
**/
|
||||
void reset();
|
||||
|
||||
/**
|
||||
* @brief save the categories to the categories.dat file
|
||||
**/
|
||||
void saveCategories();
|
||||
|
||||
/**
|
||||
* @brief retrieve the number of available categories
|
||||
*
|
||||
* @return unsigned int number of categories
|
||||
**/
|
||||
unsigned numCategories() const { return m_Categories.size(); }
|
||||
|
||||
/**
|
||||
* @brief count all categories that match a specified filter
|
||||
* @param filter the filter to test
|
||||
* @return number of matching categories
|
||||
*/
|
||||
unsigned int countCategories(std::tr1::function<bool (const Category &category)> filter);
|
||||
|
||||
/**
|
||||
* @brief get the id of the parent category
|
||||
*
|
||||
* @param index the index to look up
|
||||
* @return int id of the parent category
|
||||
**/
|
||||
int getParentID(unsigned int index) const;
|
||||
|
||||
/**
|
||||
* @brief determine if a category exists (by id)
|
||||
*
|
||||
* @param id the id to check for existance
|
||||
* @return true if the category exists, false otherwise
|
||||
**/
|
||||
bool categoryExists(int id) const;
|
||||
|
||||
/**
|
||||
* @brief test if a category is child of a second one
|
||||
* @param id the presumed child id
|
||||
* @param parentID the parent id to test for
|
||||
* @return true if id is a child of parentID
|
||||
**/
|
||||
bool isDecendantOf(int id, int parentID) const;
|
||||
|
||||
/**
|
||||
* @brief test if the specified category has child categories
|
||||
*
|
||||
* @param index index of the category to look up
|
||||
* @return bool true if the category has child categories
|
||||
**/
|
||||
bool hasChildren(unsigned int index) const;
|
||||
|
||||
/**
|
||||
* @brief retrieve the name of a category
|
||||
*
|
||||
* @param index index of the category to look up
|
||||
* @return QString name of the category
|
||||
**/
|
||||
QString getCategoryName(unsigned int index) const;
|
||||
|
||||
/**
|
||||
* @brief look up the id of a category by its index
|
||||
*
|
||||
* @param index index of the category to look up
|
||||
* @return int id of the category
|
||||
**/
|
||||
int getCategoryID(unsigned int index) const;
|
||||
|
||||
/**
|
||||
* @brief look up the index of a category by its id
|
||||
*
|
||||
* @param id index of the category to look up
|
||||
* @return unsigned int index of the category
|
||||
**/
|
||||
int getCategoryIndex(int ID) const;
|
||||
|
||||
/**
|
||||
* @brief retrieve the index of a category by its nexus id
|
||||
*
|
||||
* @param nexusID nexus id of the category to look up
|
||||
* @return unsigned int index of the category or 0 if no category matches
|
||||
**/
|
||||
unsigned int resolveNexusID(int nexusID) const;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief retrieve a reference to the singleton instance
|
||||
*
|
||||
* @return the reference to the singleton
|
||||
**/
|
||||
static CategoryFactory &instance();
|
||||
|
||||
/**
|
||||
* @return path to the file that contains the categories list
|
||||
*/
|
||||
static QString categoriesFilePath();
|
||||
|
||||
private:
|
||||
|
||||
CategoryFactory();
|
||||
|
||||
void loadDefaultCategories();
|
||||
|
||||
void addCategory(int id, const QString &name, const std::vector<int> &nexusID, int parentID);
|
||||
|
||||
void setParents();
|
||||
|
||||
static void cleanup();
|
||||
|
||||
private:
|
||||
|
||||
static CategoryFactory *s_Instance;
|
||||
|
||||
std::vector<Category> m_Categories;
|
||||
std::map<int, unsigned int> m_IDMap;
|
||||
std::map<int, unsigned int> m_NexusMap;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // CATEGORIES_H
|
||||
|
||||
@@ -86,7 +86,8 @@ public:
|
||||
{
|
||||
QLineEdit *edit = qobject_cast<QLineEdit*>(editor);
|
||||
int pos = 0;
|
||||
if (m_Validator->validate(edit->text(), pos) == QValidator::Acceptable) {
|
||||
QString editText = edit->text();
|
||||
if (m_Validator->validate(editText, pos) == QValidator::Acceptable) {
|
||||
QItemDelegate::setModelData(editor, model, index);
|
||||
}
|
||||
}
|
||||
@@ -163,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);
|
||||
|
||||
@@ -33,6 +33,11 @@ DirectoryRefresher::DirectoryRefresher()
|
||||
{
|
||||
}
|
||||
|
||||
DirectoryRefresher::~DirectoryRefresher()
|
||||
{
|
||||
delete m_DirectoryStructure;
|
||||
}
|
||||
|
||||
DirectoryEntry *DirectoryRefresher::getDirectoryStructure()
|
||||
{
|
||||
QMutexLocker locker(&m_RefreshLock);
|
||||
|
||||
@@ -21,10 +21,10 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define DIRECTORYREFRESHER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <directoryentry.h>
|
||||
#include <vector>
|
||||
#include <QMutex>
|
||||
#include <tuple>
|
||||
#include <directoryentry.h>
|
||||
|
||||
|
||||
/**
|
||||
@@ -43,6 +43,8 @@ public:
|
||||
**/
|
||||
DirectoryRefresher();
|
||||
|
||||
~DirectoryRefresher();
|
||||
|
||||
/**
|
||||
* @brief retrieve the updated directory structure
|
||||
*
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity type="win32" name="dlls" version="1.0.0.0" processorArchitecture="x86"/>
|
||||
<file name="icuin49.dll"/>
|
||||
<file name="icuuc49.dll"/>
|
||||
<file name="icudt49.dll"/>
|
||||
<file name="Qt5Cored.dll"/>
|
||||
<file name="Qt5Declaratived.dll"/>
|
||||
<file name="Qt5Guid.dll"/>
|
||||
<file name="Qt5Networkd.dll"/>
|
||||
<file name="Qt5Scriptd.dll"/>
|
||||
<file name="Qt5Sqld.dll"/>
|
||||
<file name="Qt5Widgetsd.dll"/>
|
||||
<file name="Qt5XmlPatternsd.dll"/>
|
||||
</assembly>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user