mirror of
https://github.com/ModOrganizer2/modorganizer.git
synced 2026-07-27 13:58:24 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a3a15b1f6 | ||
|
|
1ea43586d8 | ||
|
|
fd51434e5e | ||
|
|
7eb4b33214 | ||
|
|
e1e367c7ea | ||
|
|
696bb3bc47 | ||
|
|
10be66a62a | ||
|
|
a02b920b19 | ||
|
|
2f8e5b4f69 | ||
|
|
385765ecdd | ||
|
|
447a2169fe | ||
|
|
fc8a6b358f | ||
|
|
edf608ab23 | ||
|
|
d02df7e4b4 | ||
|
|
cc63717060 | ||
|
|
8f28e0af36 | ||
|
|
e80bb3a837 | ||
|
|
f6ecb93d46 | ||
|
|
4f14598cfc | ||
|
|
ce2494ba20 | ||
|
|
d5f3bee642 | ||
|
|
b38957d853 | ||
|
|
f824d255a2 | ||
|
|
344b83957e | ||
|
|
023cacab7f | ||
|
|
35bbe0001e | ||
|
|
75478f68a1 | ||
|
|
5a0b8b431c | ||
|
|
61b33a8351 | ||
|
|
103e3f3098 | ||
|
|
872c33fe55 | ||
|
|
9ddb26ea51 | ||
|
|
1867c20f02 | ||
|
|
6552054e58 | ||
|
|
a830f3e09e | ||
|
|
eaf3655492 | ||
|
|
952f1fe8cd | ||
|
|
b4530eb843 | ||
|
|
f20a1f6a84 | ||
|
|
942e656a71 | ||
|
|
7f3dc586b0 | ||
|
|
2524d65441 | ||
|
|
5efddbd515 | ||
|
|
181de232f4 | ||
|
|
1f9103c24e | ||
|
|
2d49ba2bef | ||
|
|
e41c97b64f | ||
|
|
b7d6bbb451 | ||
|
|
4a765cc152 | ||
|
|
30f170c10d | ||
|
|
b6aa12b323 | ||
|
|
19d80cc23d | ||
|
|
0c4b1e9a92 | ||
|
|
cacf7e0542 | ||
|
|
f09ec53fcf | ||
|
|
ddb40b712e | ||
|
|
186f26b71e | ||
|
|
6d6444c126 | ||
|
|
4b66c6c1ef | ||
|
|
08f35d6519 | ||
|
|
6617be8ef9 | ||
|
|
5a5bfee712 | ||
|
|
2fc55ccc86 | ||
|
|
8731159bfb | ||
|
|
1c6543454e | ||
|
|
941c50bff9 | ||
|
|
1e6e055f39 | ||
|
|
81e329fb39 | ||
|
|
15db1b76f7 | ||
|
|
75e6c72ae4 | ||
|
|
9c1806cc74 | ||
|
|
8f905e1d49 | ||
|
|
2ee5f0e96d | ||
|
|
0d220b6b41 | ||
|
|
decbbb611e | ||
|
|
aeb0b42cde | ||
|
|
38391b10e9 | ||
|
|
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);
|
||||
|
||||
@@ -40,7 +40,7 @@ int DownloadList::rowCount(const QModelIndex&) const
|
||||
|
||||
int DownloadList::columnCount(const QModelIndex&) const
|
||||
{
|
||||
return 3;
|
||||
return 4;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ QVariant DownloadList::headerData(int section, Qt::Orientation orientation, int
|
||||
switch (section) {
|
||||
case COL_NAME: return tr("Name");
|
||||
case COL_FILETIME: return tr("Filetime");
|
||||
case COL_SIZE: return tr("Size");
|
||||
default: return tr("Done");
|
||||
}
|
||||
} else {
|
||||
|
||||
+2
-1
@@ -39,7 +39,8 @@ public:
|
||||
enum EColumn {
|
||||
COL_NAME = 0,
|
||||
COL_FILETIME,
|
||||
COL_STATUS
|
||||
COL_STATUS,
|
||||
COL_SIZE
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
@@ -47,6 +47,8 @@ bool DownloadListSortProxy::lessThan(const QModelIndex &left,
|
||||
return m_Manager->getFileTime(leftIndex) < m_Manager->getFileTime(rightIndex);
|
||||
} else if (left.column() == DownloadList::COL_STATUS) {
|
||||
return m_Manager->getState(leftIndex) < m_Manager->getState(rightIndex);
|
||||
} else if(left.column() == DownloadList::COL_SIZE){
|
||||
return m_Manager->getFileSize(leftIndex) < m_Manager->getFileSize(rightIndex);
|
||||
} else {
|
||||
return leftIndex < rightIndex;
|
||||
}
|
||||
|
||||
+94
-19
@@ -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)));
|
||||
@@ -81,15 +82,34 @@ void DownloadListWidgetDelegate::drawCache(QPainter *painter, const QStyleOption
|
||||
{
|
||||
QRect rect = option.rect;
|
||||
rect.setLeft(0);
|
||||
rect.setWidth(m_View->columnWidth(0) + m_View->columnWidth(1) + m_View->columnWidth(2));
|
||||
rect.setWidth(m_View->columnWidth(0) + m_View->columnWidth(1) + m_View->columnWidth(2) + m_View->columnWidth(3));
|
||||
painter->drawPixmap(rect, cache);
|
||||
}
|
||||
|
||||
|
||||
QString DownloadListWidgetDelegate::sizeFormat(quint64 size) const
|
||||
{
|
||||
qreal calc = size;
|
||||
QStringList list;
|
||||
list << "KB" << "MB" << "GB" << "TB";
|
||||
|
||||
QStringListIterator i(list);
|
||||
QString unit("byte(s)");
|
||||
|
||||
while (calc >= 1024.0 && i.hasNext())
|
||||
{
|
||||
unit = i.next();
|
||||
calc /= 1024.0;
|
||||
}
|
||||
|
||||
return QString().setNum(calc, 'f', 2) + " " + unit;
|
||||
}
|
||||
|
||||
|
||||
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"));
|
||||
@@ -105,9 +125,9 @@ void DownloadListWidgetDelegate::paintRegularDownload(int downloadIndex) const
|
||||
name.append("...");
|
||||
}
|
||||
m_NameLabel->setText(name);
|
||||
m_SizeLabel->setText(QString::number(m_Manager->getFileSize(downloadIndex) / 1024));
|
||||
m_SizeLabel->setText(sizeFormat(m_Manager->getFileSize(downloadIndex) ));
|
||||
DownloadManager::DownloadState state = m_Manager->getState(downloadIndex);
|
||||
if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR)) {
|
||||
if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR) || (state == DownloadManager::STATE_PAUSING)) {
|
||||
QPalette labelPalette;
|
||||
m_InstallLabel->setVisible(true);
|
||||
m_Progress->setVisible(false);
|
||||
@@ -159,7 +179,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +193,7 @@ void DownloadListWidgetDelegate::paint(QPainter *painter, const QStyleOptionView
|
||||
return;
|
||||
}
|
||||
|
||||
m_ItemWidget->resize(QSize(m_View->columnWidth(0) + m_View->columnWidth(1) + m_View->columnWidth(2), option.rect.height()));
|
||||
m_ItemWidget->resize(QSize(m_View->columnWidth(0) + m_View->columnWidth(1) + m_View->columnWidth(2) + m_View->columnWidth(3), option.rect.height()));
|
||||
|
||||
int downloadIndex = index.data().toInt();
|
||||
|
||||
@@ -224,7 +245,11 @@ void DownloadListWidgetDelegate::issueQueryInfo()
|
||||
|
||||
void DownloadListWidgetDelegate::issueDelete()
|
||||
{
|
||||
emit removeDownload(m_ContextRow, true);
|
||||
if (QMessageBox::question(nullptr, tr("Delete Files?"),
|
||||
tr("This will permanently delete the selected download."),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||
emit removeDownload(m_ContextRow, true);
|
||||
}
|
||||
}
|
||||
|
||||
void DownloadListWidgetDelegate::issueRemoveFromView()
|
||||
@@ -234,7 +259,22 @@ void DownloadListWidgetDelegate::issueRemoveFromView()
|
||||
|
||||
void DownloadListWidgetDelegate::issueRestoreToView()
|
||||
{
|
||||
emit restoreDownload(m_ContextRow);
|
||||
emit restoreDownload(m_ContextRow);
|
||||
}
|
||||
|
||||
void DownloadListWidgetDelegate::issueRestoreToViewAll()
|
||||
{
|
||||
emit restoreDownload(-1);
|
||||
}
|
||||
|
||||
void DownloadListWidgetDelegate::issueVisitOnNexus()
|
||||
{
|
||||
emit visitOnNexus(m_ContextRow);
|
||||
}
|
||||
|
||||
void DownloadListWidgetDelegate::issueOpenInDownloadsFolder()
|
||||
{
|
||||
emit openInDownloadsFolder(m_ContextRow);
|
||||
}
|
||||
|
||||
void DownloadListWidgetDelegate::issueCancel()
|
||||
@@ -254,7 +294,7 @@ void DownloadListWidgetDelegate::issueResume()
|
||||
|
||||
void DownloadListWidgetDelegate::issueDeleteAll()
|
||||
{
|
||||
if (QMessageBox::question(nullptr, tr("Are you sure?"),
|
||||
if (QMessageBox::question(nullptr, tr("Delete Files?"),
|
||||
tr("This will remove all finished downloads from this list and from disk."),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||
emit removeDownload(-1, true);
|
||||
@@ -263,13 +303,22 @@ void DownloadListWidgetDelegate::issueDeleteAll()
|
||||
|
||||
void DownloadListWidgetDelegate::issueDeleteCompleted()
|
||||
{
|
||||
if (QMessageBox::question(nullptr, tr("Are you sure?"),
|
||||
if (QMessageBox::question(nullptr, tr("Delete Files?"),
|
||||
tr("This will remove all installed downloads from this list and from disk."),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||
emit removeDownload(-2, true);
|
||||
}
|
||||
}
|
||||
|
||||
void DownloadListWidgetDelegate::issueDeleteUninstalled()
|
||||
{
|
||||
if (QMessageBox::question(nullptr, tr("Delete Files?"),
|
||||
tr("This will remove all uninstalled downloads from this list and from disk."),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||
emit removeDownload(-3, true);
|
||||
}
|
||||
}
|
||||
|
||||
void DownloadListWidgetDelegate::issueRemoveFromViewAll()
|
||||
{
|
||||
if (QMessageBox::question(nullptr, tr("Are you sure?"),
|
||||
@@ -288,6 +337,15 @@ void DownloadListWidgetDelegate::issueRemoveFromViewCompleted()
|
||||
}
|
||||
}
|
||||
|
||||
void DownloadListWidgetDelegate::issueRemoveFromViewUninstalled()
|
||||
{
|
||||
if (QMessageBox::question(nullptr, tr("Are you sure?"),
|
||||
tr("This will remove all uninstalled downloads from this list (but NOT from disk)."),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||
emit removeDownload(-3, false);
|
||||
}
|
||||
}
|
||||
|
||||
bool DownloadListWidgetDelegate::editorEvent(QEvent *event, QAbstractItemModel *model,
|
||||
const QStyleOptionViewItem &option, const QModelIndex &index)
|
||||
{
|
||||
@@ -296,7 +354,7 @@ bool DownloadListWidgetDelegate::editorEvent(QEvent *event, QAbstractItemModel *
|
||||
QModelIndex sourceIndex = qobject_cast<QSortFilterProxyModel*>(model)->mapToSource(index);
|
||||
if (m_Manager->getState(sourceIndex.row()) >= DownloadManager::STATE_READY) {
|
||||
emit installDownload(sourceIndex.row());
|
||||
} else if (m_Manager->getState(sourceIndex.row()) >= DownloadManager::STATE_PAUSED) {
|
||||
} else if ((m_Manager->getState(sourceIndex.row()) >= DownloadManager::STATE_PAUSED) || (m_Manager->getState(sourceIndex.row()) == DownloadManager::STATE_PAUSING)) {
|
||||
emit resumeDownload(sourceIndex.row());
|
||||
}
|
||||
return true;
|
||||
@@ -313,7 +371,14 @@ bool DownloadListWidgetDelegate::editorEvent(QEvent *event, QAbstractItemModel *
|
||||
menu.addAction(tr("Install"), this, SLOT(issueInstall()));
|
||||
if (m_Manager->isInfoIncomplete(m_ContextRow)) {
|
||||
menu.addAction(tr("Query Info"), this, SLOT(issueQueryInfo()));
|
||||
}else {
|
||||
menu.addAction(tr("Visit on Nexus"), this,SLOT(issueVisitOnNexus()));
|
||||
}
|
||||
|
||||
menu.addAction(tr("Show in Folder"), this, SLOT(issueOpenInDownloadsFolder()));
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
menu.addAction(tr("Delete"), this, SLOT(issueDelete()));
|
||||
if (hidden) {
|
||||
menu.addAction(tr("Un-Hide"), this, SLOT(issueRestoreToView()));
|
||||
@@ -323,20 +388,30 @@ bool DownloadListWidgetDelegate::editorEvent(QEvent *event, QAbstractItemModel *
|
||||
} else if (state == DownloadManager::STATE_DOWNLOADING){
|
||||
menu.addAction(tr("Cancel"), this, SLOT(issueCancel()));
|
||||
menu.addAction(tr("Pause"), this, SLOT(issuePause()));
|
||||
} else if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR)) {
|
||||
menu.addAction(tr("Remove"), this, SLOT(issueDelete()));
|
||||
menu.addAction(tr("Show in Folder"), this, SLOT(issueOpenInDownloadsFolder()));
|
||||
} else if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR) || (state == DownloadManager::STATE_PAUSING)) {
|
||||
menu.addAction(tr("Delete"), this, SLOT(issueDelete()));
|
||||
menu.addAction(tr("Resume"), this, SLOT(issueResume()));
|
||||
menu.addAction(tr("Show in Folder"), this, SLOT(issueOpenInDownloadsFolder()));
|
||||
}
|
||||
|
||||
menu.addSeparator();
|
||||
}
|
||||
menu.addAction(tr("Delete Installed..."), this, SLOT(issueDeleteCompleted()));
|
||||
menu.addAction(tr("Delete Uninstalled..."), this, SLOT(issueDeleteUninstalled()));
|
||||
menu.addAction(tr("Delete All..."), this, SLOT(issueDeleteAll()));
|
||||
if (!hidden) {
|
||||
menu.addSeparator();
|
||||
menu.addAction(tr("Hide Installed..."), this, SLOT(issueRemoveFromViewCompleted()));
|
||||
menu.addAction(tr("Hide All..."), this, SLOT(issueRemoveFromViewAll()));
|
||||
}
|
||||
|
||||
if (!hidden) {
|
||||
menu.addSeparator();
|
||||
menu.addAction(tr("Hide Installed..."), this, SLOT(issueRemoveFromViewCompleted()));
|
||||
menu.addAction(tr("Hide Uninstalled..."), this, SLOT(issueRemoveFromViewUninstalled()));
|
||||
menu.addAction(tr("Hide All..."), this, SLOT(issueRemoveFromViewAll()));
|
||||
}
|
||||
if (hidden) {
|
||||
menu.addSeparator();
|
||||
menu.addAction(tr("Un-Hide All..."), this, SLOT(issueRestoreToViewAll()));
|
||||
}
|
||||
|
||||
menu.exec(mouseEvent->globalPos());
|
||||
|
||||
event->accept();
|
||||
|
||||
@@ -71,14 +71,18 @@ signals:
|
||||
void cancelDownload(int index);
|
||||
void pauseDownload(int index);
|
||||
void resumeDownload(int index);
|
||||
void visitOnNexus(int index);
|
||||
void openInDownloadsFolder(int index);
|
||||
|
||||
protected:
|
||||
|
||||
QString sizeFormat(quint64 size) const;
|
||||
bool editorEvent(QEvent *event, QAbstractItemModel *model,
|
||||
const QStyleOptionViewItem &option, const QModelIndex &index);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
void drawCache(QPainter *painter, const QStyleOptionViewItem &option, const QPixmap &cache) const;
|
||||
|
||||
private slots:
|
||||
@@ -87,13 +91,18 @@ private slots:
|
||||
void issueDelete();
|
||||
void issueRemoveFromView();
|
||||
void issueRestoreToView();
|
||||
void issueRestoreToViewAll();
|
||||
void issueVisitOnNexus();
|
||||
void issueOpenInDownloadsFolder();
|
||||
void issueCancel();
|
||||
void issuePause();
|
||||
void issueResume();
|
||||
void issueDeleteAll();
|
||||
void issueDeleteCompleted();
|
||||
void issueDeleteUninstalled();
|
||||
void issueRemoveFromViewAll();
|
||||
void issueRemoveFromViewCompleted();
|
||||
void issueRemoveFromViewUninstalled();
|
||||
void issueQueryInfo();
|
||||
|
||||
void stateChanged(int row, DownloadManager::DownloadState);
|
||||
|
||||
@@ -86,6 +86,9 @@
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string notr="true">KB</string>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -81,18 +81,35 @@ void DownloadListWidgetCompactDelegate::drawCache(QPainter *painter, const QStyl
|
||||
{
|
||||
QRect rect = option.rect;
|
||||
rect.setLeft(0);
|
||||
rect.setWidth(m_View->columnWidth(0) + m_View->columnWidth(1) + m_View->columnWidth(2));
|
||||
rect.setWidth(m_View->columnWidth(0) + m_View->columnWidth(1) + m_View->columnWidth(2) + m_View->columnWidth(3));
|
||||
painter->drawPixmap(rect, cache);
|
||||
}
|
||||
|
||||
QString DownloadListWidgetCompactDelegate::sizeFormat(quint64 size) const
|
||||
{
|
||||
qreal calc = size;
|
||||
QStringList list;
|
||||
list << "KB" << "MB" << "GB" << "TB";
|
||||
|
||||
QStringListIterator i(list);
|
||||
QString unit("byte(s)");
|
||||
|
||||
while (calc >= 1024.0 && i.hasNext())
|
||||
{
|
||||
unit = i.next();
|
||||
calc /= 1024.0;
|
||||
}
|
||||
|
||||
return QString().setNum(calc, 'f', 2) + " " + unit;
|
||||
}
|
||||
|
||||
void DownloadListWidgetCompactDelegate::paintPendingDownload(int downloadIndex) const
|
||||
{
|
||||
std::pair<int, int> nexusids = m_Manager->getPendingDownload(downloadIndex);
|
||||
m_NameLabel->setText(tr("< mod %1 file %2 >").arg(nexusids.first).arg(nexusids.second));
|
||||
if (m_SizeLabel != nullptr) {
|
||||
m_SizeLabel->setText("???");
|
||||
}
|
||||
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("???");
|
||||
//}
|
||||
m_DoneLabel->setVisible(true);
|
||||
m_DoneLabel->setText(tr("Pending"));
|
||||
m_Progress->setVisible(false);
|
||||
@@ -110,11 +127,15 @@ void DownloadListWidgetCompactDelegate::paintRegularDownload(int downloadIndex)
|
||||
|
||||
DownloadManager::DownloadState state = m_Manager->getState(downloadIndex);
|
||||
|
||||
if ((m_SizeLabel != nullptr) && (state >= DownloadManager::STATE_READY)) {
|
||||
m_SizeLabel->setText(QString::number(m_Manager->getFileSize(downloadIndex) / 1048576));
|
||||
if (m_SizeLabel != nullptr) {
|
||||
m_SizeLabel->setText(sizeFormat(m_Manager->getFileSize(downloadIndex)) + " ");
|
||||
m_SizeLabel->setVisible(true);
|
||||
}
|
||||
//else {
|
||||
// m_SizeLabel->setVisible(false);
|
||||
//}
|
||||
|
||||
if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR)) {
|
||||
if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR) || (state == DownloadManager::STATE_PAUSING)) {
|
||||
m_DoneLabel->setVisible(true);
|
||||
m_Progress->setVisible(false);
|
||||
m_DoneLabel->setText(QString("%1<img src=\":/MO/gui/inactive\">").arg(tr("Paused")));
|
||||
@@ -138,7 +159,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +174,7 @@ void DownloadListWidgetCompactDelegate::paint(QPainter *painter, const QStyleOpt
|
||||
return;
|
||||
}
|
||||
|
||||
m_ItemWidget->resize(QSize(m_View->columnWidth(0) + m_View->columnWidth(1) + m_View->columnWidth(2), option.rect.height()));
|
||||
m_ItemWidget->resize(QSize(m_View->columnWidth(0) + m_View->columnWidth(1) + m_View->columnWidth(2) + m_View->columnWidth(3), option.rect.height()));
|
||||
if (index.row() % 2 == 1) {
|
||||
m_ItemWidget->setBackgroundRole(QPalette::AlternateBase);
|
||||
} else {
|
||||
@@ -208,7 +230,11 @@ void DownloadListWidgetCompactDelegate::issueQueryInfo()
|
||||
|
||||
void DownloadListWidgetCompactDelegate::issueDelete()
|
||||
{
|
||||
emit removeDownload(m_ContextIndex.row(), true);
|
||||
if (QMessageBox::question(nullptr, tr("Are you sure?"),
|
||||
tr("This will permanently delete the selected download."),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||
emit removeDownload(m_ContextIndex.row(), true);
|
||||
}
|
||||
}
|
||||
|
||||
void DownloadListWidgetCompactDelegate::issueRemoveFromView()
|
||||
@@ -216,11 +242,27 @@ void DownloadListWidgetCompactDelegate::issueRemoveFromView()
|
||||
emit removeDownload(m_ContextIndex.row(), false);
|
||||
}
|
||||
|
||||
void DownloadListWidgetCompactDelegate::issueVisitOnNexus()
|
||||
{
|
||||
emit visitOnNexus(m_ContextIndex.row());
|
||||
}
|
||||
|
||||
void DownloadListWidgetCompactDelegate::issueOpenInDownloadsFolder()
|
||||
{
|
||||
emit openInDownloadsFolder(m_ContextIndex.row());
|
||||
}
|
||||
|
||||
void DownloadListWidgetCompactDelegate::issueRestoreToView()
|
||||
{
|
||||
emit restoreDownload(m_ContextIndex.row());
|
||||
emit restoreDownload(m_ContextIndex.row());
|
||||
}
|
||||
|
||||
void DownloadListWidgetCompactDelegate::issueRestoreToViewAll()
|
||||
{
|
||||
emit restoreDownload(-1);
|
||||
}
|
||||
|
||||
|
||||
void DownloadListWidgetCompactDelegate::issueCancel()
|
||||
{
|
||||
emit cancelDownload(m_ContextIndex.row());
|
||||
@@ -254,6 +296,15 @@ void DownloadListWidgetCompactDelegate::issueDeleteCompleted()
|
||||
}
|
||||
}
|
||||
|
||||
void DownloadListWidgetCompactDelegate::issueDeleteUninstalled()
|
||||
{
|
||||
if (QMessageBox::question(nullptr, tr("Are you sure?"),
|
||||
tr("This will remove all uninstalled downloads from this list and from disk."),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||
emit removeDownload(-3, true);
|
||||
}
|
||||
}
|
||||
|
||||
void DownloadListWidgetCompactDelegate::issueRemoveFromViewAll()
|
||||
{
|
||||
if (QMessageBox::question(nullptr, tr("Are you sure?"),
|
||||
@@ -272,6 +323,15 @@ void DownloadListWidgetCompactDelegate::issueRemoveFromViewCompleted()
|
||||
}
|
||||
}
|
||||
|
||||
void DownloadListWidgetCompactDelegate::issueRemoveFromViewUninstalled()
|
||||
{
|
||||
if (QMessageBox::question(nullptr, tr("Are you sure?"),
|
||||
tr("This will permanently remove all uninstalled downloads from this list (but NOT from disk)."),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||
emit removeDownload(-3, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool DownloadListWidgetCompactDelegate::editorEvent(QEvent *event, QAbstractItemModel *model,
|
||||
const QStyleOptionViewItem &option, const QModelIndex &index)
|
||||
@@ -281,7 +341,7 @@ bool DownloadListWidgetCompactDelegate::editorEvent(QEvent *event, QAbstractItem
|
||||
QModelIndex sourceIndex = qobject_cast<QSortFilterProxyModel*>(model)->mapToSource(index);
|
||||
if (m_Manager->getState(sourceIndex.row()) >= DownloadManager::STATE_READY) {
|
||||
emit installDownload(sourceIndex.row());
|
||||
} else if (m_Manager->getState(sourceIndex.row()) >= DownloadManager::STATE_PAUSED) {
|
||||
} else if ((m_Manager->getState(sourceIndex.row()) >= DownloadManager::STATE_PAUSED) || (m_Manager->getState(sourceIndex.row()) == DownloadManager::STATE_PAUSING)) {
|
||||
emit resumeDownload(sourceIndex.row());
|
||||
}
|
||||
return true;
|
||||
@@ -298,7 +358,11 @@ bool DownloadListWidgetCompactDelegate::editorEvent(QEvent *event, QAbstractItem
|
||||
menu.addAction(tr("Install"), this, SLOT(issueInstall()));
|
||||
if (m_Manager->isInfoIncomplete(m_ContextIndex.row())) {
|
||||
menu.addAction(tr("Query Info"), this, SLOT(issueQueryInfo()));
|
||||
}else {
|
||||
menu.addAction(tr("Visit on Nexus"), this, SLOT(issueVisitOnNexus()));
|
||||
}
|
||||
menu.addAction(tr("Show in Folder"), this, SLOT(issueOpenInDownloadsFolder()));
|
||||
menu.addSeparator();
|
||||
menu.addAction(tr("Delete"), this, SLOT(issueDelete()));
|
||||
if (hidden) {
|
||||
menu.addAction(tr("Un-Hide"), this, SLOT(issueRestoreToView()));
|
||||
@@ -308,20 +372,27 @@ bool DownloadListWidgetCompactDelegate::editorEvent(QEvent *event, QAbstractItem
|
||||
} else if (state == DownloadManager::STATE_DOWNLOADING){
|
||||
menu.addAction(tr("Cancel"), this, SLOT(issueCancel()));
|
||||
menu.addAction(tr("Pause"), this, SLOT(issuePause()));
|
||||
} else if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR)) {
|
||||
menu.addAction(tr("Show in Folder"), this, SLOT(issueOpenInDownloadsFolder()));
|
||||
} else if ((state == DownloadManager::STATE_PAUSED) || (state == DownloadManager::STATE_ERROR) || (state == DownloadManager::STATE_PAUSING)) {
|
||||
menu.addAction(tr("Remove"), this, SLOT(issueDelete()));
|
||||
menu.addAction(tr("Resume"), this, SLOT(issueResume()));
|
||||
menu.addAction(tr("Show in Folder"), this, SLOT(issueOpenInDownloadsFolder()));
|
||||
}
|
||||
|
||||
menu.addSeparator();
|
||||
}
|
||||
menu.addAction(tr("Delete Installed..."), this, SLOT(issueDeleteCompleted()));
|
||||
menu.addAction(tr("Delete Uninstalled..."), this, SLOT(issueDeleteUninstalled()));
|
||||
menu.addAction(tr("Delete All..."), this, SLOT(issueDeleteAll()));
|
||||
if (!hidden) {
|
||||
menu.addSeparator();
|
||||
menu.addAction(tr("Hide Installed..."), this, SLOT(issueRemoveFromViewCompleted()));
|
||||
menu.addAction(tr("Hide Uninstalled..."), this, SLOT(issueRemoveFromViewUninstalled()));
|
||||
menu.addAction(tr("Hide All..."), this, SLOT(issueRemoveFromViewAll()));
|
||||
}
|
||||
if (hidden) {
|
||||
menu.addSeparator();
|
||||
menu.addAction(tr("Un-Hide All..."), this, SLOT(issueRestoreToViewAll()));
|
||||
}
|
||||
menu.exec(mouseEvent->globalPos());
|
||||
|
||||
event->accept();
|
||||
@@ -334,4 +405,3 @@ bool DownloadListWidgetCompactDelegate::editorEvent(QEvent *event, QAbstractItem
|
||||
|
||||
return QItemDelegate::editorEvent(event, model, option, index);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class DownloadListWidgetCompact;
|
||||
class DownloadListWidgetCompact : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
explicit DownloadListWidgetCompact(QWidget *parent = 0);
|
||||
~DownloadListWidgetCompact();
|
||||
@@ -69,9 +69,12 @@ signals:
|
||||
void cancelDownload(int index);
|
||||
void pauseDownload(int index);
|
||||
void resumeDownload(int index);
|
||||
void visitOnNexus(int index);
|
||||
void openInDownloadsFolder(int index);
|
||||
|
||||
protected:
|
||||
|
||||
QString sizeFormat(quint64 size) const;
|
||||
bool editorEvent(QEvent *event, QAbstractItemModel *model,
|
||||
const QStyleOptionViewItem &option, const QModelIndex &index);
|
||||
|
||||
@@ -87,13 +90,18 @@ private slots:
|
||||
void issueDelete();
|
||||
void issueRemoveFromView();
|
||||
void issueRestoreToView();
|
||||
void issueRestoreToViewAll();
|
||||
void issueVisitOnNexus();
|
||||
void issueOpenInDownloadsFolder();
|
||||
void issueCancel();
|
||||
void issuePause();
|
||||
void issueResume();
|
||||
void issueDeleteAll();
|
||||
void issueDeleteCompleted();
|
||||
void issueDeleteUninstalled();
|
||||
void issueRemoveFromViewAll();
|
||||
void issueRemoveFromViewCompleted();
|
||||
void issueRemoveFromViewUninstalled();
|
||||
void issueQueryInfo();
|
||||
|
||||
void stateChanged(int row, DownloadManager::DownloadState);
|
||||
@@ -119,4 +127,3 @@ private:
|
||||
};
|
||||
|
||||
#endif // DOWNLOADLISTWIDGETCOMPACT_H
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,0">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
@@ -58,18 +58,25 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="sizeLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="doneLabel">
|
||||
<property name="sizePolicy">
|
||||
|
||||
+412
-111
File diff suppressed because it is too large
Load Diff
+61
-16
@@ -29,6 +29,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include <QFile>
|
||||
#include <QNetworkReply>
|
||||
#include <QTime>
|
||||
#include <QTimer>
|
||||
#include <QVector>
|
||||
#include <QMap>
|
||||
#include <QStringList>
|
||||
@@ -38,6 +39,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 +76,9 @@ 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;
|
||||
bool m_HasData;
|
||||
DownloadState m_State;
|
||||
int m_CurrentUrl;
|
||||
QStringList m_Urls;
|
||||
@@ -92,7 +96,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 +116,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)), m_HasData(false) {}
|
||||
};
|
||||
|
||||
public:
|
||||
@@ -134,6 +138,13 @@ public:
|
||||
**/
|
||||
bool downloadsInProgress();
|
||||
|
||||
/**
|
||||
* @brief determine if a download is currently in progress, does not count paused ones.
|
||||
*
|
||||
* @return true if there is currently a download in progress (that is not paused already).
|
||||
**/
|
||||
bool downloadsInProgressNoPause();
|
||||
|
||||
/**
|
||||
* @brief set the output directory to write to
|
||||
*
|
||||
@@ -141,6 +152,17 @@ public:
|
||||
**/
|
||||
void setOutputDirectory(const QString &outputDirectory);
|
||||
|
||||
/**
|
||||
* @brief disables feedback from the downlods fileSystemWhatcher untill disableDownloadsWatcherEnd() is called
|
||||
*
|
||||
**/
|
||||
static void startDisableDirWatcher();
|
||||
|
||||
/**
|
||||
* @brief re-enables feedback from the downlods fileSystemWhatcher after disableDownloadsWatcherStart() was called
|
||||
**/
|
||||
static void endDisableDirWatcher();
|
||||
|
||||
/**
|
||||
* @return current download directory
|
||||
**/
|
||||
@@ -162,6 +184,8 @@ public:
|
||||
*/
|
||||
void setShowHidden(bool showHidden);
|
||||
|
||||
void setPluginContainer(PluginContainer *pluginContainer);
|
||||
|
||||
/**
|
||||
* @brief download from an already open network connection
|
||||
*
|
||||
@@ -179,7 +203,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 +233,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 +280,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 +309,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 +443,19 @@ public slots:
|
||||
|
||||
void queryInfo(int index);
|
||||
|
||||
void nxmDescriptionAvailable(int modID, QVariant userData, QVariant resultData, int requestID);
|
||||
void visitOnNexus(int index);
|
||||
|
||||
void nxmFilesAvailable(int modID, QVariant userData, QVariant resultData, int requestID);
|
||||
void openInDownloadsFolder(int index);
|
||||
|
||||
void nxmFileInfoAvailable(int modID, int fileID, QVariant userData, QVariant resultData, int requestID);
|
||||
void nxmDescriptionAvailable(QString gameName, int modID, QVariant userData, QVariant resultData, int requestID);
|
||||
|
||||
void nxmDownloadURLsAvailable(int modID, int fileID, QVariant userData, QVariant resultData, int requestID);
|
||||
void nxmFilesAvailable(QString gameName, int modID, QVariant userData, QVariant resultData, int requestID);
|
||||
|
||||
void nxmRequestFailed(int modID, int fileID, QVariant userData, int requestID, const QString &errorString);
|
||||
void nxmFileInfoAvailable(QString gameName, 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(QString gameName, int modID, int fileID, QVariant userData, int requestID, const QString &errorString);
|
||||
|
||||
void managedGameChanged(MOBase::IPluginGame const *gamePlugin);
|
||||
|
||||
@@ -427,10 +463,11 @@ 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);
|
||||
void checkDownloadTimeout();
|
||||
|
||||
private:
|
||||
|
||||
@@ -448,7 +485,7 @@ public:
|
||||
*
|
||||
* @return Unique(ish) name
|
||||
*/
|
||||
QString getDownloadFileName(const QString &baseName) const;
|
||||
QString getDownloadFileName(const QString &baseName, bool rename = false) const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -462,7 +499,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 +518,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 +530,7 @@ private:
|
||||
|
||||
NexusInterface *m_NexusInterface;
|
||||
|
||||
QVector<std::pair<int, int> > m_PendingDownloads;
|
||||
QVector<std::tuple<QString, int, int>> m_PendingDownloads;
|
||||
|
||||
QVector<DownloadInfo*> m_ActiveDownloads;
|
||||
|
||||
@@ -505,6 +542,12 @@ private:
|
||||
|
||||
QFileSystemWatcher m_DirWatcher;
|
||||
|
||||
//The dirWatcher is actually triggering off normal Mo operations such as deleting downloads or editing .meta files
|
||||
//so it needs to be disabled during operations that are known to cause the creation or deletion of files in the Downloads folder.
|
||||
//Notably using QSettings to edit a file creates a temporarily .lock file that causes the Watcher to trigger multiple listRefreshes freezing the ui.
|
||||
static int m_DirWatcherDisabler;
|
||||
|
||||
|
||||
std::map<QString, int> m_DownloadFails;
|
||||
|
||||
bool m_ShowHidden;
|
||||
@@ -512,6 +555,8 @@ private:
|
||||
QRegExp m_DateExpression;
|
||||
|
||||
MOBase::IPluginGame const *m_ManagedGame;
|
||||
|
||||
QTimer m_TimeoutTimer;
|
||||
};
|
||||
|
||||
|
||||
|
||||
+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;
|
||||
|
||||
|
||||
+32
-3
@@ -131,11 +131,12 @@ QString InstanceManager::manageInstances(const QStringList &instanceList) const
|
||||
QString InstanceManager::queryInstanceName(const QStringList &instanceList) const
|
||||
{
|
||||
QString instanceId;
|
||||
QString dialogText;
|
||||
while (instanceId.isEmpty()) {
|
||||
QInputDialog dialog;
|
||||
|
||||
dialog.setWindowTitle(QObject::tr("Enter a Name for the new Instance"));
|
||||
dialog.setLabelText(QObject::tr("Enter a new name or select one from the sugested list (only letters and numbers allowed):"));
|
||||
dialog.setWindowTitle(QObject::tr("Enter a Name for the new Instance"));
|
||||
dialog.setLabelText(QObject::tr("Enter a new name or select one from the suggested list:"));
|
||||
// would be neat if we could take the names from the game plugins but
|
||||
// the required initialization order requires the ini file to be
|
||||
// available *before* we load plugins
|
||||
@@ -146,7 +147,17 @@ QString InstanceManager::queryInstanceName(const QStringList &instanceList) cons
|
||||
if (dialog.exec() == QDialog::Rejected) {
|
||||
throw MOBase::MyException(QObject::tr("Canceled"));
|
||||
}
|
||||
instanceId = dialog.textValue().replace(QRegExp("[^0-9a-zA-Z ]"), "");
|
||||
dialogText = dialog.textValue();
|
||||
instanceId = sanitizeInstanceName(dialogText);
|
||||
if (instanceId != dialogText) {
|
||||
if (QMessageBox::question( nullptr,
|
||||
QObject::tr("Invalid instance name"),
|
||||
QObject::tr("The instance name \"%1\" is invalid. Use the name \"%2\" instead?").arg(dialogText,instanceId),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) {
|
||||
instanceId="";
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
bool alreadyExists=false;
|
||||
for (const QString &instance : instanceList) {
|
||||
@@ -296,3 +307,21 @@ QString InstanceManager::determineDataPath()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QString InstanceManager::sanitizeInstanceName(const QString &name) const
|
||||
{
|
||||
QString new_name = name;
|
||||
|
||||
// Restrict the allowed characters
|
||||
new_name = new_name.remove(QRegExp("[^A-Za-z0-9 _=+;!@#$%^'\\-\\.\\[\\]\\{\\}\\(\\)]"));
|
||||
|
||||
// Don't end in spaces and periods
|
||||
new_name = new_name.remove(QRegExp("\\.*$"));
|
||||
new_name = new_name.remove(QRegExp(" *$"));
|
||||
|
||||
// Recurse until stuff stops changing
|
||||
if (new_name != name) {
|
||||
return sanitizeInstanceName(new_name);
|
||||
}
|
||||
return new_name;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user