mirror of
https://github.com/ModOrganizer2/modorganizer.git
synced 2026-07-27 13:58:24 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
886fb10288 | ||
|
|
693f3c40ee | ||
|
|
26b946a905 | ||
|
|
11aa955d73 | ||
|
|
2486c554a0 | ||
|
|
5e6bb0a16e | ||
|
|
632474ef97 | ||
|
|
0da6af17b2 | ||
|
|
44111d12c1 | ||
|
|
02d3f81829 | ||
|
|
fc74aa90d1 | ||
|
|
7d9514d497 | ||
|
|
6359d7d23f | ||
|
|
5f8bbaae2a | ||
|
|
fe33d7af43 | ||
|
|
9ae442810b | ||
|
|
9998727dba | ||
|
|
a76d987647 | ||
|
|
a29192f9b2 | ||
|
|
a77433f881 | ||
|
|
54e2197592 | ||
|
|
0d7460996a | ||
|
|
d9b1cfdb4b | ||
|
|
98b659f0da | ||
|
|
979c09b334 | ||
|
|
cf5833437d | ||
|
|
0eaa1c6791 | ||
|
|
fa193ddabb | ||
|
|
cc32c8c06b | ||
|
|
9872c1e462 | ||
|
|
e3989fe8f9 | ||
|
|
f7c9b8c333 | ||
|
|
5555a58f84 | ||
|
|
6588a81b7f | ||
|
|
2091330af2 | ||
|
|
168da18aa5 | ||
|
|
4245036f52 | ||
|
|
238c252b4c | ||
|
|
938d3ce91b | ||
|
|
d62ec9c867 | ||
|
|
3bb7a44610 | ||
|
|
4bf7b4e103 | ||
|
|
d3c207193f | ||
|
|
584c6049f9 | ||
|
|
2b7274380e | ||
|
|
275afb730f | ||
|
|
0306b0fc42 | ||
|
|
86c97c7c06 | ||
|
|
3114bcbd8d | ||
|
|
41a479bddf | ||
|
|
e02614ee14 | ||
|
|
cfbe399bba | ||
|
|
10b8d12152 | ||
|
|
b3ef185866 | ||
|
|
18328587b5 | ||
|
|
31bf15f3b4 | ||
|
|
001fddb069 | ||
|
|
141ac311d2 | ||
|
|
fbb93eaf86 | ||
|
|
7e04542762 | ||
|
|
08b56ee783 | ||
|
|
85faed5de1 | ||
|
|
189445191d | ||
|
|
618fd543a6 | ||
|
|
f276203517 | ||
|
|
b64fd1ed4d | ||
|
|
b1329c18cd | ||
|
|
62dc387de6 | ||
|
|
fc46a6a782 | ||
|
|
a2d7ce67aa | ||
|
|
a14ed8fcd1 | ||
|
|
c669fed48a | ||
|
|
634825e1b8 | ||
|
|
7688175c68 | ||
|
|
b4eae6e5d1 | ||
|
|
b1c477f8ec | ||
|
|
8b3a83ed8d | ||
|
|
332cdc155a | ||
|
|
30c177cb37 | ||
|
|
ae4e4f9df8 | ||
|
|
dd24b60895 | ||
|
|
fa104b342f | ||
|
|
cc2c4cc918 | ||
|
|
978d71bb43 | ||
|
|
25b6fe1471 | ||
|
|
6b5680f6e4 |
+4
-7
@@ -2,17 +2,14 @@
|
||||
Thumbs.db
|
||||
src/moc_*.cpp
|
||||
src/ui_*.h
|
||||
src/organizer_en.ts
|
||||
src/*.qrc.depends
|
||||
src/Modorganizer.*
|
||||
src/*.bak
|
||||
CMakeLists.txt.user
|
||||
edit
|
||||
stderr.log
|
||||
stdout.log
|
||||
vs_stderr.log
|
||||
vs_stdout.log
|
||||
build
|
||||
/vsbuild
|
||||
/CMakeFiles
|
||||
.idea
|
||||
/msbuild.log
|
||||
/*std*.log
|
||||
/*build
|
||||
|
||||
|
||||
+25
-17
@@ -30,6 +30,7 @@ SET(organizer_SRCS
|
||||
motddialog.cpp
|
||||
modlistsortproxy.cpp
|
||||
modlist.cpp
|
||||
modidlineedit.cpp
|
||||
modinfodialog.cpp
|
||||
modinfo.cpp
|
||||
modinfobackup.cpp
|
||||
@@ -120,6 +121,7 @@ SET(organizer_HDRS
|
||||
motddialog.h
|
||||
modlistsortproxy.h
|
||||
modlist.h
|
||||
modidlineedit.h
|
||||
modinfodialog.h
|
||||
modinfo.h
|
||||
modinfobackup.h
|
||||
@@ -238,6 +240,13 @@ SOURCE_GROUP(Source FILES ${organizer_SRCS})
|
||||
SOURCE_GROUP(Headers FILES ${organizer_HDRS})
|
||||
SOURCE_GROUP(UI FILES ${organizer_UIS})
|
||||
|
||||
# MO projects
|
||||
SET(default_project_path "${CMAKE_SOURCE_DIR}/..")
|
||||
GET_FILENAME_COMPONENT(${default_project_path} ${default_project_path} REALPATH)
|
||||
|
||||
SET(project_path "${default_project_path}" CACHE PATH "path to the other mo projects")
|
||||
#TODO this should not be a hardcoded path
|
||||
SET(lib_path "${project_path}/../../install/libs")
|
||||
|
||||
# Qt5
|
||||
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
@@ -249,12 +258,12 @@ FIND_PACKAGE(Qt5Quick REQUIRED)
|
||||
FIND_PACKAGE(Qt5Network REQUIRED)
|
||||
FIND_PACKAGE(Qt5WinExtras REQUIRED)
|
||||
FIND_PACKAGE(Qt5WebEngineWidgets REQUIRED)
|
||||
FIND_PACKAGE(Qt5Script REQUIRED)
|
||||
FIND_PACKAGE(Qt5Qml 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)
|
||||
SET(mo_translation_sources ${CMAKE_SOURCE_DIR}/src ${project_path}/uibase/src)
|
||||
QT5_CREATE_TRANSLATION(organizer_translations_qm ${mo_translation_sources} ${CMAKE_SOURCE_DIR}/src/organizer_en.ts)
|
||||
ADD_CUSTOM_TARGET(translations DEPENDS ${organizer_translations_qm})
|
||||
|
||||
INCLUDE_DIRECTORIES(${Qt5Declarative_INCLUDES})
|
||||
@@ -274,16 +283,6 @@ LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
|
||||
FIND_PACKAGE(zlib REQUIRED)
|
||||
# TODO FindZlib doesn't find the static zlib library
|
||||
|
||||
|
||||
# MO projects
|
||||
SET(default_project_path "${CMAKE_SOURCE_DIR}/..")
|
||||
GET_FILENAME_COMPONENT(${default_project_path} ${default_project_path} REALPATH)
|
||||
|
||||
SET(project_path "${default_project_path}" CACHE PATH "path to the other mo projects")
|
||||
#TODO this should not be a hardcoded path
|
||||
SET(lib_path "${project_path}/../../install/libs")
|
||||
|
||||
|
||||
INCLUDE_DIRECTORIES(${project_path}/uibase/src
|
||||
${project_path}/bsatk/src
|
||||
${project_path}/esptk/src
|
||||
@@ -316,18 +315,27 @@ ENDIF()
|
||||
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::WebEngineWidgets Qt5::Quick
|
||||
Qt5::Script Qt5::Qml Qt5::QuickWidgets Qt5::Network
|
||||
Qt5::Qml Qt5::QuickWidgets Qt5::Network
|
||||
${Boost_LIBRARIES}
|
||||
zlibstatic
|
||||
uibase esptk bsatk githubpp
|
||||
${usvfs_name}
|
||||
Dbghelp advapi32 Version Shlwapi liblz4)
|
||||
|
||||
IF (MSVC)
|
||||
SET_TARGET_PROPERTIES(ModOrganizer PROPERTIES COMPILE_FLAGS "/std:c++latest")
|
||||
ENDIF()
|
||||
IF (MSVC AND "${CMAKE_SIZEOF_VOID_P}" EQUAL 4)
|
||||
# 32 bits
|
||||
SET_TARGET_PROPERTIES(ModOrganizer PROPERTIES LINK_FLAGS "/LARGEADDRESSAWARE")
|
||||
ENDIF()
|
||||
|
||||
IF (NOT "${OPTIMIZE_COMPILE_FLAGS}" STREQUAL "")
|
||||
SET_TARGET_PROPERTIES(ModOrganizer PROPERTIES COMPILE_FLAGS_RELWITHDEBINFO
|
||||
${OPTIMIZE_COMPILE_FLAGS})
|
||||
SET_TARGET_PROPERTIES(ModOrganizer PROPERTIES COMPILE_FLAGS_RELWITHDEBINFO ${OPTIMIZE_COMPILE_FLAGS})
|
||||
ENDIF()
|
||||
IF (NOT "${OPTIMIZE_LINK_FLAGS}" STREQUAL "")
|
||||
SET_TARGET_PROPERTIES(ModOrganizer PROPERTIES LINK_FLAGS_RELWITHDEBINFO ${OPTIMIZE_LINK_FLAGS})
|
||||
ENDIF()
|
||||
SET_TARGET_PROPERTIES(ModOrganizer PROPERTIES LINK_FLAGS_RELWITHDEBINFO
|
||||
"/LARGEADDRESSAWARE ${OPTIMIZE_LINK_FLAGS}")
|
||||
|
||||
|
||||
###############
|
||||
|
||||
@@ -114,3 +114,8 @@ void AboutDialog::on_creditsList_currentItemChanged(QListWidgetItem *current, QL
|
||||
ui->licenseText->setText(tr("No license"));
|
||||
}
|
||||
}
|
||||
|
||||
void AboutDialog::on_copyrightText_linkActivated(const QString &link)
|
||||
{
|
||||
emit linkClicked(link);
|
||||
}
|
||||
@@ -40,6 +40,10 @@ public:
|
||||
explicit AboutDialog(const QString &version, QWidget *parent = 0);
|
||||
~AboutDialog();
|
||||
|
||||
signals:
|
||||
|
||||
void linkClicked(QString link);
|
||||
|
||||
private:
|
||||
|
||||
enum Licenses {
|
||||
@@ -70,6 +74,7 @@ private:
|
||||
|
||||
private slots:
|
||||
void on_creditsList_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
|
||||
void on_copyrightText_linkActivated(const QString &link);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
+39
-13
@@ -125,7 +125,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<widget class="QLabel" name="copyrightText">
|
||||
<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><p>Source code can be found at <a href="https://github.com/Modorganizer2/modorganizer"><span style=" text-decoration: underline; color:#007af4;">GitHub</span></a>.</p></body></html></string>
|
||||
</property>
|
||||
@@ -153,8 +153,8 @@
|
||||
<attribute name="title">
|
||||
<string>Thanks</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_0">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Current Maintainers</string>
|
||||
@@ -167,12 +167,12 @@
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">LePresidente (Project Lead)</string>
|
||||
<string>LePresidente (Project Lead)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>AL12</string>
|
||||
<string notr="true">AL12</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
@@ -195,8 +195,29 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Major Contributors</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7" stretch="0">
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget_2">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">AnyOldName3 (Python Plugins)</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" rowspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Translators</string>
|
||||
</property>
|
||||
@@ -317,8 +338,8 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<item row="0" column="2" rowspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>Other Supporters && Contributors</string>
|
||||
</property>
|
||||
@@ -328,11 +349,6 @@
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">AnyOldName3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">blacksol</string>
|
||||
@@ -368,6 +384,11 @@
|
||||
<string notr="true">Gopher</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">GrantSP</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">GSDFan</string>
|
||||
@@ -378,6 +399,11 @@
|
||||
<string notr="true">ogrotten</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">outdatedtv</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">Schilduin</string>
|
||||
|
||||
@@ -173,13 +173,13 @@ void BrowserDialog::titleChanged(const QString &title)
|
||||
|
||||
QString BrowserDialog::guessFileName(const QString &url)
|
||||
{
|
||||
QRegExp uploadsExp(QString("http://.+/uploads/([^/]+)$"));
|
||||
QRegExp uploadsExp(QString("https://.+/uploads/([^/]+)$"));
|
||||
if (uploadsExp.indexIn(url) != -1) {
|
||||
// these seem to be premium downloads
|
||||
return uploadsExp.cap(1);
|
||||
}
|
||||
|
||||
QRegExp filesExp(QString("http://.+\\?file=([^&]+)"));
|
||||
QRegExp filesExp(QString("https://.+\\?file=([^&]+)"));
|
||||
if (filesExp.indexIn(url) != -1) {
|
||||
// a regular manual download?
|
||||
return filesExp.cap(1);
|
||||
|
||||
@@ -53,6 +53,7 @@ DownloadListWidgetDelegate::DownloadListWidgetDelegate(DownloadManager *manager,
|
||||
m_InstallLabel = m_ItemWidget->findChild<QLabel*>("installLabel");
|
||||
|
||||
m_InstallLabel->setVisible(false);
|
||||
m_Progress->setTextVisible(true);
|
||||
|
||||
connect(manager, SIGNAL(stateChanged(int,DownloadManager::DownloadState)), this, SLOT(stateChanged(int,DownloadManager::DownloadState)));
|
||||
connect(manager, SIGNAL(downloadRemoved(int)), this, SLOT(resetCache(int)));
|
||||
@@ -88,8 +89,8 @@ void DownloadListWidgetDelegate::drawCache(QPainter *painter, const QStyleOption
|
||||
|
||||
void DownloadListWidgetDelegate::paintPendingDownload(int downloadIndex) const
|
||||
{
|
||||
std::pair<int, int> nexusids = m_Manager->getPendingDownload(downloadIndex);
|
||||
m_NameLabel->setText(tr("< mod %1 file %2 >").arg(nexusids.first).arg(nexusids.second));
|
||||
std::tuple<QString, int, int> nexusids = m_Manager->getPendingDownload(downloadIndex);
|
||||
m_NameLabel->setText(tr("< game %1 mod %2 file %3 >").arg(std::get<0>(nexusids)).arg(std::get<1>(nexusids)).arg(std::get<2>(nexusids)));
|
||||
m_SizeLabel->setText("???");
|
||||
m_InstallLabel->setVisible(true);
|
||||
m_InstallLabel->setText(tr("Pending"));
|
||||
@@ -159,7 +160,8 @@ void DownloadListWidgetDelegate::paintRegularDownload(int downloadIndex) const
|
||||
} else {
|
||||
m_InstallLabel->setVisible(false);
|
||||
m_Progress->setVisible(true);
|
||||
m_Progress->setValue(m_Manager->getProgress(downloadIndex));
|
||||
m_Progress->setValue(m_Manager->getProgress(downloadIndex).first);
|
||||
m_Progress->setFormat(m_Manager->getProgress(downloadIndex).second);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -88,8 +88,8 @@ void DownloadListWidgetCompactDelegate::drawCache(QPainter *painter, const QStyl
|
||||
|
||||
void DownloadListWidgetCompactDelegate::paintPendingDownload(int downloadIndex) const
|
||||
{
|
||||
std::pair<int, int> nexusids = m_Manager->getPendingDownload(downloadIndex);
|
||||
m_NameLabel->setText(tr("< mod %1 file %2 >").arg(nexusids.first).arg(nexusids.second));
|
||||
std::tuple<QString, int, int> nexusids = m_Manager->getPendingDownload(downloadIndex);
|
||||
m_NameLabel->setText(tr("< game %1 mod %2 file %3 >").arg(std::get<0>(nexusids)).arg(std::get<1>(nexusids)).arg(std::get<2>(nexusids)));
|
||||
if (m_SizeLabel != nullptr) {
|
||||
m_SizeLabel->setText("???");
|
||||
}
|
||||
@@ -138,7 +138,8 @@ void DownloadListWidgetCompactDelegate::paintRegularDownload(int downloadIndex)
|
||||
} else {
|
||||
m_DoneLabel->setVisible(false);
|
||||
m_Progress->setVisible(true);
|
||||
m_Progress->setValue(m_Manager->getProgress(downloadIndex));
|
||||
m_Progress->setValue(m_Manager->getProgress(downloadIndex).first);
|
||||
m_Progress->setFormat(m_Manager->getProgress(downloadIndex).second);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+180
-82
File diff suppressed because it is too large
Load Diff
+28
-16
@@ -38,6 +38,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
namespace MOBase { class IPluginGame; }
|
||||
|
||||
class NexusInterface;
|
||||
class PluginContainer;
|
||||
|
||||
/*!
|
||||
* \brief manages downloading of files and provides progress information for gui elements
|
||||
@@ -74,7 +75,8 @@ private:
|
||||
QNetworkReply *m_Reply;
|
||||
QTime m_StartTime;
|
||||
qint64 m_PreResumeSize;
|
||||
int m_Progress;
|
||||
std::pair<int, QString> m_Progress;
|
||||
std::tuple<int, int, int, int, int> m_SpeedDiff;
|
||||
DownloadState m_State;
|
||||
int m_CurrentUrl;
|
||||
QStringList m_Urls;
|
||||
@@ -92,7 +94,7 @@ private:
|
||||
bool m_Hidden;
|
||||
|
||||
static DownloadInfo *createNew(const MOBase::ModRepositoryFileInfo *fileInfo, const QStringList &URLs);
|
||||
static DownloadInfo *createFromMeta(const QString &filePath, bool showHidden);
|
||||
static DownloadInfo *createFromMeta(const QString &filePath, bool showHidden, const QString outputDirectory);
|
||||
|
||||
/**
|
||||
* @brief rename the file
|
||||
@@ -112,7 +114,7 @@ private:
|
||||
private:
|
||||
static unsigned int s_NextDownloadID;
|
||||
private:
|
||||
DownloadInfo() : m_TotalSize(0), m_ReQueried(false), m_Hidden(false) {}
|
||||
DownloadInfo() : m_TotalSize(0), m_ReQueried(false), m_Hidden(false), m_SpeedDiff(std::tuple<int,int,int,int,int>(0,0,0,0,0)) {}
|
||||
};
|
||||
|
||||
public:
|
||||
@@ -162,6 +164,8 @@ public:
|
||||
*/
|
||||
void setShowHidden(bool showHidden);
|
||||
|
||||
void setPluginContainer(PluginContainer *pluginContainer);
|
||||
|
||||
/**
|
||||
* @brief download from an already open network connection
|
||||
*
|
||||
@@ -179,7 +183,7 @@ public:
|
||||
* @param fileInfo information previously retrieved from the nexus network
|
||||
* @return true if the download was started, false if it wasn't. The latter currently only happens if there is a duplicate and the user decides not to download again
|
||||
**/
|
||||
bool addDownload(QNetworkReply *reply, const QStringList &URLs, const QString &fileName, int modID, int fileID = 0, const MOBase::ModRepositoryFileInfo *fileInfo = new MOBase::ModRepositoryFileInfo());
|
||||
bool addDownload(QNetworkReply *reply, const QStringList &URLs, const QString &fileName, QString gameName, int modID, int fileID = 0, const MOBase::ModRepositoryFileInfo *fileInfo = new MOBase::ModRepositoryFileInfo());
|
||||
|
||||
/**
|
||||
* @brief start a download using a nxm-link
|
||||
@@ -209,7 +213,7 @@ public:
|
||||
* @param index index of the pending download (index in the range [0, numPendingDownloads()[)
|
||||
* @return pair of modid, fileid
|
||||
*/
|
||||
std::pair<int, int> getPendingDownload(int index);
|
||||
std::tuple<QString, int, int> getPendingDownload(int index);
|
||||
|
||||
/**
|
||||
* @brief retrieve the full path to the download specified by index
|
||||
@@ -256,7 +260,7 @@ public:
|
||||
* @param index index of the file to look up
|
||||
* @return progress of the download in percent (integer)
|
||||
**/
|
||||
int getProgress(int index) const;
|
||||
std::pair<int, QString> getProgress(int index) const;
|
||||
|
||||
/**
|
||||
* @brief retrieve the current state of the download
|
||||
@@ -285,6 +289,14 @@ public:
|
||||
**/
|
||||
int getModID(int index) const;
|
||||
|
||||
/**
|
||||
* @brief retrieve the game name of the downlaod specified by the index
|
||||
*
|
||||
* @param index index of the file to look up
|
||||
* @return the game name
|
||||
**/
|
||||
QString getGameName(int index) const;
|
||||
|
||||
/**
|
||||
* @brief determine if the specified file is supposed to be hidden
|
||||
* @param index index of the file to look up
|
||||
@@ -411,15 +423,15 @@ public slots:
|
||||
|
||||
void queryInfo(int index);
|
||||
|
||||
void nxmDescriptionAvailable(int modID, QVariant userData, QVariant resultData, int requestID);
|
||||
void nxmDescriptionAvailable(QString gameName, int modID, QVariant userData, QVariant resultData, int requestID);
|
||||
|
||||
void nxmFilesAvailable(int modID, QVariant userData, QVariant resultData, int requestID);
|
||||
void nxmFilesAvailable(QString gameName, int modID, QVariant userData, QVariant resultData, int requestID);
|
||||
|
||||
void nxmFileInfoAvailable(int modID, int fileID, QVariant userData, QVariant resultData, int requestID);
|
||||
void nxmFileInfoAvailable(QString gameName, int modID, int fileID, QVariant userData, QVariant resultData, int requestID);
|
||||
|
||||
void nxmDownloadURLsAvailable(int modID, int fileID, QVariant userData, QVariant resultData, int requestID);
|
||||
void nxmDownloadURLsAvailable(QString gameName, int modID, int fileID, QVariant userData, QVariant resultData, int requestID);
|
||||
|
||||
void nxmRequestFailed(int modID, int fileID, QVariant userData, int requestID, const QString &errorString);
|
||||
void nxmRequestFailed(QString gameName, int modID, int fileID, QVariant userData, int requestID, const QString &errorString);
|
||||
|
||||
void managedGameChanged(MOBase::IPluginGame const *gamePlugin);
|
||||
|
||||
@@ -427,7 +439,7 @@ private slots:
|
||||
|
||||
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
|
||||
void downloadReadyRead();
|
||||
void downloadFinished();
|
||||
void downloadFinished(int index = 0);
|
||||
void downloadError(QNetworkReply::NetworkError error);
|
||||
void metaDataChanged();
|
||||
void directoryChanged(const QString &dirctory);
|
||||
@@ -448,7 +460,7 @@ public:
|
||||
*
|
||||
* @return Unique(ish) name
|
||||
*/
|
||||
QString getDownloadFileName(const QString &baseName) const;
|
||||
QString getDownloadFileName(const QString &baseName, bool rename = false) const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -462,7 +474,7 @@ private:
|
||||
* @param fileInfo information previously retrieved from the mod page
|
||||
* @return true if the download was started, false if it wasn't. The latter currently only happens if there is a duplicate and the user decides not to download again
|
||||
**/
|
||||
bool addDownload(const QStringList &URLs, int modID, int fileID, const MOBase::ModRepositoryFileInfo *fileInfo);
|
||||
bool addDownload(const QStringList &URLs, QString gameName, int modID, int fileID, const MOBase::ModRepositoryFileInfo *fileInfo);
|
||||
|
||||
// important: the caller has to lock the list-mutex, otherwise the DownloadInfo-pointer might get invalidated at any time
|
||||
DownloadInfo *findDownload(QObject *reply, int *index = nullptr) const;
|
||||
@@ -481,7 +493,7 @@ private:
|
||||
|
||||
QDateTime matchDate(const QString &timeString);
|
||||
|
||||
void removePending(int modID, int fileID);
|
||||
void removePending(QString gameName, int modID, int fileID);
|
||||
|
||||
static QString getFileTypeString(int fileType);
|
||||
|
||||
@@ -493,7 +505,7 @@ private:
|
||||
|
||||
NexusInterface *m_NexusInterface;
|
||||
|
||||
QVector<std::pair<int, int> > m_PendingDownloads;
|
||||
QVector<std::tuple<QString, int, int>> m_PendingDownloads;
|
||||
|
||||
QVector<DownloadInfo*> m_ActiveDownloads;
|
||||
|
||||
|
||||
+62
-21
@@ -49,6 +49,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include <QDirIterator>
|
||||
#include <QDebug>
|
||||
#include <QTextDocument>
|
||||
#include <QtConcurrent/QtConcurrentRun>
|
||||
|
||||
#include <Shellapi.h>
|
||||
|
||||
@@ -181,6 +182,7 @@ bool InstallationManager::unpackSingleFile(const QString &fileName)
|
||||
m_InstallationProgress->hide();
|
||||
m_InstallationProgress->deleteLater();
|
||||
m_InstallationProgress = nullptr;
|
||||
m_Progress = 0;
|
||||
});
|
||||
m_InstallationProgress->setWindowFlags(
|
||||
m_InstallationProgress->windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
@@ -190,10 +192,20 @@ bool InstallationManager::unpackSingleFile(const QString &fileName)
|
||||
m_InstallationProgress->setFixedSize(600, 100);
|
||||
m_InstallationProgress->show();
|
||||
|
||||
bool res = m_ArchiveHandler->extract(QDir::tempPath(),
|
||||
new MethodCallback<InstallationManager, void, float>(this, &InstallationManager::updateProgress),
|
||||
nullptr,
|
||||
new MethodCallback<InstallationManager, void, QString const &>(this, &InstallationManager::report7ZipError));
|
||||
QFuture<bool> future = QtConcurrent::run([&]() -> bool {
|
||||
return m_ArchiveHandler->extract(
|
||||
QDir::tempPath(),
|
||||
new MethodCallback<InstallationManager, void, float>(this, &InstallationManager::updateProgress),
|
||||
nullptr,
|
||||
new MethodCallback<InstallationManager, void, QString const &>(this, &InstallationManager::report7ZipError)
|
||||
);
|
||||
});
|
||||
do {
|
||||
if (m_Progress != m_InstallationProgress->value())
|
||||
m_InstallationProgress->setValue(m_Progress);
|
||||
QCoreApplication::processEvents();
|
||||
} while (!future.isFinished() || m_InstallationProgress->isVisible());
|
||||
bool res = future.result();
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -270,6 +282,7 @@ QStringList InstallationManager::extractFiles(const QStringList &filesOrig, bool
|
||||
m_InstallationProgress->hide();
|
||||
m_InstallationProgress->deleteLater();
|
||||
m_InstallationProgress = nullptr;
|
||||
m_Progress = 0;
|
||||
});
|
||||
m_InstallationProgress->setWindowFlags(
|
||||
m_InstallationProgress->windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||
@@ -279,10 +292,20 @@ QStringList InstallationManager::extractFiles(const QStringList &filesOrig, bool
|
||||
m_InstallationProgress->show();
|
||||
|
||||
// unpack only the files we need for the installer
|
||||
if (!m_ArchiveHandler->extract(QDir::tempPath(),
|
||||
new MethodCallback<InstallationManager, void, float>(this, &InstallationManager::updateProgress),
|
||||
nullptr,
|
||||
new MethodCallback<InstallationManager, void, QString const &>(this, &InstallationManager::report7ZipError))) {
|
||||
QFuture<bool> future = QtConcurrent::run([&]() -> bool {
|
||||
return m_ArchiveHandler->extract(
|
||||
QDir::tempPath(),
|
||||
new MethodCallback<InstallationManager, void, float>(this, &InstallationManager::updateProgress),
|
||||
nullptr,
|
||||
new MethodCallback<InstallationManager, void, QString const &>(this, &InstallationManager::report7ZipError)
|
||||
);
|
||||
});
|
||||
do {
|
||||
if (m_Progress != m_InstallationProgress->value())
|
||||
m_InstallationProgress->setValue(m_Progress);
|
||||
QCoreApplication::processEvents();
|
||||
} while (!future.isFinished() || m_InstallationProgress->isVisible());
|
||||
if (!future.result()) {
|
||||
throw MyException(QString("extracting failed (%1)").arg(m_ArchiveHandler->getLastError()));
|
||||
}
|
||||
|
||||
@@ -410,7 +433,8 @@ DirectoryTree::Node *InstallationManager::getSimpleArchiveBase(DirectoryTree *da
|
||||
void InstallationManager::updateProgress(float percentage)
|
||||
{
|
||||
if (m_InstallationProgress != nullptr) {
|
||||
m_InstallationProgress->setValue(static_cast<int>(percentage * 100.0));
|
||||
m_Progress = static_cast<int>(percentage * 100.0);
|
||||
|
||||
if (m_InstallationProgress->wasCanceled()) {
|
||||
m_ArchiveHandler->cancel();
|
||||
m_InstallationProgress->reset();
|
||||
@@ -421,10 +445,7 @@ void InstallationManager::updateProgress(float percentage)
|
||||
|
||||
void InstallationManager::updateProgressFile(QString const &fileName)
|
||||
{
|
||||
if (m_InstallationProgress != nullptr) {
|
||||
m_InstallationProgress->setLabelText(fileName);
|
||||
QCoreApplication::processEvents();
|
||||
}
|
||||
m_ProgressFile = fileName;
|
||||
}
|
||||
|
||||
|
||||
@@ -537,7 +558,7 @@ bool InstallationManager::ensureValidModName(GuessedValue<QString> &name) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InstallationManager::doInstall(GuessedValue<QString> &modName, int modID,
|
||||
bool InstallationManager::doInstall(GuessedValue<QString> &modName, QString gameName, int modID,
|
||||
const QString &version, const QString &newestVersion,
|
||||
int categoryID, const QString &repository)
|
||||
{
|
||||
@@ -561,6 +582,8 @@ bool InstallationManager::doInstall(GuessedValue<QString> &modName, int modID,
|
||||
m_InstallationProgress->hide();
|
||||
m_InstallationProgress->deleteLater();
|
||||
m_InstallationProgress = nullptr;
|
||||
m_Progress = 0;
|
||||
m_ProgressFile = QString();
|
||||
});
|
||||
|
||||
m_InstallationProgress->setWindowFlags(
|
||||
@@ -568,10 +591,22 @@ bool InstallationManager::doInstall(GuessedValue<QString> &modName, int modID,
|
||||
m_InstallationProgress->setWindowModality(Qt::WindowModal);
|
||||
m_InstallationProgress->setFixedSize(600, 100);
|
||||
m_InstallationProgress->show();
|
||||
if (!m_ArchiveHandler->extract(targetDirectory,
|
||||
new MethodCallback<InstallationManager, void, float>(this, &InstallationManager::updateProgress),
|
||||
new MethodCallback<InstallationManager, void, QString const &>(this, &InstallationManager::updateProgressFile),
|
||||
new MethodCallback<InstallationManager, void, QString const &>(this, &InstallationManager::report7ZipError))) {
|
||||
QFuture<bool> future = QtConcurrent::run([&]() -> bool {
|
||||
return m_ArchiveHandler->extract(
|
||||
targetDirectory,
|
||||
new MethodCallback<InstallationManager, void, float>(this, &InstallationManager::updateProgress),
|
||||
new MethodCallback<InstallationManager, void, QString const &>(this, &InstallationManager::updateProgressFile),
|
||||
new MethodCallback<InstallationManager, void, QString const &>(this, &InstallationManager::report7ZipError)
|
||||
);
|
||||
});
|
||||
do {
|
||||
if (m_Progress != m_InstallationProgress->value())
|
||||
m_InstallationProgress->setValue(m_Progress);
|
||||
if (m_ProgressFile != m_InstallationProgress->labelText())
|
||||
m_InstallationProgress->setLabelText(m_ProgressFile);
|
||||
QCoreApplication::processEvents();
|
||||
} while (!future.isFinished());
|
||||
if (!future.result()) {
|
||||
if (m_ArchiveHandler->getLastError() == Archive::ERROR_EXTRACT_CANCELLED) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -582,6 +617,9 @@ bool InstallationManager::doInstall(GuessedValue<QString> &modName, int modID,
|
||||
QSettings settingsFile(targetDirectory + "/meta.ini", QSettings::IniFormat);
|
||||
|
||||
// overwrite settings only if they are actually are available or haven't been set before
|
||||
if ((gameName != "") || !settingsFile.contains("gameName")) {
|
||||
settingsFile.setValue("gameName", gameName);
|
||||
}
|
||||
if ((modID != 0) || !settingsFile.contains("modid")) {
|
||||
settingsFile.setValue("modid", modID);
|
||||
}
|
||||
@@ -662,6 +700,7 @@ bool InstallationManager::install(const QString &fileName,
|
||||
modName.update(QFileInfo(fileName).completeBaseName(), GUESS_FALLBACK);
|
||||
|
||||
// read out meta information from the download if available
|
||||
QString gameName = "";
|
||||
int modID = 0;
|
||||
QString version = "";
|
||||
QString newestVersion = "";
|
||||
@@ -671,6 +710,7 @@ bool InstallationManager::install(const QString &fileName,
|
||||
QString metaName = fileName + ".meta";
|
||||
if (QFile(metaName).exists()) {
|
||||
QSettings metaFile(metaName, QSettings::IniFormat);
|
||||
gameName = metaFile.value("gameName", "").toString();
|
||||
modID = metaFile.value("modID", 0).toInt();
|
||||
QTextDocument doc;
|
||||
doc.setHtml(metaFile.value("name", "").toString());
|
||||
@@ -759,7 +799,7 @@ bool InstallationManager::install(const QString &fileName,
|
||||
mapToArchive(filesTree.data());
|
||||
// the simple installer only prepares the installation, the rest
|
||||
// works the same for all installers
|
||||
if (!doInstall(modName, modID, version, newestVersion, categoryID,
|
||||
if (!doInstall(modName, gameName, modID, version, newestVersion, categoryID,
|
||||
repository)) {
|
||||
installResult = IPluginInstaller::RESULT_FAILED;
|
||||
}
|
||||
@@ -779,7 +819,7 @@ bool InstallationManager::install(const QString &fileName,
|
||||
= installerCustom->supportedExtensions();
|
||||
if (installerExt.find(fileInfo.suffix()) != installerExt.end()) {
|
||||
installResult
|
||||
= installerCustom->install(modName, fileName, version, modID);
|
||||
= installerCustom->install(modName, gameName, fileName, version, modID);
|
||||
unsigned int idx = ModInfo::getIndex(modName);
|
||||
if (idx != UINT_MAX) {
|
||||
ModInfo::Ptr info = ModInfo::getByIndex(idx);
|
||||
@@ -814,7 +854,8 @@ bool InstallationManager::install(const QString &fileName,
|
||||
}
|
||||
}
|
||||
|
||||
reportError(tr("None of the available installer plugins were able to handle that archive"));
|
||||
reportError(tr("None of the available installer plugins were able to handle that archive.\n"
|
||||
"This is likely due to a corrupted or incompatible download or unrecognized archive format."));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ private:
|
||||
bool isSimpleArchiveTopLayer(const MOBase::DirectoryTree::Node *node, bool bainStyle);
|
||||
MOBase::DirectoryTree::Node *getSimpleArchiveBase(MOBase::DirectoryTree *dataTree);
|
||||
|
||||
bool doInstall(MOBase::GuessedValue<QString> &modName,
|
||||
bool doInstall(MOBase::GuessedValue<QString> &modName, QString gameName,
|
||||
int modID, const QString &version, const QString &newestVersion, int categoryID, const QString &repository);
|
||||
|
||||
QString generateBackupName(const QString &directoryName) const;
|
||||
@@ -177,6 +177,11 @@ private:
|
||||
|
||||
void postInstallCleanup();
|
||||
|
||||
signals:
|
||||
|
||||
void progressUpdate(float percentage);
|
||||
void progressUpdate(QString const fileName);
|
||||
|
||||
private:
|
||||
|
||||
struct ByPriority {
|
||||
@@ -207,6 +212,8 @@ private:
|
||||
QString m_CurrentFile;
|
||||
|
||||
QProgressDialog *m_InstallationProgress { nullptr };
|
||||
int m_Progress;
|
||||
QString m_ProgressFile;
|
||||
|
||||
std::set<QString> m_TempFilesToDelete;
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ void LoadMechanism::deactivateScriptExtender()
|
||||
IPluginGame const *game = qApp->property("managed_game").value<IPluginGame*>();
|
||||
ScriptExtender *extender = game->feature<ScriptExtender>();
|
||||
if (extender == nullptr) {
|
||||
throw MyException(QObject::tr("game doesn't support a script extender"));
|
||||
return;
|
||||
}
|
||||
|
||||
QDir pluginsDir(game->gameDirectory().absolutePath() + "/data/" + extender->PluginPath());
|
||||
@@ -193,7 +193,7 @@ void LoadMechanism::activateScriptExtender()
|
||||
IPluginGame const *game = qApp->property("managed_game").value<IPluginGame *>();
|
||||
ScriptExtender *extender = game->feature<ScriptExtender>();
|
||||
if (extender == nullptr) {
|
||||
throw MyException(QObject::tr("game doesn't support a script extender"));
|
||||
return;
|
||||
}
|
||||
|
||||
QDir pluginsDir(game->gameDirectory().absolutePath() + "/data/" + extender->PluginPath());
|
||||
|
||||
+9
-1
@@ -46,6 +46,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "nxmaccessmanager.h"
|
||||
#include "instancemanager.h"
|
||||
#include "moshortcut.h"
|
||||
#include "organizercore.h"
|
||||
|
||||
#include <eh.h>
|
||||
#include <windows_error.h>
|
||||
@@ -71,6 +72,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include <QDesktopServices>
|
||||
#include <QLibraryInfo>
|
||||
#include <QSslSocket>
|
||||
#include <QtPlatformHeaders/QWindowsWindowFunctions>
|
||||
|
||||
#include <boost/scoped_array.hpp>
|
||||
|
||||
@@ -480,6 +482,8 @@ int runApplication(MOApplication &application, SingleInstance &instance,
|
||||
return 1;
|
||||
}
|
||||
|
||||
QWindowsWindowFunctions::setWindowActivationBehavior(QWindowsWindowFunctions::AlwaysActivateWindow);
|
||||
|
||||
QStringList arguments = application.arguments();
|
||||
|
||||
try {
|
||||
@@ -538,6 +542,7 @@ int runApplication(MOApplication &application, SingleInstance &instance,
|
||||
"start the game correctly if this is set "
|
||||
"incorrectly!)"),
|
||||
nullptr);
|
||||
selection.setWindowFlag(Qt::WindowStaysOnTopHint, true);
|
||||
int index = 0;
|
||||
for (const QString &edition : editions) {
|
||||
selection.addChoice(edition, "", index++);
|
||||
@@ -601,8 +606,9 @@ int runApplication(MOApplication &application, SingleInstance &instance,
|
||||
QPixmap pixmap(splashPath);
|
||||
QSplashScreen splash(pixmap);
|
||||
splash.show();
|
||||
splash.activateWindow();
|
||||
|
||||
NexusInterface::instance()->getAccessManager()->startLoginCheck();
|
||||
NexusInterface::instance(&pluginContainer)->getAccessManager()->startLoginCheck();
|
||||
|
||||
qDebug("initializing tutorials");
|
||||
TutorialManager::init(
|
||||
@@ -625,10 +631,12 @@ int runApplication(MOApplication &application, SingleInstance &instance,
|
||||
QObject::connect(&instance, SIGNAL(messageSent(QString)), &organizer,
|
||||
SLOT(externalMessage(QString)));
|
||||
|
||||
mainWindow.processUpdates();
|
||||
mainWindow.readSettings();
|
||||
|
||||
qDebug("displaying main window");
|
||||
mainWindow.show();
|
||||
mainWindow.activateWindow();
|
||||
|
||||
splash.finish(&mainWindow);
|
||||
return application.exec();
|
||||
|
||||
+178
-57
File diff suppressed because it is too large
Load Diff
+13
-7
@@ -116,6 +116,7 @@ public:
|
||||
|
||||
void storeSettings(QSettings &settings) override;
|
||||
void readSettings();
|
||||
void processUpdates();
|
||||
|
||||
virtual ILockedWaitingForProcess* lock() override;
|
||||
virtual void unlock() override;
|
||||
@@ -217,7 +218,7 @@ private:
|
||||
QList<MOBase::IOrganizer::FileInfo> findFileInfos(const QString &path, const std::function<bool (const MOBase::IOrganizer::FileInfo &)> &filter) const;
|
||||
|
||||
bool modifyExecutablesDialog();
|
||||
void displayModInformation(int row, int tab = 0);
|
||||
void displayModInformation(int row, int tab = -1);
|
||||
void testExtractBSA(int modIndex);
|
||||
|
||||
void writeDataToFile(QFile &file, const QString &directory, const MOShared::DirectoryEntry &directoryEntry);
|
||||
@@ -386,6 +387,7 @@ private slots:
|
||||
void showMessage(const QString &message);
|
||||
void showError(const QString &message);
|
||||
|
||||
|
||||
// main window actions
|
||||
void helpTriggered();
|
||||
void issueTriggered();
|
||||
@@ -393,6 +395,10 @@ private slots:
|
||||
void tutorialTriggered();
|
||||
void extractBSATriggered();
|
||||
|
||||
//modlist shortcuts
|
||||
void openExplorer_activated();
|
||||
void refreshProfile_activated();
|
||||
|
||||
// modlist context menu
|
||||
void installMod_clicked();
|
||||
void createEmptyMod_clicked();
|
||||
@@ -404,6 +410,7 @@ private slots:
|
||||
void dontendorse_clicked();
|
||||
void unendorse_clicked();
|
||||
void ignoreMissingData_clicked();
|
||||
void markConverted_clicked();
|
||||
void visitOnNexus_clicked();
|
||||
void visitWebPage_clicked();
|
||||
void openExplorer_clicked();
|
||||
@@ -438,7 +445,6 @@ private slots:
|
||||
|
||||
// nexus related
|
||||
void checkModsForUpdates();
|
||||
void nexusLinkActivated(const QString &link);
|
||||
|
||||
void loginFailed(const QString &message);
|
||||
|
||||
@@ -461,16 +467,16 @@ private slots:
|
||||
void modInstalled(const QString &modName);
|
||||
|
||||
void nxmUpdatesAvailable(const std::vector<int> &modIDs, QVariant userData, QVariant resultData, int requestID);
|
||||
void nxmEndorsementToggled(int, QVariant, QVariant resultData, int);
|
||||
void nxmDownloadURLs(int modID, int fileID, QVariant userData, QVariant resultData, int requestID);
|
||||
void nxmRequestFailed(int modID, int fileID, QVariant userData, int requestID, const QString &errorString);
|
||||
void nxmEndorsementToggled(QString, int, QVariant, QVariant resultData, int);
|
||||
void nxmDownloadURLs(QString, int modID, int fileID, QVariant userData, QVariant resultData, int requestID);
|
||||
void nxmRequestFailed(QString, int modID, int fileID, QVariant userData, int requestID, const QString &errorString);
|
||||
|
||||
void editCategories();
|
||||
void deselectFilters();
|
||||
|
||||
void displayModInformation(const QString &modName, int tab);
|
||||
void modOpenNext();
|
||||
void modOpenPrev();
|
||||
void modOpenNext(int tab=-1);
|
||||
void modOpenPrev(int tab=-1);
|
||||
|
||||
void modRenamed(const QString &oldName, const QString &newName);
|
||||
void modRemoved(const QString &fileName);
|
||||
|
||||
@@ -48,6 +48,7 @@ QString ModFlagIconDelegate::getFlagIcon(ModInfo::EFlag flag) const
|
||||
case ModInfo::FLAG_CONFLICT_OVERWRITTEN: return ":/MO/gui/emblem_conflict_overwritten";
|
||||
case ModInfo::FLAG_CONFLICT_MIXED: return ":/MO/gui/emblem_conflict_mixed";
|
||||
case ModInfo::FLAG_CONFLICT_REDUNDANT: return ":MO/gui/emblem_conflict_redundant";
|
||||
case ModInfo::FLAG_ALTERNATE_GAME: return ":MO/gui/alternate_game";
|
||||
default: return QString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#include "modidlineedit.h"
|
||||
#include <QWhatsThis>
|
||||
|
||||
#include <QEvent>
|
||||
#include <QWhatsThisClickedEvent>
|
||||
|
||||
ModIDLineEdit::ModIDLineEdit(QWidget *parent) : QLineEdit(parent) {}
|
||||
ModIDLineEdit::ModIDLineEdit(const QString &text, QWidget *parent) : QLineEdit(text, parent) {}
|
||||
|
||||
bool ModIDLineEdit::event(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::WhatsThisClicked)
|
||||
{
|
||||
QWhatsThisClickedEvent *wtcEvent = static_cast<QWhatsThisClickedEvent*>(event);
|
||||
emit linkClicked(wtcEvent->href().trimmed());
|
||||
}
|
||||
|
||||
return QLineEdit::event(event);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef MODIDLINEEDIT_H
|
||||
#define MODIDLINEEDIT_H
|
||||
|
||||
#include <QLineEdit>
|
||||
|
||||
class ModIDLineEdit : public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ModIDLineEdit(QWidget *parent = 0);
|
||||
explicit ModIDLineEdit(const QString &text, QWidget *parent = 0);
|
||||
|
||||
public:
|
||||
virtual bool event(QEvent* event) override;
|
||||
|
||||
signals:
|
||||
void linkClicked(QString);
|
||||
|
||||
};
|
||||
|
||||
#endif //MODIDLINEEDIT_H
|
||||
+50
-30
@@ -48,7 +48,7 @@ using namespace MOShared;
|
||||
|
||||
std::vector<ModInfo::Ptr> ModInfo::s_Collection;
|
||||
std::map<QString, unsigned int> ModInfo::s_ModsByName;
|
||||
std::map<int, std::vector<unsigned int> > ModInfo::s_ModsByModID;
|
||||
std::map<std::pair<QString, int>, std::vector<unsigned int>> ModInfo::s_ModsByModID;
|
||||
int ModInfo::s_NextID;
|
||||
QMutex ModInfo::s_Mutex(QMutex::Recursive);
|
||||
|
||||
@@ -61,16 +61,16 @@ bool ModInfo::ByName(const ModInfo::Ptr &LHS, const ModInfo::Ptr &RHS)
|
||||
}
|
||||
|
||||
|
||||
ModInfo::Ptr ModInfo::createFrom(const QDir &dir, DirectoryEntry **directoryStructure)
|
||||
ModInfo::Ptr ModInfo::createFrom(PluginContainer *pluginContainer, const MOBase::IPluginGame *game, const QDir &dir, DirectoryEntry **directoryStructure)
|
||||
{
|
||||
QMutexLocker locker(&s_Mutex);
|
||||
// int id = s_NextID++;
|
||||
static QRegExp backupExp(".*backup[0-9]*");
|
||||
ModInfo::Ptr result;
|
||||
if (backupExp.exactMatch(dir.dirName())) {
|
||||
result = ModInfo::Ptr(new ModInfoBackup(dir, directoryStructure));
|
||||
result = ModInfo::Ptr(new ModInfoBackup(pluginContainer, game, dir, directoryStructure));
|
||||
} else {
|
||||
result = ModInfo::Ptr(new ModInfoRegular(dir, directoryStructure));
|
||||
result = ModInfo::Ptr(new ModInfoRegular(pluginContainer, game, dir, directoryStructure));
|
||||
}
|
||||
s_Collection.push_back(result);
|
||||
return result;
|
||||
@@ -80,10 +80,11 @@ ModInfo::Ptr ModInfo::createFromPlugin(const QString &modName,
|
||||
const QString &espName,
|
||||
const QStringList &bsaNames,
|
||||
ModInfo::EModType modType,
|
||||
DirectoryEntry **directoryStructure) {
|
||||
DirectoryEntry **directoryStructure,
|
||||
PluginContainer *pluginContainer) {
|
||||
QMutexLocker locker(&s_Mutex);
|
||||
ModInfo::Ptr result = ModInfo::Ptr(
|
||||
new ModInfoForeign(modName, espName, bsaNames, modType, directoryStructure));
|
||||
new ModInfoForeign(modName, espName, bsaNames, modType, directoryStructure, pluginContainer));
|
||||
s_Collection.push_back(result);
|
||||
return result;
|
||||
}
|
||||
@@ -105,11 +106,11 @@ QString ModInfo::getContentTypeName(int contentType)
|
||||
}
|
||||
}
|
||||
|
||||
void ModInfo::createFromOverwrite()
|
||||
void ModInfo::createFromOverwrite(PluginContainer *pluginContainer)
|
||||
{
|
||||
QMutexLocker locker(&s_Mutex);
|
||||
|
||||
s_Collection.push_back(ModInfo::Ptr(new ModInfoOverwrite));
|
||||
s_Collection.push_back(ModInfo::Ptr(new ModInfoOverwrite(pluginContainer)));
|
||||
}
|
||||
|
||||
unsigned int ModInfo::getNumMods()
|
||||
@@ -131,11 +132,11 @@ ModInfo::Ptr ModInfo::getByIndex(unsigned int index)
|
||||
}
|
||||
|
||||
|
||||
std::vector<ModInfo::Ptr> ModInfo::getByModID(int modID)
|
||||
std::vector<ModInfo::Ptr> ModInfo::getByModID(QString game, int modID)
|
||||
{
|
||||
QMutexLocker locker(&s_Mutex);
|
||||
|
||||
auto iter = s_ModsByModID.find(modID);
|
||||
auto iter = s_ModsByModID.find(std::pair<QString, int>(game, modID));
|
||||
if (iter == s_ModsByModID.end()) {
|
||||
return std::vector<ModInfo::Ptr>();
|
||||
}
|
||||
@@ -160,11 +161,11 @@ bool ModInfo::removeMod(unsigned int index)
|
||||
ModInfo::Ptr modInfo = s_Collection[index];
|
||||
s_ModsByName.erase(s_ModsByName.find(modInfo->name()));
|
||||
|
||||
auto iter = s_ModsByModID.find(modInfo->getNexusID());
|
||||
auto iter = s_ModsByModID.find(std::pair<QString, int>(modInfo->getGameName(), modInfo->getNexusID()));
|
||||
if (iter != s_ModsByModID.end()) {
|
||||
std::vector<unsigned int> indices = iter->second;
|
||||
indices.erase(std::remove(indices.begin(), indices.end(), index), indices.end());
|
||||
s_ModsByModID[modInfo->getNexusID()] = indices;
|
||||
s_ModsByModID[std::pair<QString, int>(modInfo->getGameName(), modInfo->getNexusID())] = indices;
|
||||
}
|
||||
|
||||
// physically remove the mod directory
|
||||
@@ -207,6 +208,7 @@ unsigned int ModInfo::findMod(const boost::function<bool (ModInfo::Ptr)> &filter
|
||||
|
||||
void ModInfo::updateFromDisc(const QString &modDirectory,
|
||||
DirectoryEntry **directoryStructure,
|
||||
PluginContainer *pluginContainer,
|
||||
bool displayForeign,
|
||||
MOBase::IPluginGame const *game)
|
||||
{
|
||||
@@ -219,7 +221,7 @@ void ModInfo::updateFromDisc(const QString &modDirectory,
|
||||
mods.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
QDirIterator modIter(mods);
|
||||
while (modIter.hasNext()) {
|
||||
createFrom(QDir(modIter.next()), directoryStructure);
|
||||
createFrom(pluginContainer, game, QDir(modIter.next()), directoryStructure);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,11 +235,12 @@ void ModInfo::updateFromDisc(const QString &modDirectory,
|
||||
unmanaged->referenceFile(modName).absoluteFilePath(),
|
||||
unmanaged->secondaryFiles(modName),
|
||||
modType,
|
||||
directoryStructure);
|
||||
directoryStructure,
|
||||
pluginContainer);
|
||||
}
|
||||
}
|
||||
|
||||
createFromOverwrite();
|
||||
createFromOverwrite(pluginContainer);
|
||||
|
||||
std::sort(s_Collection.begin(), s_Collection.end(), ModInfo::ByName);
|
||||
|
||||
@@ -252,28 +255,29 @@ void ModInfo::updateIndices()
|
||||
|
||||
for (unsigned int i = 0; i < s_Collection.size(); ++i) {
|
||||
QString modName = s_Collection[i]->internalName();
|
||||
QString game = s_Collection[i]->getGameName();
|
||||
int modID = s_Collection[i]->getNexusID();
|
||||
s_ModsByName[modName] = i;
|
||||
s_ModsByModID[modID].push_back(i);
|
||||
s_ModsByModID[std::pair<QString, int>(game, modID)].push_back(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ModInfo::ModInfo()
|
||||
ModInfo::ModInfo(PluginContainer *pluginContainer)
|
||||
: m_Valid(false), m_PrimaryCategory(-1)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void ModInfo::checkChunkForUpdate(const std::vector<int> &modIDs, QObject *receiver)
|
||||
void ModInfo::checkChunkForUpdate(PluginContainer *pluginContainer, const std::vector<int> &modIDs, QObject *receiver, QString gameName)
|
||||
{
|
||||
if (modIDs.size() != 0) {
|
||||
NexusInterface::instance()->requestUpdates(modIDs, receiver, QVariant(), QString());
|
||||
NexusInterface::instance(pluginContainer)->requestUpdates(modIDs, receiver, QVariant(), gameName, QString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int ModInfo::checkAllForUpdate(QObject *receiver)
|
||||
int ModInfo::checkAllForUpdate(PluginContainer *pluginContainer, QObject *receiver)
|
||||
{
|
||||
// technically this should be 255 but those requests can take nexus fairly long, produce
|
||||
// large output and may have been the cause of issue #1166
|
||||
@@ -284,20 +288,36 @@ int ModInfo::checkAllForUpdate(QObject *receiver)
|
||||
|
||||
//I ought to store this, it's used elsewhere
|
||||
IPluginGame const *game = qApp->property("managed_game").value<IPluginGame *>();
|
||||
if (game->nexusModOrganizerID()) {
|
||||
modIDs.push_back(game->nexusModOrganizerID());
|
||||
checkChunkForUpdate(pluginContainer, modIDs, receiver, game->gameShortName());
|
||||
modIDs.clear();
|
||||
}
|
||||
|
||||
modIDs.push_back(game->nexusModOrganizerID());
|
||||
|
||||
for (const ModInfo::Ptr &mod : s_Collection) {
|
||||
std::multimap<QString, QSharedPointer<ModInfo>> organizedGames;
|
||||
for (auto mod : s_Collection) {
|
||||
if (mod->canBeUpdated()) {
|
||||
modIDs.push_back(mod->getNexusID());
|
||||
if (modIDs.size() >= chunkSize) {
|
||||
checkChunkForUpdate(modIDs, receiver);
|
||||
modIDs.clear();
|
||||
}
|
||||
organizedGames.insert(std::pair<QString, QSharedPointer<ModInfo>>(mod->getGameName(), mod));
|
||||
}
|
||||
}
|
||||
|
||||
checkChunkForUpdate(modIDs, receiver);
|
||||
QString currentGame = "";
|
||||
for (auto game : organizedGames) {
|
||||
if (currentGame != game.first) {
|
||||
if (currentGame != "") {
|
||||
checkChunkForUpdate(pluginContainer, modIDs, receiver, currentGame);
|
||||
modIDs.clear();
|
||||
}
|
||||
currentGame = game.first;
|
||||
}
|
||||
modIDs.push_back(game.second->getNexusID());
|
||||
if (modIDs.size() >= chunkSize) {
|
||||
checkChunkForUpdate(pluginContainer, modIDs, receiver, currentGame);
|
||||
modIDs.clear();
|
||||
}
|
||||
}
|
||||
|
||||
checkChunkForUpdate(pluginContainer, modIDs, receiver, currentGame);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -394,4 +414,4 @@ void ModInfo::testValid()
|
||||
while (dirIter.hasNext()) {
|
||||
dirIter.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user