mirror of
https://github.com/ModOrganizer2/modorganizer.git
synced 2026-07-27 13:58:24 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
afa0cb9446 | ||
|
|
0657774e2e | ||
|
|
695593968b | ||
|
|
61edeb12f1 | ||
|
|
db6b536fb1 | ||
|
|
64590a10d7 | ||
|
|
4a582e524d | ||
|
|
a00cda607c | ||
|
|
42407866e9 | ||
|
|
c3a8a0b9eb | ||
|
|
607b2a10aa | ||
|
|
6b60d54853 | ||
|
|
c7101be7d8 | ||
|
|
d80a77a4cb | ||
|
|
33b544112c | ||
|
|
8a3af93b39 | ||
|
|
352975e757 | ||
|
|
cd83f4e732 | ||
|
|
4f25a0689f | ||
|
|
3d642563cb | ||
|
|
0100c86887 | ||
|
|
8d04c77c29 | ||
|
|
b935ce3862 | ||
|
|
fcebf21c44 | ||
|
|
3d1dfadb40 | ||
|
|
c2c48bd39a | ||
|
|
9163a6dc34 | ||
|
|
8bf3037d4b | ||
|
|
4f1bb36933 | ||
|
|
cbdea13a9c | ||
|
|
b36c666899 | ||
|
|
a625acd17b | ||
|
|
f5a815185f |
+82
@@ -0,0 +1,82 @@
|
||||
[main]
|
||||
host = https://www.transifex.com
|
||||
|
||||
[mod-organizer.organizer]
|
||||
file_filter = organizer/organizer_<lang>.ts
|
||||
source_file = organizer/organizer_en.ts
|
||||
source_lang = en
|
||||
|
||||
[mod-organizer.diagnosebasic]
|
||||
file_filter = plugins/diagnoseBasic/diagnoseBasic_<lang>.ts
|
||||
source_file = plugins/diagnoseBasic/diagnoseBasic_en.ts
|
||||
source_lang = en
|
||||
|
||||
[mod-organizer.bsaextractor]
|
||||
file_filter = plugins/bsaExtractor/bsaExtractor_<lang>.ts
|
||||
source_file = plugins/bsaExtractor/bsaExtractor_en.ts
|
||||
source_lang = en
|
||||
|
||||
[mod-organizer.checkfnis]
|
||||
file_filter = plugins/checkFNIS/checkFNIS_<lang>.ts
|
||||
source_file = plugins/checkFNIS/checkFNIS_en.ts
|
||||
source_lang = en
|
||||
|
||||
[mod-organizer.inieditor]
|
||||
file_filter = plugins/iniEditor/iniEditor_<lang>.ts
|
||||
source_file = plugins/iniEditor/iniEditor_en.ts
|
||||
source_lang = en
|
||||
|
||||
[mod-organizer.installerbain]
|
||||
file_filter = plugins/installerBAIN/installerBAIN_<lang>.ts
|
||||
source_file = plugins/installerBAIN/installerBAIN_en.ts
|
||||
source_lang = en
|
||||
|
||||
[mod-organizer.installerbundle]
|
||||
file_filter = plugins/installerBundle/installerBundle_<lang>.ts
|
||||
source_file = plugins/installerBundle/installerBundle_en.ts
|
||||
source_lang = en
|
||||
|
||||
[mod-organizer.installerfomod]
|
||||
file_filter = plugins/installerFomod/installerFomod_<lang>.ts
|
||||
source_file = plugins/installerFomod/installerFomod_en.ts
|
||||
source_lang = en
|
||||
|
||||
[mod-organizer.installermanual]
|
||||
file_filter = plugins/installerManual/installerManual_<lang>.ts
|
||||
source_file = plugins/installerManual/installerManual_en.ts
|
||||
source_lang = en
|
||||
|
||||
[mod-organizer.installerncc]
|
||||
file_filter = plugins/installerNCC/installerNCC_<lang>.ts
|
||||
source_file = plugins/installerNCC/installerNCC_en.ts
|
||||
source_lang = en
|
||||
|
||||
[mod-organizer.installerquick]
|
||||
file_filter = plugins/installerQuick/installerQuick_<lang>.ts
|
||||
source_file = plugins/installerQuick/installerQuick_en.ts
|
||||
source_lang = en
|
||||
|
||||
[mod-organizer.nmmimport]
|
||||
file_filter = plugins/NMMImport/NMMImport_<lang>.ts
|
||||
source_file = plugins/NMMImport/NMMImport_en.ts
|
||||
source_lang = en
|
||||
|
||||
[mod-organizer.previewbase]
|
||||
file_filter = plugins/previewBase/previewBase_<lang>.ts
|
||||
source_file = plugins/previewBase/previewBase_en.ts
|
||||
source_lang = en
|
||||
|
||||
[mod-organizer.previewdds]
|
||||
file_filter = plugins/previewDDS/previewDDS_<lang>.ts
|
||||
source_file = plugins/previewDDS/previewDDS_en.ts
|
||||
source_lang = en
|
||||
|
||||
[mod-organizer.proxypython]
|
||||
file_filter = plugins/proxyPython/proxyPython_<lang>.ts
|
||||
source_file = plugins/proxyPython/proxyPython_en.ts
|
||||
source_lang = en
|
||||
|
||||
[mod-organizer.configurator]
|
||||
file_filter = plugins/pyniEdit/pyniEdit_<lang>.ts
|
||||
source_file = plugins/pyniEdit/pyniEdit_en.ts
|
||||
source_lang = en
|
||||
+3
-1
@@ -669,7 +669,9 @@ if qt_env['QT_MAJOR_VERSION'] > 4:
|
||||
dlls_to_install += [
|
||||
os.path.join(env['QTDIR'],
|
||||
'bin',
|
||||
'icu%s%d%d.dll' % (lib, qt_env['QT_MAJOR_VERSION'], qt_env['QT_MINOR_VERSION'] - 1))
|
||||
'icu%s%d%d.dll' % (lib,
|
||||
qt_env['QT_MAJOR_VERSION'],
|
||||
qt_env['QT_MINOR_VERSION'] - 1))
|
||||
for lib in ('dt','in', 'uc')
|
||||
]
|
||||
|
||||
|
||||
+13
-10
@@ -35,7 +35,7 @@ removing = None
|
||||
includes = dict()
|
||||
|
||||
adding = None
|
||||
added = dict()
|
||||
added = defaultdict(list)
|
||||
lcadded = dict()
|
||||
|
||||
foundline = None
|
||||
@@ -70,10 +70,10 @@ def process_next_line(line, outfile):
|
||||
elif adding:
|
||||
m = re.match(r'.*class (.*);', line)
|
||||
if m:
|
||||
added[m.group(1)] = (adding, line)
|
||||
added[m.group(1)].append((adding, line))
|
||||
lcadded[m.group(1).lower() + '.h'] = m.group(1)
|
||||
else:
|
||||
added[line] = (adding, line)
|
||||
added[line].append((adding, line))
|
||||
elif removing:
|
||||
# Really we should stash these so that if we get a 'class xxx' in
|
||||
# the add lines we can print it here. also we could do the case
|
||||
@@ -88,10 +88,12 @@ def process_next_line(line, outfile):
|
||||
if clname in lcadded:
|
||||
clname = lcadded[clname]
|
||||
if clname in added:
|
||||
messages[removing].append(
|
||||
'%s(%s) : warning I0004: Replace include of %s with '
|
||||
'forward reference %s' % (
|
||||
removing, m.group(2), m.group(1), added[clname][1]))
|
||||
for item in added[clname]:
|
||||
if removing == item[0]:
|
||||
messages[removing].append(
|
||||
'%s(%s) : warning I0004: Replace include of %s'
|
||||
' with forward reference %s' % (
|
||||
removing, m.group(2), m.group(1), item[1]))
|
||||
del added[clname]
|
||||
else:
|
||||
messages[removing].append(
|
||||
@@ -140,9 +142,10 @@ if foundline is None:
|
||||
foundline = '1'
|
||||
|
||||
for add in added:
|
||||
messages[added[add][0]].append(
|
||||
'%s(%s) : warning I0003: Need to include %s' % (
|
||||
added[add][0], foundline, added[add][1]))
|
||||
for item in added[add]:
|
||||
messages[item[0]].append(
|
||||
'%s(%s) : warning I0003: Need to include %s' % (
|
||||
item[0], foundline, item[1]))
|
||||
|
||||
for file in sorted(messages.keys(), reverse = True):
|
||||
for line in messages[file]:
|
||||
|
||||
+3
-1
@@ -237,8 +237,10 @@ FIND_PACKAGE(Qt5Declarative REQUIRED)
|
||||
FIND_PACKAGE(Qt5Network REQUIRED)
|
||||
FIND_PACKAGE(Qt5WinExtras REQUIRED)
|
||||
FIND_PACKAGE(Qt5WebKitWidgets REQUIRED)
|
||||
FIND_PACKAGE(Qt5LinguistTools)
|
||||
QT5_WRAP_UI(organizer_UIHDRS ${organizer_UIS})
|
||||
QT5_ADD_RESOURCES(organizer_RCCPPS ${organizer_QRCS})
|
||||
QT5_CREATE_TRANSLATION(organizer_translations_qm ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/organizer_en.ts)
|
||||
|
||||
INCLUDE_DIRECTORIES(${Qt5Declarative_INCLUDES})
|
||||
|
||||
@@ -295,7 +297,7 @@ ELSE()
|
||||
SET(usvfs_name usvfs_x86)
|
||||
ENDIF()
|
||||
|
||||
ADD_EXECUTABLE(ModOrganizer WIN32 ${organizer_HDRS} ${organizer_SRCS} ${organizer_UIHDRS} ${organizer_RCS} ${organizer_RCCPPS})
|
||||
ADD_EXECUTABLE(ModOrganizer WIN32 ${organizer_HDRS} ${organizer_SRCS} ${organizer_UIHDRS} ${organizer_RCS} ${organizer_RCCPPS} ${organizer_translations_qm})
|
||||
TARGET_LINK_LIBRARIES(ModOrganizer
|
||||
Qt5::Widgets Qt5::WinExtras Qt5::WebKitWidgets
|
||||
${Boost_LIBRARIES}
|
||||
|
||||
+3
-3
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>746</width>
|
||||
<width>604</width>
|
||||
<height>369</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -151,7 +151,7 @@
|
||||
</widget>
|
||||
<widget class="QWidget" name="credits">
|
||||
<attribute name="title">
|
||||
<string>Credits</string>
|
||||
<string>Thanks</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
@@ -239,7 +239,7 @@
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Others</string>
|
||||
<string>Other Supporter</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
|
||||
@@ -44,6 +44,10 @@ QString CategoryFactory::categoriesFilePath()
|
||||
CategoryFactory::CategoryFactory()
|
||||
{
|
||||
atexit(&cleanup);
|
||||
}
|
||||
|
||||
void CategoryFactory::loadCategories()
|
||||
{
|
||||
reset();
|
||||
|
||||
QFile categoryFile(categoriesFilePath());
|
||||
|
||||
@@ -75,6 +75,11 @@ public:
|
||||
**/
|
||||
void reset();
|
||||
|
||||
/**
|
||||
* @brief read categories from file
|
||||
*/
|
||||
void loadCategories();
|
||||
|
||||
/**
|
||||
* @brief save the categories to the categories.dat file
|
||||
**/
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>282</width>
|
||||
<width>294</width>
|
||||
<height>156</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -25,29 +25,25 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Username</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="usernameEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="passwordEdit">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?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="icuin53.dll"/>
|
||||
<file name="icuuc53.dll"/>
|
||||
<file name="icudt53.dll"/>
|
||||
<file name="icuin54.dll"/>
|
||||
<file name="icuuc54.dll"/>
|
||||
<file name="icudt54.dll"/>
|
||||
<file name="Qt5Cored.dll"/>
|
||||
<file name="Qt5Declaratived.dll"/>
|
||||
<file name="Qt5Guid.dll"/>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?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="icuin53.dll"/>
|
||||
<file name="icuuc53.dll"/>
|
||||
<file name="icudt53.dll"/>
|
||||
<file name="icuin54.dll"/>
|
||||
<file name="icuuc54.dll"/>
|
||||
<file name="icudt54.dll"/>
|
||||
<file name="libeay32.dll"/>
|
||||
<file name="ssleay32.dll"/>
|
||||
<file name="Qt5Core.dll"/>
|
||||
|
||||
+12
-9
@@ -757,12 +757,15 @@ QString DownloadManager::getDisplayName(int index) const
|
||||
|
||||
DownloadInfo *info = m_ActiveDownloads.at(index);
|
||||
|
||||
QTextDocument doc;
|
||||
if (!info->m_FileInfo->name.isEmpty()) {
|
||||
return QString("%1 (%2, v%3)").arg(info->m_FileInfo->name)
|
||||
doc.setHtml(info->m_FileInfo->name);
|
||||
return QString("%1 (%2, v%3)").arg(doc.toPlainText())
|
||||
.arg(getFileTypeString(info->m_FileInfo->fileCategory))
|
||||
.arg(info->m_FileInfo->version.displayString());
|
||||
} else {
|
||||
return info->m_FileName;
|
||||
doc.setHtml(info->m_FileName);
|
||||
return doc.toPlainText();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1058,7 +1061,9 @@ void DownloadManager::nxmDescriptionAvailable(int, QVariant userData, QVariant r
|
||||
DownloadInfo *info = downloadInfoByID(userData.toInt());
|
||||
if (info == nullptr) return;
|
||||
info->m_FileInfo->categoryID = result["category_id"].toInt();
|
||||
info->m_FileInfo->modName = result["name"].toString().trimmed();
|
||||
QTextDocument doc;
|
||||
doc.setHtml(result["name"].toString().trimmed());
|
||||
info->m_FileInfo->modName = doc.toPlainText();
|
||||
info->m_FileInfo->newestVersion.parse(result["version"].toString());
|
||||
if (info->m_FileInfo->fileID != 0) {
|
||||
setState(info, STATE_READY);
|
||||
@@ -1116,7 +1121,7 @@ void DownloadManager::nxmFilesAvailable(int, QVariant userData, QVariant resultD
|
||||
|
||||
bool found = false;
|
||||
|
||||
foreach(QVariant file, result) {
|
||||
for (QVariant file : result) {
|
||||
QVariantMap fileInfo = file.toMap();
|
||||
QString fileName = fileInfo["uri"].toString();
|
||||
QString fileNameVariant = fileName.mid(0).replace(' ', '_');
|
||||
@@ -1127,12 +1132,10 @@ void DownloadManager::nxmFilesAvailable(int, QVariant userData, QVariant resultD
|
||||
if (!info->m_FileInfo->version.isValid()) {
|
||||
info->m_FileInfo->version = info->m_FileInfo->newestVersion;
|
||||
}
|
||||
//Nexus has HTMLd these so unhtml them if necessary
|
||||
// we receive some names html-encoded. This is used to decode it
|
||||
QTextDocument doc;
|
||||
doc.setHtml(info->m_FileInfo->modName);
|
||||
doc.setHtml(fileInfo["modName"].toString());
|
||||
info->m_FileInfo->modName = doc.toPlainText();
|
||||
doc.setHtml(info->m_FileInfo->name);
|
||||
info->m_FileInfo->name = doc.toPlainText();
|
||||
info->m_FileInfo->fileCategory = convertFileCategory(fileInfo["category_id"].toInt());
|
||||
info->m_FileInfo->fileTime = matchDate(fileInfo["date"].toString());
|
||||
info->m_FileInfo->fileID = fileInfo["id"].toInt();
|
||||
@@ -1148,7 +1151,7 @@ void DownloadManager::nxmFilesAvailable(int, QVariant userData, QVariant resultD
|
||||
emit showMessage(tr("No matching file found on Nexus! Maybe this file is no longer available or it was renamed?"));
|
||||
} else {
|
||||
SelectionDialog selection(tr("No file on Nexus matches the selected file by name. Please manually choose the correct one."));
|
||||
foreach(QVariant file, result) {
|
||||
for (QVariant file : result) {
|
||||
QVariantMap fileInfo = file.toMap();
|
||||
selection.addChoice(fileInfo["uri"].toString(), "", file);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ IGameInfo::Type GameInfoImpl::type() const
|
||||
case GameInfo::TYPE_FALLOUT4: return IGameInfo::TYPE_FALLOUT4;
|
||||
case GameInfo::TYPE_FALLOUTNV: return IGameInfo::TYPE_FALLOUTNV;
|
||||
case GameInfo::TYPE_SKYRIM: return IGameInfo::TYPE_SKYRIM;
|
||||
case GameInfo::TYPE_SKYRIMSE: return IGameInfo::TYPE_SKYRIMSE;
|
||||
default: throw MyException(QObject::tr("invalid game type %1").arg(GameInfo::instance().getType()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ QList<QString> GenericIconDelegate::getIcons(const QModelIndex &index) const
|
||||
{
|
||||
QList<QString> result;
|
||||
if (index.isValid()) {
|
||||
foreach (const QVariant &var, index.data(m_Role).toList()) {
|
||||
for (const QVariant &var : index.data(m_Role).toList()) {
|
||||
if (!m_Compact || !var.toString().isEmpty()) {
|
||||
result.append(var.toString());
|
||||
}
|
||||
|
||||
+12
-10
@@ -48,6 +48,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include <QDateTime>
|
||||
#include <QDirIterator>
|
||||
#include <QDebug>
|
||||
#include <QTextDocument>
|
||||
|
||||
#include <Shellapi.h>
|
||||
|
||||
@@ -76,16 +77,14 @@ static T resolveFunction(QLibrary &lib, const char *name)
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
InstallationManager::InstallationManager()
|
||||
: m_ParentWidget(nullptr)
|
||||
, m_SupportedExtensions({ "zip", "rar", "7z", "fomod", "001" })
|
||||
{
|
||||
QLibrary archiveLib(QCoreApplication::applicationDirPath()
|
||||
+ "\\dlls\\archive.dll");
|
||||
: m_ParentWidget(nullptr),
|
||||
m_SupportedExtensions({"zip", "rar", "7z", "fomod", "001"}) {
|
||||
QLibrary archiveLib(QCoreApplication::applicationDirPath() +
|
||||
"\\dlls\\archive.dll");
|
||||
if (!archiveLib.load()) {
|
||||
throw MyException(
|
||||
tr("archive.dll not loaded: \"%1\"").arg(archiveLib.errorString()));
|
||||
throw MyException(QObject::tr("archive.dll not loaded: \"%1\"")
|
||||
.arg(archiveLib.errorString()));
|
||||
}
|
||||
|
||||
CreateArchiveType CreateArchiveFunc
|
||||
@@ -669,7 +668,9 @@ bool InstallationManager::install(const QString &fileName,
|
||||
if (QFile(metaName).exists()) {
|
||||
QSettings metaFile(metaName, QSettings::IniFormat);
|
||||
modID = metaFile.value("modID", 0).toInt();
|
||||
modName.update(metaFile.value("name", "").toString(), GUESS_FALLBACK);
|
||||
QTextDocument doc;
|
||||
doc.setHtml(metaFile.value("name", "").toString());
|
||||
modName.update(doc.toPlainText(), GUESS_FALLBACK);
|
||||
modName.update(metaFile.value("modName", "").toString(), GUESS_META);
|
||||
|
||||
version = metaFile.value("version", "").toString();
|
||||
@@ -688,12 +689,13 @@ bool InstallationManager::install(const QString &fileName,
|
||||
{ // guess the mod name and mod if from the file name if there was no meta information
|
||||
QString guessedModName;
|
||||
int guessedModID = modID;
|
||||
NexusInterface::interpretNexusFileName(QFileInfo(fileName).baseName(), guessedModName, guessedModID, false);
|
||||
NexusInterface::interpretNexusFileName(QFileInfo(fileName).fileName(), guessedModName, guessedModID, false);
|
||||
if ((modID == 0) && (guessedModID != -1)) {
|
||||
modID = guessedModID;
|
||||
} else if (modID != guessedModID) {
|
||||
qDebug("passed mod id: %d, guessed id: %d", modID, guessedModID);
|
||||
}
|
||||
|
||||
modName.update(guessedModName, GUESS_GOOD);
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ QString InstanceManager::queryInstanceName() const
|
||||
// would be neat if we could take the names from the game plugins but
|
||||
// the required initialization order requires the ini file to be
|
||||
// available *before* we load plugins
|
||||
dialog.setComboBoxItems({ "Oblivion", "Skyrim", "Fallout 3",
|
||||
dialog.setComboBoxItems({ "Oblivion", "Skyrim", "SkyrimSE", "Fallout 3",
|
||||
"Fallout NV", "Fallout 4" });
|
||||
dialog.setComboBoxEditable(true);
|
||||
dialog.setWindowTitle(QObject::tr("Enter Instance Name"));
|
||||
@@ -196,7 +196,7 @@ QString InstanceManager::determineDataPath()
|
||||
}
|
||||
}
|
||||
|
||||
if (instanceId.isEmpty() || !QFileInfo::exists(dataPath)) {
|
||||
if (instanceId.isEmpty()) {
|
||||
return qApp->applicationDirPath();
|
||||
} else {
|
||||
setCurrentInstance(instanceId);
|
||||
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
virtual void lock() = 0;
|
||||
virtual void unlock() = 0;
|
||||
virtual bool unlockClicked() = 0;
|
||||
virtual void setProcessName(QString const &) = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -19,8 +19,11 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "lockeddialog.h"
|
||||
#include "ui_lockeddialog.h"
|
||||
#include <QResizeEvent>
|
||||
|
||||
#include <QPoint>
|
||||
#include <QResizeEvent>
|
||||
#include <QWidget>
|
||||
#include <Qt> // for Qt::FramelessWindowHint, etc
|
||||
|
||||
LockedDialog::LockedDialog(QWidget *parent, const QString &text, bool unlockButton)
|
||||
: QDialog(parent)
|
||||
|
||||
+10
-1
@@ -20,7 +20,12 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
#ifndef LOCKEDDIALOG_H
|
||||
#define LOCKEDDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QDialog> // for QDialog
|
||||
#include <QObject> // for Q_OBJECT, slots
|
||||
#include <QString> // for QString
|
||||
|
||||
class QResizeEvent;
|
||||
class QWidget;
|
||||
|
||||
namespace Ui {
|
||||
class LockedDialog;
|
||||
@@ -49,6 +54,10 @@ public:
|
||||
**/
|
||||
bool unlockClicked() const { return m_UnlockClicked; }
|
||||
|
||||
/**
|
||||
* @brief set the name of the process being run
|
||||
* @param name of process
|
||||
*/
|
||||
void setProcessName(const QString &name);
|
||||
|
||||
protected:
|
||||
|
||||
+19
-34
@@ -85,38 +85,21 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
using namespace MOBase;
|
||||
using namespace MOShared;
|
||||
|
||||
|
||||
bool createAndMakeWritable(const std::wstring &subPath)
|
||||
{
|
||||
bool createAndMakeWritable(const std::wstring &subPath) {
|
||||
QString const dataPath = qApp->property("dataPath").toString();
|
||||
QString fullPath = dataPath + "/" + QString::fromStdWString(subPath);
|
||||
|
||||
if (!QDir(fullPath).exists()) {
|
||||
QDir().mkdir(fullPath);
|
||||
if (!QDir(fullPath).exists() && !QDir().mkdir(fullPath)) {
|
||||
QMessageBox::critical(nullptr, QObject::tr("Error"),
|
||||
QObject::tr("Failed to create \"%1\". Your user "
|
||||
"account probably lacks permission.")
|
||||
.arg(fullPath));
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
QFileInfo fileInfo(fullPath);
|
||||
if (!fileInfo.exists() || !fileInfo.isWritable()) {
|
||||
if (QMessageBox::question(nullptr, QObject::tr("Permissions required"),
|
||||
QObject::tr("The current user account doesn't have the required access rights to run "
|
||||
"Mod Organizer. The neccessary changes can be made automatically (the MO directory "
|
||||
"will be made writable for the current user account). You will be asked to run "
|
||||
"\"helper.exe\" with administrative rights."),
|
||||
QMessageBox::Yes | QMessageBox::Cancel) == QMessageBox::Yes) {
|
||||
if (!Helper::init(qApp->applicationDirPath().toStdWString(),
|
||||
dataPath.toStdWString())) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
// no matter which directory didn't exist/wasn't writable, the helper
|
||||
// should have created them all so we don't have to worry this message box would appear repeatedly
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool bootstrap()
|
||||
{
|
||||
// remove the temporary backup directory in case we're restarting after an update
|
||||
@@ -129,11 +112,9 @@ bool bootstrap()
|
||||
removeOldFiles(qApp->property("dataPath").toString() + "/" + QString::fromStdWString(AppConfig::logPath()),
|
||||
"usvfs*.log", 5, QDir::Name);
|
||||
|
||||
createAndMakeWritable(AppConfig::profilesPath());
|
||||
createAndMakeWritable(AppConfig::modsPath());
|
||||
createAndMakeWritable(AppConfig::downloadPath());
|
||||
createAndMakeWritable(AppConfig::overwritePath());
|
||||
createAndMakeWritable(AppConfig::logPath());
|
||||
if (!createAndMakeWritable(AppConfig::logPath())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -168,7 +149,7 @@ static LONG WINAPI MyUnhandledExceptionFilter(struct _EXCEPTION_POINTERS *except
|
||||
if (QMessageBox::question(nullptr, QObject::tr("Woops"),
|
||||
QObject::tr("ModOrganizer has crashed! "
|
||||
"Should a diagnostic file be created? "
|
||||
"If you send me this file (%1) to sherb@gmx.net, "
|
||||
"If you send me this file (%1) to modorganizer@gmail.com, "
|
||||
"the bug is a lot more likely to be fixed. "
|
||||
"Please include a short description of what you were "
|
||||
"doing when the crash happened"
|
||||
@@ -445,7 +426,7 @@ int runApplication(MOApplication &application, SingleInstance &instance,
|
||||
qDebug("data path: %s", qPrintable(dataPath));
|
||||
|
||||
if (!bootstrap()) {
|
||||
reportError("failed to set up data path");
|
||||
reportError("failed to set up data paths");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -465,6 +446,10 @@ int runApplication(MOApplication &application, SingleInstance &instance,
|
||||
QSettings::IniFormat);
|
||||
qDebug("initializing core");
|
||||
OrganizerCore organizer(settings);
|
||||
if (!organizer.bootstrap()) {
|
||||
reportError("failed to set up data paths");
|
||||
return 1;
|
||||
}
|
||||
qDebug("initialize plugins");
|
||||
PluginContainer pluginContainer(&organizer);
|
||||
pluginContainer.loadPlugins();
|
||||
@@ -533,13 +518,13 @@ int runApplication(MOApplication &application, SingleInstance &instance,
|
||||
// pass the remaining parameters to the binary
|
||||
try {
|
||||
organizer.startApplication(exeName, arguments, QString(), QString());
|
||||
return 0;
|
||||
} catch (const std::exception &e) {
|
||||
reportError(
|
||||
QObject::tr("failed to start application: %1").arg(e.what()));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
NexusInterface::instance()->getAccessManager()->startLoginCheck();
|
||||
|
||||
+123
-43
@@ -34,6 +34,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "organizercore.h"
|
||||
#include "pluginlistsortproxy.h"
|
||||
#include "previewgenerator.h"
|
||||
#include "serverinfo.h"
|
||||
#include "savegameinfo.h"
|
||||
#include "spawn.h"
|
||||
#include "versioninfo.h"
|
||||
@@ -200,8 +201,11 @@ MainWindow::MainWindow(QSettings &initSettings
|
||||
{
|
||||
ui->setupUi(this);
|
||||
updateWindowTitle(QString(), false);
|
||||
|
||||
languageChange(m_OrganizerCore.settings().language());
|
||||
|
||||
m_CategoryFactory.loadCategories();
|
||||
|
||||
ui->logList->setModel(LogBuffer::instance());
|
||||
ui->logList->setColumnWidth(0, 100);
|
||||
ui->logList->setAutoScroll(true);
|
||||
@@ -242,12 +246,14 @@ MainWindow::MainWindow(QSettings &initSettings
|
||||
ui->modList->setItemDelegateForColumn(ModList::COL_FLAGS, new ModFlagIconDelegate(ui->modList));
|
||||
ui->modList->setItemDelegateForColumn(ModList::COL_CONTENT, contentDelegate);
|
||||
ui->modList->header()->installEventFilter(m_OrganizerCore.modList());
|
||||
if (initSettings.contains("mod_list_state")) {
|
||||
ui->modList->header()->restoreState(initSettings.value("mod_list_state").toByteArray());
|
||||
|
||||
bool modListAdjusted = registerWidgetState(ui->modList->objectName(), ui->modList->header(), "mod_list_state");
|
||||
|
||||
if (modListAdjusted) {
|
||||
// hack: force the resize-signal to be triggered because restoreState doesn't seem to do that
|
||||
ui->modList->header()->resizeSection(ModList::COL_CONTENT, ui->modList->header()->sectionSize(ModList::COL_CONTENT) + 1);
|
||||
ui->modList->header()->resizeSection(ModList::COL_CONTENT, ui->modList->header()->sectionSize(ModList::COL_CONTENT) - 1);
|
||||
int sectionSize = ui->modList->header()->sectionSize(ModList::COL_CONTENT);
|
||||
ui->modList->header()->resizeSection(ModList::COL_CONTENT, sectionSize + 1);
|
||||
ui->modList->header()->resizeSection(ModList::COL_CONTENT, sectionSize);
|
||||
} else {
|
||||
// hide these columns by default
|
||||
ui->modList->header()->setSectionHidden(ModList::COL_CONTENT, true);
|
||||
@@ -264,15 +270,17 @@ MainWindow::MainWindow(QSettings &initSettings
|
||||
ui->espList->setModel(m_PluginListSortProxy);
|
||||
ui->espList->sortByColumn(PluginList::COL_PRIORITY, Qt::AscendingOrder);
|
||||
ui->espList->setItemDelegateForColumn(PluginList::COL_FLAGS, new GenericIconDelegate(ui->espList));
|
||||
if (initSettings.contains("plugin_list_state")) {
|
||||
ui->espList->header()->restoreState(initSettings.value("plugin_list_state").toByteArray());
|
||||
}
|
||||
ui->espList->installEventFilter(m_OrganizerCore.pluginList());
|
||||
|
||||
bool pluginListAdjusted = registerWidgetState(ui->espList->objectName(), ui->espList->header(), "plugin_list_state");
|
||||
registerWidgetState(ui->dataTree->objectName(), ui->dataTree->header());
|
||||
registerWidgetState(ui->downloadView->objectName(),
|
||||
ui->downloadView->header());
|
||||
|
||||
ui->splitter->setStretchFactor(0, 3);
|
||||
ui->splitter->setStretchFactor(1, 2);
|
||||
|
||||
resizeLists(initSettings.contains("mod_list_state"), initSettings.contains("plugin_list_state"));
|
||||
resizeLists(modListAdjusted, pluginListAdjusted);
|
||||
|
||||
QMenu *linkMenu = new QMenu(this);
|
||||
linkMenu->addAction(QIcon(":/MO/gui/link"), tr("Toolbar"), this, SLOT(linkToolbar()));
|
||||
@@ -289,7 +297,6 @@ MainWindow::MainWindow(QSettings &initSettings
|
||||
|
||||
// don't allow mouse wheel to switch grouping, too many people accidentally
|
||||
// turn on grouping and then don't understand what happened
|
||||
|
||||
EventFilter *noWheel
|
||||
= new EventFilter(this, [](QObject *, QEvent *event) -> bool {
|
||||
return event->type() == QEvent::Wheel;
|
||||
@@ -1005,8 +1012,14 @@ void MainWindow::startExeAction()
|
||||
{
|
||||
QAction *action = qobject_cast<QAction*>(sender());
|
||||
if (action != nullptr) {
|
||||
m_OrganizerCore.spawnBinary(
|
||||
const Executable &selectedExecutable(
|
||||
m_OrganizerCore.executablesList()->find(action->text()));
|
||||
m_OrganizerCore.spawnBinary(
|
||||
selectedExecutable.m_BinaryInfo, selectedExecutable.m_Arguments,
|
||||
selectedExecutable.m_WorkingDirectory.length() != 0
|
||||
? selectedExecutable.m_WorkingDirectory
|
||||
: selectedExecutable.m_BinaryInfo.absolutePath(),
|
||||
selectedExecutable.m_SteamAppID);
|
||||
} else {
|
||||
qCritical("not an action?");
|
||||
}
|
||||
@@ -1261,7 +1274,6 @@ void MainWindow::refreshDataTree()
|
||||
updateTo(subTree, L"", *m_OrganizerCore.directoryStructure(), conflictsBox->isChecked());
|
||||
tree->insertTopLevelItem(0, subTree);
|
||||
subTree->setExpanded(true);
|
||||
tree->header()->resizeSection(0, 200);
|
||||
}
|
||||
|
||||
|
||||
@@ -1423,12 +1435,7 @@ void MainWindow::readSettings()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::storeSettings(QSettings &settings)
|
||||
{
|
||||
settings.setValue("mod_list_state", ui->modList->header()->saveState());
|
||||
settings.setValue("plugin_list_state", ui->espList->header()->saveState());
|
||||
|
||||
void MainWindow::storeSettings(QSettings &settings) {
|
||||
settings.setValue("group_state", ui->groupCombo->currentIndex());
|
||||
|
||||
settings.setValue("window_geometry", saveGeometry());
|
||||
@@ -1439,23 +1446,42 @@ void MainWindow::storeSettings(QSettings &settings)
|
||||
|
||||
settings.setValue("filters_visible", ui->displayCategoriesBtn->isChecked());
|
||||
|
||||
settings.setValue("selected_executable", ui->executablesListBox->currentIndex());
|
||||
settings.setValue("selected_executable",
|
||||
ui->executablesListBox->currentIndex());
|
||||
|
||||
for (const std::pair<QString, QHeaderView*> kv : m_PersistedGeometry) {
|
||||
QString key = QString("geometry/") + kv.first;
|
||||
settings.setValue(key, kv.second->saveState());
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::lock()
|
||||
{
|
||||
if (m_LockDialog != nullptr) {
|
||||
++m_LockCount;
|
||||
return;
|
||||
}
|
||||
m_LockDialog = new LockedDialog(qApp->activeWindow());
|
||||
m_LockDialog->show();
|
||||
setEnabled(false);
|
||||
m_LockDialog->setEnabled(true); //What's the point otherwise?
|
||||
++m_LockCount;
|
||||
}
|
||||
|
||||
void MainWindow::unlock()
|
||||
{
|
||||
if (m_LockDialog != nullptr) {
|
||||
//If you come through here with a null lock pointer, it's a bug!
|
||||
if (m_LockDialog == nullptr) {
|
||||
qDebug("Unlocking main window when already unlocked");
|
||||
return;
|
||||
}
|
||||
--m_LockCount;
|
||||
if (m_LockCount == 0) {
|
||||
m_LockDialog->hide();
|
||||
m_LockDialog->deleteLater();
|
||||
m_LockDialog = nullptr;
|
||||
setEnabled(true);
|
||||
}
|
||||
setEnabled(true);
|
||||
}
|
||||
|
||||
bool MainWindow::unlockClicked()
|
||||
@@ -1467,6 +1493,13 @@ bool MainWindow::unlockClicked()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::setProcessName(QString const &name)
|
||||
{
|
||||
if (m_LockDialog != nullptr) {
|
||||
m_LockDialog->setProcessName(name);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_btnRefreshData_clicked()
|
||||
{
|
||||
m_OrganizerCore.refreshDirectoryStructure();
|
||||
@@ -1509,13 +1542,17 @@ void MainWindow::installMod(QString fileName)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_startButton_clicked() {
|
||||
const Executable &selectedExecutable(getSelectedExecutable());
|
||||
|
||||
void MainWindow::on_startButton_clicked()
|
||||
{
|
||||
m_OrganizerCore.spawnBinary(getSelectedExecutable());
|
||||
m_OrganizerCore.spawnBinary(
|
||||
selectedExecutable.m_BinaryInfo, selectedExecutable.m_Arguments,
|
||||
selectedExecutable.m_WorkingDirectory.length() != 0
|
||||
? selectedExecutable.m_WorkingDirectory
|
||||
: selectedExecutable.m_BinaryInfo.absolutePath(),
|
||||
selectedExecutable.m_SteamAppID);
|
||||
}
|
||||
|
||||
|
||||
static HRESULT CreateShortcut(LPCWSTR targetFileName, LPCWSTR arguments,
|
||||
LPCSTR linkFileName, LPCWSTR description,
|
||||
LPCTSTR iconFileName, int iconNumber,
|
||||
@@ -3185,40 +3222,58 @@ void MainWindow::linkMenu()
|
||||
|
||||
void MainWindow::on_actionSettings_triggered()
|
||||
{
|
||||
QString oldModDirectory(m_OrganizerCore.settings().getModDirectory());
|
||||
QString oldCacheDirectory(m_OrganizerCore.settings().getCacheDirectory());
|
||||
bool oldDisplayForeign(m_OrganizerCore.settings().displayForeign());
|
||||
bool proxy = m_OrganizerCore.settings().useProxy();
|
||||
m_OrganizerCore.settings().query(this);
|
||||
m_OrganizerCore.installationManager()->setModsDirectory(m_OrganizerCore.settings().getModDirectory());
|
||||
m_OrganizerCore.installationManager()->setDownloadDirectory(m_OrganizerCore.settings().getDownloadDirectory());
|
||||
Settings &settings = m_OrganizerCore.settings();
|
||||
|
||||
QString oldModDirectory(settings.getModDirectory());
|
||||
QString oldCacheDirectory(settings.getCacheDirectory());
|
||||
QString oldProfilesDirectory(settings.getProfileDirectory());
|
||||
bool oldDisplayForeign(settings.displayForeign());
|
||||
bool proxy = settings.useProxy();
|
||||
|
||||
settings.query(this);
|
||||
|
||||
InstallationManager *instManager = m_OrganizerCore.installationManager();
|
||||
instManager->setModsDirectory(settings.getModDirectory());
|
||||
instManager->setDownloadDirectory(settings.getDownloadDirectory());
|
||||
|
||||
fixCategories();
|
||||
refreshFilters();
|
||||
if (QDir::fromNativeSeparators(m_OrganizerCore.downloadManager()->getOutputDirectory()) != QDir::fromNativeSeparators(m_OrganizerCore.settings().getDownloadDirectory())) {
|
||||
if (m_OrganizerCore.downloadManager()->downloadsInProgress()) {
|
||||
MessageDialog::showMessage(tr("Can't change download directory while downloads are in progress!"), this);
|
||||
|
||||
if (settings.getProfileDirectory() != oldProfilesDirectory) {
|
||||
refreshProfiles();
|
||||
}
|
||||
|
||||
DownloadManager *dlManager = m_OrganizerCore.downloadManager();
|
||||
|
||||
if (dlManager->getOutputDirectory() != settings.getDownloadDirectory()) {
|
||||
if (dlManager->downloadsInProgress()) {
|
||||
MessageDialog::showMessage(tr("Can't change download directory while "
|
||||
"downloads are in progress!"),
|
||||
this);
|
||||
} else {
|
||||
m_OrganizerCore.downloadManager()->setOutputDirectory(m_OrganizerCore.settings().getDownloadDirectory());
|
||||
dlManager->setOutputDirectory(settings.getDownloadDirectory());
|
||||
}
|
||||
}
|
||||
m_OrganizerCore.downloadManager()->setPreferredServers(m_OrganizerCore.settings().getPreferredServers());
|
||||
dlManager->setPreferredServers(settings.getPreferredServers());
|
||||
|
||||
if ((m_OrganizerCore.settings().getModDirectory() != oldModDirectory)
|
||||
|| (m_OrganizerCore.settings().displayForeign() != oldDisplayForeign)) {
|
||||
if ((settings.getModDirectory() != oldModDirectory)
|
||||
|| (settings.displayForeign() != oldDisplayForeign)) {
|
||||
m_OrganizerCore.profileRefresh();
|
||||
}
|
||||
|
||||
if (m_OrganizerCore.settings().getCacheDirectory() != oldCacheDirectory) {
|
||||
NexusInterface::instance()->setCacheDirectory(m_OrganizerCore.settings().getCacheDirectory());
|
||||
if (settings.getCacheDirectory() != oldCacheDirectory) {
|
||||
NexusInterface::instance()->setCacheDirectory(settings.getCacheDirectory());
|
||||
}
|
||||
|
||||
if (proxy != m_OrganizerCore.settings().useProxy()) {
|
||||
activateProxy(m_OrganizerCore.settings().useProxy());
|
||||
if (proxy != settings.useProxy()) {
|
||||
activateProxy(settings.useProxy());
|
||||
}
|
||||
|
||||
NexusInterface::instance()->setNMMVersion(m_OrganizerCore.settings().getNMMVersion());
|
||||
NexusInterface::instance()->setNMMVersion(settings.getNMMVersion());
|
||||
|
||||
updateDownloadListDelegate();
|
||||
|
||||
m_OrganizerCore.setLogLevel(settings.logLevel());
|
||||
}
|
||||
|
||||
|
||||
@@ -4547,6 +4602,31 @@ void MainWindow::dropLocalFile(const QUrl &url, const QString &outputDir, bool m
|
||||
}
|
||||
}
|
||||
|
||||
bool MainWindow::registerWidgetState(const QString &name, QHeaderView *view, const char *oldSettingName) {
|
||||
// register the view so it's geometry gets saved at exit
|
||||
m_PersistedGeometry.push_back(std::make_pair(name, view));
|
||||
|
||||
// also, restore the geometry if it was saved before
|
||||
QSettings &settings = m_OrganizerCore.settings().directInterface();
|
||||
|
||||
QString key = QString("geometry/%1").arg(name);
|
||||
QByteArray data;
|
||||
|
||||
if ((oldSettingName != nullptr) && settings.contains(oldSettingName)) {
|
||||
data = settings.value(oldSettingName).toByteArray();
|
||||
settings.remove(oldSettingName);
|
||||
} else if (settings.contains(key)) {
|
||||
data = settings.value(key).toByteArray();
|
||||
}
|
||||
|
||||
if (!data.isEmpty()) {
|
||||
view->restoreState(data);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::dropEvent(QDropEvent *event)
|
||||
{
|
||||
Qt::DropAction action = event->proposedAction();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user