Compare commits

..
86 Commits
Author SHA1 Message Date
Jeremy Rimpo 886fb10288 Merge pull request #343 from Modorganizer2/Develop
Better error message when archives can't be extracted
2018-05-08 19:33:47 -05:00
Silarn 693f3c40ee Better error message when archives can't be extracted 2018-05-08 19:33:25 -05:00
Jeremy Rimpo 26b946a905 Merge pull request #342 from Modorganizer2/Develop
Fix an issue with resuming a completed download
2018-05-08 19:24:02 -05:00
Silarn 11aa955d73 Fix issue with resuming a download that was already complete. 2018-05-08 19:22:07 -05:00
Silarn 2486c554a0 Small compat fix for Qt 5.11 2018-05-08 18:47:45 -05:00
Jeremy Rimpo 5e6bb0a16e Merge pull request #341 from Modorganizer2/Develop
Reset the progress bar data after completing the extraction
2018-05-08 11:35:45 -05:00
Silarn 632474ef97 Reset the progress bar data after completing the extraction 2018-05-08 11:31:05 -05:00
Brian Munro 0da6af17b2 Merge pull request #336 from Modorganizer2/Develop
Release 2.1.3
2018-05-08 12:47:54 +02:00
Silarn 44111d12c1 Remove a pointless error when the game doesn't have a script extender 2018-05-07 17:20:33 -05:00
Silarn 02d3f81829 Changes to allow installer_NCC to use the game source set in the DL meta 2018-05-07 01:29:00 -05:00
Silarn fc74aa90d1 Updating about dialog with additional supporters 2018-05-06 17:31:06 -05:00
Silarn 7d9514d497 Translation updates 2018-05-06 17:22:06 -05:00
Silarn 6359d7d23f Fixes for downloads and installs 2018-05-06 17:21:35 -05:00
Silarn 5f8bbaae2a Make sure project_path is set before trying to use it 2018-05-06 10:18:23 -05:00
Silarn fe33d7af43 Rework the existing file download dialog to pause the download while waiting
- Also fixes direct calls to downloadFinished
2018-05-05 01:28:09 -05:00
Silarn 9ae442810b Make sure to update the index when data is changed 2018-05-04 19:00:55 -05:00
Silarn 9998727dba Vastly improved plugin index generation and sorting 2018-05-04 18:26:57 -05:00
Silarn a76d987647 Update the about dialog 2018-05-04 17:28:58 -05:00
Silarn a29192f9b2 Incorporate uibase translations into organizer 2018-05-04 16:16:32 -05:00
Silarn a77433f881 Use queued connections and do while loops to finish event processing 2018-05-04 14:28:19 -05:00
Silarn 54e2197592 Allow update processor to include the managed game if nexus info matches 2018-05-04 11:35:44 -05:00
Silarn 0d7460996a Further offload setValue to avoid threading issues 2018-05-04 11:34:49 -05:00
Silarn d9b1cfdb4b invokeMethod was getting called too late and is unneeded now 2018-05-04 02:30:10 -05:00
Silarn 98b659f0da Updating gitignore 2018-05-04 00:28:43 -05:00
Silarn 979c09b334 Update translation file 2018-05-04 00:15:48 -05:00
Silarn cf5833437d Bump to version 2.1.3 2018-05-03 19:36:39 -05:00
Silarn 0eaa1c6791 Add version check and update processor 2018-05-03 19:36:14 -05:00
Silarn fa193ddabb Initial icons for alternate games 2018-05-03 18:25:27 -05:00
Silarn cc32c8c06b Use a five second delta to calculate speed for more responsive display 2018-05-03 17:14:05 -05:00
Silarn 9872c1e462 Allow for primary game sources and marking mods as converted/working 2018-05-03 16:17:40 -05:00
Silarn e3989fe8f9 Merge branch 'Develop' of https://github.com/Modorganizer2/modorganizer into Develop 2018-05-02 17:04:50 -05:00
Silarn f7c9b8c333 Thread extraction process and properly offload function calls from threads 2018-05-02 17:04:28 -05:00
Jeremy Rimpo 5555a58f84 Merge pull request #335 from AnyOldName3/proxy-multiple-inheritance-support
Proxy multiple inheritance support
2018-05-02 14:01:50 -05:00
Silarn 6588a81b7f Only check for the mod organizer endorsement if the ID is set 2018-05-02 13:48:31 -05:00
Silarn 2091330af2 Clean up handling of managed game instance in NexusInterface 2018-05-02 13:47:59 -05:00
Silarn 168da18aa5 Fix MO endorsement check and add game to ModInfo s_ModsByModID 2018-05-02 12:38:23 -05:00
AnyOldName3 4245036f52 Remove unused function which made things confusing 2018-05-02 17:12:34 +01:00
AnyOldName3 238c252b4c Coalesce plugins with the same name in the settings dialogue (as they already share setting values) 2018-05-02 17:11:54 +01:00
AnyOldName3 938d3ce91b Take a list of proxied plugins for each name to work around multiple inheritance issues 2018-05-02 17:10:38 +01:00
Silarn d62ec9c867 Allow downloads to display speed and complete % 2018-05-01 21:50:20 -05:00
Silarn 3bb7a44610 Update translation files 2018-05-01 17:02:05 -05:00
Silarn 4bf7b4e103 Update the NMM version 2018-05-01 13:18:39 -05:00
Silarn d3c207193f Add all supported games to the nxmhandler config 2018-05-01 13:01:44 -05:00
Silarn 584c6049f9 Remove redundant code causing multiple installs 2018-05-01 12:37:07 -05:00
Silarn 2b7274380e Release memory 2018-05-01 12:36:47 -05:00
Silarn 275afb730f A couple download header-based fixes
* If an unknown content error, only fail if the filesize is off
* If a text content type, output a warning but do not retry the download
2018-04-30 13:56:27 -05:00
Silarn 0306b0fc42 Change Nexus API URL 2018-04-28 23:32:39 -05:00
Silarn 86c97c7c06 4096 was the correct number 2018-04-27 20:24:20 -05:00
Silarn 3114bcbd8d Fix ESL index display and sorting by index 2018-04-27 20:21:42 -05:00
Silarn 41a479bddf Cache the current game as populating the dropdown triggers the save 2018-04-27 20:00:51 -05:00
Silarn e02614ee14 Add alternative game flag and check 2018-04-27 01:57:59 -05:00
Al12rs cfbe399bba Fixed mod rename to allow just changing letters to uppercase or lowercase.
(Previously it would not allow it as it detected an existing mod having the same name (check is caseInsensitive)).
2018-04-25 23:48:18 +02:00
Silarn 10b8d12152 Update to https for other nexus links For Security 2018-04-24 09:28:08 -07:00
Silarn b3ef185866 Update Nexus protocol to https 2018-04-24 09:22:51 -07:00
Silarn 18328587b5 Merge branch 'Develop' of https://github.com/Modorganizer2/modorganizer into Develop 2018-04-23 22:13:03 -07:00
Silarn 31bf15f3b4 Need to check if the file is in the download directory for creating meta 2018-04-23 22:12:46 -07:00
Al12rs 001fddb069 Changed the shortcut to open in explorer a mod to CTRL+Enter to avoid consuming the Enter key press so that people can still use it to finish renaming a mod. 2018-04-22 16:39:26 +02:00
Silarn 141ac311d2 Don't create meta files if they don't exist 2018-04-21 22:32:17 -05:00
Silarn fbb93eaf86 Remove remnants of QtScript and fix some CMake issues 2018-04-19 01:43:57 -05:00
Silarn 7e04542762 Some tweaks to make MO the top window when loading or changing games 2018-04-18 11:46:42 -05:00
Silarn 08b56ee783 Improve and fix handling of external links 2018-04-18 03:41:53 -05:00
Silarn 85faed5de1 Fix issues with download query 2018-04-17 19:14:17 -05:00
Al12rs 189445191d Added Delete shourcut to both modinfodialog and Overwriteinfodilaog. Added confirm messages since delete can't be undone. 2018-04-18 00:08:05 +02:00
Al 618fd543a6 Merge pull request #315 from Al12rs/Develop
Ui and shortcut changes.
2018-04-17 22:43:24 +02:00
Al12rs f276203517 Changed mod Information dialog "Next" and "Previous" buttons to remember the currently viewed tab. 2018-04-17 21:51:22 +02:00
Al12rs b64fd1ed4d Enter shourcut will now open the mod containing the selected plugin if the ESPList has the focus.
Added F5 shourcut to refresh the profile.
Removed a redundant variable I saw by chance.
2018-04-17 21:51:01 +02:00
Al12rs b1329c18cd Added Enter shortcut support for ovewrite as well to open the Explorer window. 2018-04-17 21:50:41 +02:00
Al12rs 62dc387de6 Added key shourtcuts to open in explorer a selected mo by pressing Enter or Return. Needs support for overwrte 2018-04-17 21:50:12 +02:00
Al12rs fc46a6a782 Disabled Hide inactive plugins checkbox in settings as it didn't work. 2018-04-17 21:49:34 +02:00
Al12rs a2d7ce67aa Merged the new open in explorer button with Silarn's code. 2018-04-17 21:49:15 +02:00
Al12rs a14ed8fcd1 Changed the modifodialog to open the first enabled left most tab, if no particular tab was specified by the function caller.
This will allow the users to choose what tab should be opened when opening the mod informations since the order of the tabs can be changed and is saved.
2018-04-17 21:23:40 +02:00
Al12rs c669fed48a Fixed inconsistency in line endings. 2018-04-17 21:22:46 +02:00
Silarn 634825e1b8 Adjust mod info dialog, add tooltips, update old 2018-04-17 03:04:59 -05:00
Silarn 7688175c68 Add source game setter in mod info dialog 2018-04-17 02:47:07 -05:00
Silarn b4eae6e5d1 Fix signal/slot connector for available server parser 2018-04-17 00:33:15 -05:00
Silarn b1c477f8ec Fix for virtualized executable path 2018-04-16 15:31:45 -05:00
Jeremy Rimpo 8b3a83ed8d Merge pull request #311 from AnyOldName3/load-qtbase-qm
Load qtbase qm
2018-04-16 14:18:04 -05:00
Silarn 332cdc155a Merge branch 'Develop' of https://github.com/Modorganizer2/modorganizer into Develop 2018-04-16 12:48:52 -05:00
Silarn 30c177cb37 Support for multi-game downloads 2018-04-16 12:47:17 -05:00
AnyOldName3 ae4e4f9df8 Load qtbase_<language>.qm when possible 2018-04-15 12:59:04 +01:00
AnyOldName3 dd24b60895 Update .gitignore with missing msbuild stuff. 2018-04-15 12:58:27 +01:00
Al12rs fa104b342f Moved the Changelog to the detailed text to avoid the msgbox going below the scree. The readability is not graeat as QMessageBox does not allow resizing for some petty reason. 2018-04-15 02:54:58 +02:00
Al12rs cc2c4cc918 Fix for programs set to start from inside the top level of a mod folder not launching. 2018-04-15 02:54:47 +02:00
Jeremy Rimpo 978d71bb43 Merge pull request #304 from AnyOldName3/proxy-translation-support
Proxy translation support
2018-04-13 12:42:54 -05:00
AnyOldName3 25b6fe1471 Reload plugin translation databases when changing language. 2018-04-13 14:49:59 +01:00
AnyOldName3 6b5680f6e4 Make pluginFileNames() include those of proxied plugins, too. 2018-04-13 14:46:04 +01:00
63 changed files with 8064 additions and 582 deletions
+4 -7
View File
@@ -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
View File
@@ -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}")
###############
+5
View File
@@ -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);
}
+5
View File
@@ -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
View File
@@ -125,7 +125,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="copyrightText">
<property name="text">
<string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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.&lt;/p&gt;&lt;p&gt;See the GNU General Public License for more details.&lt;/p&gt;&lt;p&gt;Source code can be found at &lt;a href=&quot;https://github.com/Modorganizer2/modorganizer&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#007af4;&quot;&gt;GitHub&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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 &amp;&amp; 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>
+2 -2
View File
@@ -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);
+5 -3
View File
@@ -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);
}
}
+4 -3
View File
@@ -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
View File
File diff suppressed because it is too large Load Diff
+28 -16
View File
@@ -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
View File
@@ -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;
}
+8 -1
View File
@@ -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;
+2 -2
View File
@@ -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
View File
@@ -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
View File
File diff suppressed because it is too large Load Diff
+13 -7
View File
@@ -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);
+1
View File
@@ -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();
}
}
+19
View File
@@ -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);
}
+22
View File
@@ -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
View File
@@ -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