Compare commits

..
Author SHA1 Message Date
isanae 08e0d85d85 added DownloadInfo for headers and user agent 2021-03-02 19:14:14 -05:00
isanae 2094d7d15f added IPluginRepository to container
downloads now have an IRepositoryDownload to manage the actual downloads
curl downloader uses IDownload and IDownloader
download stats, allow downloading to buffer
2021-03-02 17:15:52 -05:00
isanae 25a69bccd3 split queue back into manager 2021-02-17 14:16:55 -05:00
isanae a39a80ec4c log wrapper, verbose log
log curl version
2021-02-17 11:18:28 -05:00
isanae 42d432e5aa moved to curldownloader 2021-02-16 04:53:49 -05:00
isanae acb55d431c fixed output file staying opened when moving to queue
refactored removing from queue
2021-02-16 04:43:26 -05:00
isanae 95a2cc93b9 queue management 2021-02-16 04:23:20 -05:00
isanae 35a0474ac1 initial new download manager 2021-02-16 02:33:20 -05:00
442 changed files with 45450 additions and 48655 deletions
-41
View File
@@ -1,41 +0,0 @@
---
# We'll use defaults from the LLVM style, but with 4 columns indentation.
BasedOnStyle: LLVM
IndentWidth: 2
---
Language: Cpp
DeriveLineEnding: false
UseCRLF: true
DerivePointerAlignment: false
PointerAlignment: Left
AlignConsecutiveAssignments: true
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Empty
AlwaysBreakTemplateDeclarations: Yes
AccessModifierOffset: -2
AlignTrailingComments: true
SpacesBeforeTrailingComments: 2
NamespaceIndentation: Inner
MaxEmptyLinesToKeep: 1
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: false
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: true
ColumnLimit: 88
ForEachMacros: ['Q_FOREACH', 'foreach']
-2
View File
@@ -1,2 +0,0 @@
d13f6bb870cdda71257f665367be8ef9fca86255
86bb01ba9eac879d3685c439ac9da0028bc4bc80
-7
View File
@@ -1,7 +0,0 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.cpp text eol=crlf
*.h text eol=crlf
@@ -2,7 +2,7 @@
name: Game support Request
about: Request support for a new game
title: Add support for game [GAME NAME]
labels: 'Feature Request, additional games support, area: mo2 game plugins'
labels: 'additional games support, Feature Request, area: mo2 game plugins'
assignees: ''
---
@@ -18,7 +18,7 @@ assignees: ''
- **Nexus ID [optional]:** ID of the game on Nexus (you can usually find this in Nexus URL).
- **Executable:** Name of the main executable for the game (relative to the game folder).
- **Launcher [optional]:** Name of the game launcher (relative to the game folder).
- **Data path:** Path to the data folder of the game (relative to the game folder). Please note that the Virtual Files System often does not work for top level dlls or exe files.
- **Data path:** Path to the data folder of the game (relative to the game folder).
- **Documents path:** Path to folder containing INI files, etc., for the game (usually under "My Games", or the game folder itself).
- **Saves directory [optional]:** Path to the folder containing save games (this default to the path above).
- **Save extension [optional]:** Extension of the saves
+1 -1
View File
@@ -8,7 +8,7 @@ assignees: ''
---
## The problem:
Briefly describe the issue you are experiencing. Tell us what you were trying to do and what happened instead. Remember, this is _not_ a place to ask questions. For that, go to our [Discord server](https://discord.gg/ewUVAqyrQX).
Briefly describe the issue you are experiencing. Tell us what you were trying to do and what happened instead. Remember, this is _not_ a place to ask questions. For that, go to our [discord channel](https://discord.gg/5tCqt6V)
## To Reproduce:
-20
View File
@@ -1,20 +0,0 @@
name: Build ModOrganizer 2
on:
push:
branches: master
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
runs-on: windows-2022
steps:
- name: Build ModOrganizer 2
uses: ModOrganizer2/build-with-mob-action@master
with:
qt-modules: qtpositioning qtwebchannel qtwebengine qtwebsockets
mo2-third-parties:
7z zlib gtest libbsarch libloot openssl bzip2 python lz4 spdlog
boost boost-di sip pyqt pybind11 ss licenses explorerpp DirectXTex
mo2-dependencies: usvfs cmake_common uibase githubpp bsatk esptk archive lootcli game_gamebryo
-17
View File
@@ -1,17 +0,0 @@
name: Lint ModOrganizer 2
on:
push:
pull_request:
types: [opened, synchronize, reopened]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check format
uses: ModOrganizer2/check-formatting-action@master
with:
check-path: "."
exclude-regex: "third-party"
+11 -7
View File
@@ -1,16 +1,20 @@
cmake_minimum_required(VERSION 3.16)
# TODO: move these to cmake_common?
set(OPENSSL_USE_STATIC_LIBS FALSE CACHE STRING "" FORCE)
set(MySQL_INCLUDE_DIRS CACHE STRING "" FORCE)
project(organizer)
set(project_type exe)
set(executable_name ModOrganizer)
set(enable_warnings OFF)
# appveyor does not build modorganizer in its standard location, so use
# DEPENDENCIES_DIR to find cmake_common
if(DEFINED DEPENDENCIES_DIR)
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/mo2.cmake)
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/project.cmake)
else()
include(${CMAKE_CURRENT_LIST_DIR}/../cmake_common/mo2.cmake)
include(../cmake_common/project.cmake)
endif()
project(organizer)
set(additional_translations ${uibase_path}/src)
add_subdirectory(src)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dump_running_process.bat DESTINATION bin)
install(FILES dump_running_process.bat DESTINATION bin)
BIN
View File
Binary file not shown.
+2 -2
View File
@@ -12,7 +12,7 @@ The project took up speed again after a few more coders showed up in late 2017,
## Help Wanted!
Mod Organizer 2 is an open project in the hands of the community, there are problems that need to be solved and things that could be added. MO2 really needs developers and if you have the programming skills and some free time you can really improve the experience of the modding community.
To have more information, please join the open MO2 Development discord server: [Mod Organizer 2](https://discord.gg/ewUVAqyrQX)
To have more information, please join the open MO2 Development discord server: [Mod Organizer 2](https://discord.gg/vD2ZbfX)
If you want to help translate MO2 to your language you should join the discord server too and head to the #translation channel.
To setup a development environment on your machine, there is the [mob project](https://github.com/modorganizer2/mob) that handles that.
If you want to submit your code changes, please use a good formatting style like the default one in Visual Studio.
@@ -20,7 +20,7 @@ If you want to submit your code changes, please use a good formatting style like
Through the work of a few people of the community MO2 has come quite far, now it needs some more of those people to go further.
## Reporting Issues:
Issues should be reported to the GitHub page or on the open discord server: [Mod Organizer 2](https://discord.gg/ewUVAqyrQX). Here is also where dev builds are tested, bugs are reported and investigated, suggestions are discussed and a lot more.
Issues should be reported to the GitHub page or on the open discord server: [Mod Organizer 2](https://discord.gg/vD2ZbfX). Here is also where dev builds are tested, bugs are reported and investigated, suggestions are discussed and a lot more.
Credits to Tannin, LePresidente, Silarn, erasmux, AL12, LostDragonist, AnyOldName3, isa, Holt59 and many others for the development.
+57 -63
View File
@@ -1,37 +1,15 @@
cmake_minimum_required(VERSION 3.16)
add_executable(organizer)
set_target_properties(organizer PROPERTIES OUTPUT_NAME "ModOrganizer")
mo2_configure_executable(organizer
WARNINGS OFF
EXTRA_TRANSLATIONS ${MO2_SUPER_PATH}/game_gamebryo/src ${MO2_UIBASE_PATH}/src
PRIVATE_DEPENDS
uibase githubpp bsatk esptk archive usvfs lootcli boost::program_options
DirectXTex libbsarch Qt::WebEngineWidgets Qt::WebSockets)
target_link_libraries(organizer PUBLIC Shlwapi)
target_include_directories(organizer PUBLIC ${DDS_ROOT})
mo2_install_target(organizer)
# appveyor does not build modorganizer in its standard location, so use
# DEPENDENCIES_DIR to find cmake_common
if(DEFINED DEPENDENCIES_DIR)
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/src.cmake)
else()
include(../cmake_common/src.cmake)
endif()
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/dlls.manifest.qt6"
DESTINATION bin/dlls
CONFIGURATIONS Release RelWithDebInfo
RENAME dlls.manifest)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/dlls.manifest.debug.qt6"
DESTINATION bin/dlls
CONFIGURATIONS Debug
RENAME dlls.manifest)
install(DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}/stylesheets"
"${CMAKE_CURRENT_SOURCE_DIR}/tutorials"
DESTINATION bin)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/resources/markdown.html"
DESTINATION bin/resources)
mo2_deploy_qt(BINARIES ModOrganizer.exe uibase.dll plugins/bsa_packer.dll)
mo2_add_filter(NAME src/application GROUPS
add_filter(NAME src/application GROUPS
iuserinterface
commandline
main
@@ -43,36 +21,29 @@ mo2_add_filter(NAME src/application GROUPS
updatedialog
)
mo2_add_filter(NAME src/browser GROUPS
add_filter(NAME src/browser GROUPS
browserdialog
browserview
)
mo2_add_filter(NAME src/categories GROUPS
categories
categoriestable
categoriesdialog
categoryimportdialog
)
mo2_add_filter(NAME src/core GROUPS
add_filter(NAME src/core GROUPS
categories
archivefiletree
installationmanager
nexusinterface
nxmaccessmanager
organizercore
game_features
plugincontainer
apiuseraccount
processrunner
qdirfiletree
virtualfiletree
uilocker
)
mo2_add_filter(NAME src/dialogs GROUPS
add_filter(NAME src/dialogs GROUPS
aboutdialog
activatemodsdialog
categoriesdialog
credentialsdialog
filedialogmemory
forcedloaddialog
@@ -90,13 +61,14 @@ mo2_add_filter(NAME src/dialogs GROUPS
waitingonclosedialog
)
mo2_add_filter(NAME src/downloads GROUPS
add_filter(NAME src/downloads GROUPS
downloadlist
downloadlistview
downloadmanager
downloadmanager2
)
mo2_add_filter(NAME src/env GROUPS
add_filter(NAME src/env GROUPS
env
envdump
envfs
@@ -108,24 +80,24 @@ mo2_add_filter(NAME src/env GROUPS
envwindows
)
mo2_add_filter(NAME src/executables GROUPS
add_filter(NAME src/executables GROUPS
executableslist
editexecutablesdialog
)
mo2_add_filter(NAME src/instances GROUPS
add_filter(NAME src/instances GROUPS
createinstancedialog
createinstancedialogpages
instancemanager
instancemanagerdialog
)
mo2_add_filter(NAME src/loot GROUPS
add_filter(NAME src/loot GROUPS
loot
lootdialog
)
mo2_add_filter(NAME src/mainwindow GROUPS
add_filter(NAME src/mainwindow GROUPS
datatab
downloadstab
iconfetcher
@@ -137,7 +109,7 @@ mo2_add_filter(NAME src/mainwindow GROUPS
statusbar
)
mo2_add_filter(NAME src/modinfo GROUPS
add_filter(NAME src/modinfo GROUPS
modinfo
modinfobackup
modinfoforeign
@@ -147,7 +119,7 @@ mo2_add_filter(NAME src/modinfo GROUPS
modinfowithconflictinfo
)
mo2_add_filter(NAME src/modinfo/dialog GROUPS
add_filter(NAME src/modinfo/dialog GROUPS
modinfodialog
modinfodialogcategories
modinfodialogconflicts
@@ -161,18 +133,18 @@ mo2_add_filter(NAME src/modinfo/dialog GROUPS
modinfodialogtextfiles
)
mo2_add_filter(NAME src/modinfo/dialog/widgets GROUPS
add_filter(NAME src/modinfo/dialog/widgets GROUPS
modidlineedit
)
mo2_add_filter(NAME src/modlist GROUPS
add_filter(NAME src/modlist GROUPS
modlist
modlistdropinfo
modlistsortproxy
modlistbypriorityproxy
)
mo2_add_filter(NAME src/modlist/view GROUPS
add_filter(NAME src/modlist/view GROUPS
filterlist
modlistview
modlistviewactions
@@ -183,34 +155,33 @@ mo2_add_filter(NAME src/modlist/view GROUPS
modlistversiondelegate
)
mo2_add_filter(NAME src/plugins GROUPS
add_filter(NAME src/plugins GROUPS
pluginlist
pluginlistsortproxy
pluginlistview
pluginlistcontextmenu
)
mo2_add_filter(NAME src/previews GROUPS
add_filter(NAME src/previews GROUPS
previewdialog
previewgenerator
)
mo2_add_filter(NAME src/profiles GROUPS
add_filter(NAME src/profiles GROUPS
profile
profileinputdialog
profilesdialog
)
mo2_add_filter(NAME src/proxies GROUPS
add_filter(NAME src/proxies GROUPS
downloadmanagerproxy
gamefeaturesproxy
modlistproxy
organizerproxy
pluginlistproxy
proxyutils
)
mo2_add_filter(NAME src/register GROUPS
add_filter(NAME src/register GROUPS
shared/directoryentry
shared/fileentry
shared/filesorigin
@@ -220,12 +191,12 @@ mo2_add_filter(NAME src/register GROUPS
directoryrefresher
)
mo2_add_filter(NAME src/settings GROUPS
add_filter(NAME src/settings GROUPS
settings
settingsutilities
)
mo2_add_filter(NAME src/settingsdialog GROUPS
add_filter(NAME src/settingsdialog GROUPS
settingsdialog
settingsdialogdiagnostics
settingsdialoggeneral
@@ -238,7 +209,7 @@ mo2_add_filter(NAME src/settingsdialog GROUPS
disableproxyplugindialog
)
mo2_add_filter(NAME src/utilities GROUPS
add_filter(NAME src/utilities GROUPS
shared/appconfig
bbcode
csvbuilder
@@ -253,7 +224,7 @@ mo2_add_filter(NAME src/utilities GROUPS
glob_matching
)
mo2_add_filter(NAME src/widgets GROUPS
add_filter(NAME src/widgets GROUPS
colortable
genericicondelegate
filerenamer
@@ -268,3 +239,26 @@ mo2_add_filter(NAME src/widgets GROUPS
modelutils
copyeventfilter
)
requires_project(game_features githubpp bsatk esptk archive usvfs)
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE
${modorganizer_super_path}/lootcli/include
)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/dlls.manifest.qt5"
DESTINATION bin/dlls
RENAME dlls.manifest)
install(FILES ${qm_files} DESTINATION bin/translations)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/stylesheets"
"${CMAKE_CURRENT_SOURCE_DIR}/tutorials"
DESTINATION bin)
deploy_qt(BINARIES ModOrganizer.exe uibase.dll plugins/bsa_packer.dll)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../qdds.dll" DESTINATION bin/dlls/imageformats)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/resources/markdown.html" DESTINATION bin/resources)
-4
View File
@@ -40,10 +40,6 @@ greaterThan(QT_MAJOR_VERSION, 4) {
QTLIBNAMES += Core Declarative Gui Network OpenGL Script Sql Svg Webkit Xml XmlPatterns
}
greaterThan(QT_MAJOR_VERSION, 5) {
QTLIBNAMES += OpenGLWidgets
}
QTLIBSUFFIX = $${QT_MAJOR_VERSION}.dll
CONFIG(debug, debug|release): QTLIBSUFFIX = "d$${QTLIBSUFFIX}" # Can't use Debug: .. here, it ignores the line - no idea why, as it works in BossDummy.pro
+124 -126
View File
@@ -1,126 +1,124 @@
/*
Copyright (C) 2014 Sebastian Herbord. All rights reserved.
This file is part of Mod Organizer.
Mod Organizer is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Mod Organizer is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
*/
#include "aboutdialog.h"
#include "shared/util.h"
#include "ui_aboutdialog.h"
#include <utility.h>
#include <QApplication>
#include <QFontDatabase>
#include <QLabel>
#include <QListWidget>
#include <QListWidgetItem>
#include <QTextBrowser>
#include <QVariant>
#include <Qt>
AboutDialog::AboutDialog(const QString& version, QWidget* parent)
: QDialog(parent), ui(new Ui::AboutDialog)
{
ui->setupUi(this);
m_LicenseFiles[LICENSE_LGPL3] = "LGPL-v3.0.txt";
m_LicenseFiles[LICENSE_LGPL21] = "GNU-LGPL-v2.1.txt";
m_LicenseFiles[LICENSE_GPL3] = "GPL-v3.0.txt";
m_LicenseFiles[LICENSE_GPL2] = "GPL-v2.0.txt";
m_LicenseFiles[LICENSE_BOOST] = "boost.txt";
m_LicenseFiles[LICENSE_7ZIP] = "7zip.txt";
m_LicenseFiles[LICENSE_CCBY3] = "BY-SA-v3.0.txt";
m_LicenseFiles[LICENSE_ZLIB] = "zlib.txt";
m_LicenseFiles[LICENSE_PYTHON] = "python.txt";
m_LicenseFiles[LICENSE_SSL] = "openssl.txt";
m_LicenseFiles[LICENSE_CPPTOML] = "cpptoml.txt";
m_LicenseFiles[LICENSE_UDIS] = "udis86.txt";
m_LicenseFiles[LICENSE_SPDLOG] = "spdlog.txt";
m_LicenseFiles[LICENSE_FMT] = "fmt.txt";
m_LicenseFiles[LICENSE_SIP] = "sip.txt";
m_LicenseFiles[LICENSE_CASTLE] = "Castle.txt";
m_LicenseFiles[LICENSE_ANTLR] = "AntlrBuildTask.txt";
m_LicenseFiles[LICENSE_DXTEX] = "DXTex.txt";
m_LicenseFiles[LICENSE_VDF] = "ValveFileVDF.txt";
addLicense("Qt", LICENSE_LGPL3);
addLicense("Qt Json", LICENSE_GPL3);
addLicense("Boost Library", LICENSE_BOOST);
addLicense("7-zip", LICENSE_7ZIP);
addLicense("ZLib", LICENSE_NONE);
addLicense("Tango Icon Theme", LICENSE_NONE);
addLicense("RRZE Icon Set", LICENSE_CCBY3);
addLicense("Icons by Lorc, Delapouite and sbed available on http://game-icons.net",
LICENSE_CCBY3);
addLicense("Castle Core", LICENSE_CASTLE);
addLicense("ANTLR", LICENSE_ANTLR);
addLicense("LOOT", LICENSE_GPL3);
addLicense("Python", LICENSE_PYTHON);
addLicense("OpenSSL", LICENSE_SSL);
addLicense("cpptoml", LICENSE_CPPTOML);
addLicense("Udis86", LICENSE_UDIS);
addLicense("spdlog", LICENSE_SPDLOG);
addLicense("{fmt}", LICENSE_FMT);
addLicense("SIP", LICENSE_SIP);
addLicense("DXTex Headers", LICENSE_DXTEX);
addLicense("Valve File VDF Reader", LICENSE_VDF);
ui->nameLabel->setText(
QString("<span style=\"font-size:12pt; font-weight:600;\">%1 %2</span>")
.arg(ui->nameLabel->text())
.arg(version));
#if defined(HGID)
ui->revisionLabel->setText(ui->revisionLabel->text() + " " + HGID);
#elif defined(GITID)
ui->revisionLabel->setText(ui->revisionLabel->text() + " " + GITID);
#else
ui->revisionLabel->setText(ui->revisionLabel->text() + " unknown");
#endif
ui->usvfsLabel->setText(ui->usvfsLabel->text() + " " +
MOShared::getUsvfsVersionString());
ui->licenseText->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
}
AboutDialog::~AboutDialog()
{
delete ui;
}
void AboutDialog::addLicense(const QString& name, Licenses license)
{
QListWidgetItem* item = new QListWidgetItem(name);
item->setData(Qt::UserRole, license);
ui->creditsList->addItem(item);
}
void AboutDialog::on_creditsList_currentItemChanged(QListWidgetItem* current,
QListWidgetItem*)
{
auto iter = m_LicenseFiles.find(current->data(Qt::UserRole).toInt());
if (iter != m_LicenseFiles.end()) {
QString filePath = qApp->applicationDirPath() + "/licenses/" + iter->second;
QString text = MOBase::readFileText(filePath);
ui->licenseText->setText(text);
} else {
ui->licenseText->setText(tr("No license"));
}
}
void AboutDialog::on_sourceText_linkActivated(const QString& link)
{
MOBase::shell::Open(QUrl(link));
}
/*
Copyright (C) 2014 Sebastian Herbord. All rights reserved.
This file is part of Mod Organizer.
Mod Organizer is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Mod Organizer is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
*/
#include "aboutdialog.h"
#include "ui_aboutdialog.h"
#include "shared/util.h"
#include <utility.h>
#include <QApplication>
#include <QLabel>
#include <QListWidget>
#include <QListWidgetItem>
#include <QTextBrowser>
#include <QVariant>
#include <Qt>
#include <QFontDatabase>
AboutDialog::AboutDialog(const QString &version, QWidget *parent)
: QDialog(parent)
, ui(new Ui::AboutDialog)
{
ui->setupUi(this);
m_LicenseFiles[LICENSE_LGPL3] = "LGPL-v3.0.txt";
m_LicenseFiles[LICENSE_LGPL21] = "GNU-LGPL-v2.1.txt";
m_LicenseFiles[LICENSE_GPL3] = "GPL-v3.0.txt";
m_LicenseFiles[LICENSE_GPL2] = "GPL-v2.0.txt";
m_LicenseFiles[LICENSE_BOOST] = "boost.txt";
m_LicenseFiles[LICENSE_7ZIP] = "7zip.txt";
m_LicenseFiles[LICENSE_CCBY3] = "BY-SA-v3.0.txt";
m_LicenseFiles[LICENSE_ZLIB] = "zlib.txt";
m_LicenseFiles[LICENSE_PYTHON] = "python.txt";
m_LicenseFiles[LICENSE_SSL] = "openssl.txt";
m_LicenseFiles[LICENSE_CPPTOML] = "cpptoml.txt";
m_LicenseFiles[LICENSE_UDIS] = "udis86.txt";
m_LicenseFiles[LICENSE_SPDLOG] = "spdlog.txt";
m_LicenseFiles[LICENSE_FMT] = "fmt.txt";
m_LicenseFiles[LICENSE_SIP] = "sip.txt";
m_LicenseFiles[LICENSE_CASTLE] = "Castle.txt";
m_LicenseFiles[LICENSE_ANTLR] = "AntlrBuildTask.txt";
m_LicenseFiles[LICENSE_DXTEX] = "DXTex.txt";
addLicense("Qt", LICENSE_LGPL3);
addLicense("Qt Json", LICENSE_GPL3);
addLicense("Boost Library", LICENSE_BOOST);
addLicense("7-zip", LICENSE_7ZIP);
addLicense("ZLib", LICENSE_NONE);
addLicense("Tango Icon Theme", LICENSE_NONE);
addLicense("RRZE Icon Set", LICENSE_CCBY3);
addLicense("Icons by Lorc, Delapouite and sbed available on http://game-icons.net", LICENSE_CCBY3);
addLicense("Castle Core", LICENSE_CASTLE);
addLicense("ANTLR", LICENSE_ANTLR);
addLicense("LOOT", LICENSE_GPL3);
addLicense("Python", LICENSE_PYTHON);
addLicense("OpenSSL", LICENSE_SSL);
addLicense("cpptoml", LICENSE_CPPTOML);
addLicense("Udis86", LICENSE_UDIS);
addLicense("spdlog", LICENSE_SPDLOG);
addLicense("{fmt}", LICENSE_FMT);
addLicense("SIP", LICENSE_SIP);
addLicense("DXTex Headers", LICENSE_DXTEX);
ui->nameLabel->setText(QString("<span style=\"font-size:12pt; font-weight:600;\">%1 %2</span>").arg(ui->nameLabel->text()).arg(version));
#if defined(HGID)
ui->revisionLabel->setText(ui->revisionLabel->text() + " " + HGID);
#elif defined(GITID)
ui->revisionLabel->setText(ui->revisionLabel->text() + " " + GITID);
#else
ui->revisionLabel->setText(ui->revisionLabel->text() + " unknown");
#endif
ui->usvfsLabel->setText(ui->usvfsLabel->text() + " " + MOShared::getUsvfsVersionString());
ui->licenseText->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
}
AboutDialog::~AboutDialog()
{
delete ui;
}
void AboutDialog::addLicense(const QString &name, Licenses license)
{
QListWidgetItem *item = new QListWidgetItem(name);
item->setData(Qt::UserRole, license);
ui->creditsList->addItem(item);
}
void AboutDialog::on_creditsList_currentItemChanged(QListWidgetItem *current, QListWidgetItem*)
{
auto iter = m_LicenseFiles.find(current->data(Qt::UserRole).toInt());
if (iter != m_LicenseFiles.end()) {
QString filePath = qApp->applicationDirPath() + "/licenses/" + iter->second;
QString text = MOBase::readFileText(filePath);
ui->licenseText->setText(text);
} else {
ui->licenseText->setText(tr("No license"));
}
}
void AboutDialog::on_sourceText_linkActivated(const QString &link)
{
MOBase::shell::Open(QUrl(link));
}
+83 -82
View File
@@ -1,82 +1,83 @@
#ifndef ABOUTDIALOG_H
/*
Copyright (C) 2014 Sebastian Herbord. All rights reserved.
This file is part of Mod Organizer.
Mod Organizer is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Mod Organizer is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
*/
#define ABOUTDIALOG_H
#include <QDialog>
class QListWidgetItem;
#include <QObject>
#include <QString>
#include <map>
namespace Ui
{
class AboutDialog;
}
class AboutDialog : public QDialog
{
Q_OBJECT
public:
explicit AboutDialog(const QString& version, QWidget* parent = 0);
~AboutDialog();
private:
enum Licenses
{
LICENSE_NONE,
LICENSE_LGPL3,
LICENSE_LGPL21,
LICENSE_GPL3,
LICENSE_GPL2,
LICENSE_BOOST,
LICENSE_CCBY3,
LICENSE_PYTHON,
LICENSE_SSL,
LICENSE_CPPTOML,
LICENSE_7ZIP,
LICENSE_ZLIB,
LICENSE_UDIS,
LICENSE_SPDLOG,
LICENSE_FMT,
LICENSE_SIP,
LICENSE_CASTLE,
LICENSE_ANTLR,
LICENSE_DXTEX,
LICENSE_VDF,
};
private:
void addLicense(const QString& name, Licenses license);
private slots:
void on_creditsList_currentItemChanged(QListWidgetItem* current,
QListWidgetItem* previous);
void on_sourceText_linkActivated(const QString& link);
private:
Ui::AboutDialog* ui;
std::map<int, QString> m_LicenseFiles;
};
#endif // ABOUTDIALOG_H
#ifndef ABOUTDIALOG_H
/*
Copyright (C) 2014 Sebastian Herbord. All rights reserved.
This file is part of Mod Organizer.
Mod Organizer is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Mod Organizer is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
*/
#define ABOUTDIALOG_H
#include <QDialog>
class QListWidgetItem;
#include <QObject>
#include <QString>
#include <map>
namespace Ui {
class AboutDialog;
}
class AboutDialog : public QDialog
{
Q_OBJECT
public:
explicit AboutDialog(const QString &version, QWidget *parent = 0);
~AboutDialog();
private:
enum Licenses {
LICENSE_NONE,
LICENSE_LGPL3,
LICENSE_LGPL21,
LICENSE_GPL3,
LICENSE_GPL2,
LICENSE_BOOST,
LICENSE_CCBY3,
LICENSE_PYTHON,
LICENSE_SSL,
LICENSE_CPPTOML,
LICENSE_7ZIP,
LICENSE_ZLIB,
LICENSE_UDIS,
LICENSE_SPDLOG,
LICENSE_FMT,
LICENSE_SIP,
LICENSE_CASTLE,
LICENSE_ANTLR,
LICENSE_DXTEX
};
private:
void addLicense(const QString &name, Licenses license);
private slots:
void on_creditsList_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
void on_sourceText_linkActivated(const QString &link);
private:
Ui::AboutDialog *ui;
std::map<int, QString> m_LicenseFiles;
};
#endif // ABOUTDIALOG_H
+9 -84
View File
@@ -127,7 +127,7 @@
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Copyright © 2011-2016 Sebastian Herbord&lt;br/&gt;Copyright © 2016-2023 Mod Organizer 2 Contributors&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Copyright © 2011-2016 Sebastian Herbord&lt;br/&gt;Copyright © 2016-2019 Mod Organizer 2 Contributors&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@@ -261,11 +261,6 @@
<string notr="true">przester</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">Qudix</string>
</property>
</item>
</widget>
</item>
</layout>
@@ -297,31 +292,11 @@
<string notr="true">miraclefreak (Czech)</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">Meiton (Czech)</string>
</property>
</item>
<item>
<property name="text">
<string>Cyb3r (Dutch)</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">madmedic (Dutch)</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">Ilja (Finnish)</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">Mikmet (Finnish)</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">Alyndiar (French)</string>
@@ -347,11 +322,6 @@
<string>Yoplala (French)</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">CircleOfDao (German)</string>
</property>
</item>
<item>
<property name="text">
<string>Faron (German)</string>
@@ -367,11 +337,6 @@
<string notr="true">Xahtax (German)</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">Ypselon (German)</string>
</property>
</item>
<item>
<property name="text">
<string>yohru (Japanese)</string>
@@ -435,11 +400,6 @@
<string notr="true">Hakan &quot;Nyks45&quot; Albayrak (Turkish)</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">Kato (Turkish)</string>
</property>
</item>
<item>
<property name="text">
<string>...and all other contributors!</string>
@@ -466,7 +426,7 @@
</property>
<item>
<property name="text">
<string notr="true">Tannin (Original Creator)</string>
<string>Tannin (Original Creator)</string>
</property>
</item>
<item>
@@ -494,21 +454,11 @@
<string notr="true">Brixified</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">ddbb07</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">deathneko11</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">dekart811</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">DoubleYou</string>
@@ -519,26 +469,6 @@
<string notr="true">Drew Warwick</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">erri120</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">ianpatt</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">Falsellyu</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">foresto</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">GamerPoet</string>
@@ -561,17 +491,7 @@
</item>
<item>
<property name="text">
<string notr="true">JayLCypher</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">jimfcarroll</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">Luca|EzioTheDeadPoet</string>
<string>Luca|EzioTheDeadPoet</string>
</property>
</item>
<item>
@@ -586,7 +506,7 @@
</item>
<item>
<property name="text">
<string notr="true">Patchier</string>
<string>Patchier</string>
</property>
</item>
<item>
@@ -594,6 +514,11 @@
<string notr="true">PurpleFez</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">Qudix</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">reedts</string>
+96 -96
View File
@@ -1,96 +1,96 @@
/*
Copyright (C) 2012 Sebastian Herbord. All rights reserved.
This file is part of Mod Organizer.
Mod Organizer is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Mod Organizer is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
*/
#include "activatemodsdialog.h"
#include "ui_activatemodsdialog.h"
#include <QComboBox>
#include <QHeaderView>
#include <QLabel>
#include <QString>
#include <QTableWidget>
#include <QtGlobal>
using namespace MOBase;
ActivateModsDialog::ActivateModsDialog(SaveGameInfo::MissingAssets const& missingAssets,
QWidget* parent)
: TutorableDialog("ActivateMods", parent), ui(new Ui::ActivateModsDialog)
{
ui->setupUi(this);
QTableWidget* modsTable = findChild<QTableWidget*>("modsTable");
QHeaderView* headerView = modsTable->horizontalHeader();
headerView->setSectionResizeMode(0, QHeaderView::Stretch);
headerView->setSectionResizeMode(1, QHeaderView::Interactive);
int row = 0;
modsTable->setRowCount(missingAssets.size());
for (SaveGameInfo::MissingAssets::const_iterator espIter = missingAssets.begin();
espIter != missingAssets.end(); ++espIter, ++row) {
modsTable->setCellWidget(row, 0, new QLabel(espIter.key()));
if (espIter->size() == 0) {
modsTable->setCellWidget(row, 1, new QLabel(tr("not found")));
} else {
QComboBox* combo = new QComboBox();
for (QString const& mod : espIter.value()) {
combo->addItem(mod);
}
modsTable->setCellWidget(row, 1, combo);
}
}
}
ActivateModsDialog::~ActivateModsDialog()
{
delete ui;
}
std::set<QString> ActivateModsDialog::getModsToActivate()
{
std::set<QString> result;
QTableWidget* modsTable = findChild<QTableWidget*>("modsTable");
for (int row = 0; row < modsTable->rowCount(); ++row) {
QComboBox* comboBox = dynamic_cast<QComboBox*>(modsTable->cellWidget(row, 1));
if (comboBox != nullptr) {
result.insert(comboBox->currentText());
}
}
return result;
}
std::set<QString> ActivateModsDialog::getESPsToActivate()
{
std::set<QString> result;
QTableWidget* modsTable = findChild<QTableWidget*>("modsTable");
for (int row = 0; row < modsTable->rowCount(); ++row) {
QComboBox* comboBox = dynamic_cast<QComboBox*>(modsTable->cellWidget(row, 1));
if (comboBox != nullptr) {
QLabel* espName = dynamic_cast<QLabel*>(modsTable->cellWidget(row, 0));
result.insert(espName->text());
}
}
return result;
}
/*
Copyright (C) 2012 Sebastian Herbord. All rights reserved.
This file is part of Mod Organizer.
Mod Organizer is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Mod Organizer is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
*/
#include "activatemodsdialog.h"
#include "ui_activatemodsdialog.h"
#include <QComboBox>
#include <QHeaderView>
#include <QLabel>
#include <QString>
#include <QTableWidget>
#include <QtGlobal>
ActivateModsDialog::ActivateModsDialog(SaveGameInfo::MissingAssets const &missingAssets, QWidget *parent)
: TutorableDialog("ActivateMods", parent), ui(new Ui::ActivateModsDialog)
{
ui->setupUi(this);
QTableWidget *modsTable = findChild<QTableWidget*>("modsTable");
QHeaderView *headerView = modsTable->horizontalHeader();
headerView->setSectionResizeMode(0, QHeaderView::Stretch);
headerView->setSectionResizeMode(1, QHeaderView::Interactive);
int row = 0;
modsTable->setRowCount(missingAssets.size());
for (SaveGameInfo::MissingAssets::const_iterator espIter = missingAssets.begin();
espIter != missingAssets.end(); ++espIter, ++row) {
modsTable->setCellWidget(row, 0, new QLabel(espIter.key()));
if (espIter->size() == 0) {
modsTable->setCellWidget(row, 1, new QLabel(tr("not found")));
} else {
QComboBox* combo = new QComboBox();
for (QString const &mod : espIter.value()) {
combo->addItem(mod);
}
modsTable->setCellWidget(row, 1, combo);
}
}
}
ActivateModsDialog::~ActivateModsDialog()
{
delete ui;
}
std::set<QString> ActivateModsDialog::getModsToActivate()
{
std::set<QString> result;
QTableWidget *modsTable = findChild<QTableWidget*>("modsTable");
for (int row = 0; row < modsTable->rowCount(); ++row) {
QComboBox *comboBox = dynamic_cast<QComboBox*>(modsTable->cellWidget(row, 1));
if (comboBox != nullptr) {
result.insert(comboBox->currentText());
}
}
return result;
}
std::set<QString> ActivateModsDialog::getESPsToActivate()
{
std::set<QString> result;
QTableWidget *modsTable = findChild<QTableWidget*>("modsTable");
for (int row = 0; row < modsTable->rowCount(); ++row) {
QComboBox *comboBox = dynamic_cast<QComboBox*>(modsTable->cellWidget(row, 1));
if (comboBox != nullptr) {
QLabel *espName = dynamic_cast<QLabel*>(modsTable->cellWidget(row, 0));
result.insert(espName->text());
}
}
return result;
}
+76 -78
View File
@@ -1,78 +1,76 @@
/*
Copyright (C) 2012 Sebastian Herbord. All rights reserved.
This file is part of Mod Organizer.
Mod Organizer is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Mod Organizer is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ACTIVATEMODSDIALOG_H
#define ACTIVATEMODSDIALOG_H
#include "savegameinfo.h"
#include "tutorabledialog.h"
#include <QObject>
#include <QString>
#include <QWidget>
#include <set>
namespace Ui
{
class ActivateModsDialog;
}
/**
* @brief Dialog that is used to batch activate/deactivate mods and plugins
**/
class ActivateModsDialog : public MOBase::TutorableDialog
{
Q_OBJECT
public:
/**
* @brief constructor
*
* @param missingPlugins a map containing missing plugins that need to be activated
* @param parent ... Defaults to 0.
**/
explicit ActivateModsDialog(MOBase::SaveGameInfo::MissingAssets const& missingAssets,
QWidget* parent = 0);
~ActivateModsDialog();
/**
* @brief get a list of mods that the user chose to activate
*
* @note This can of ocurse only be called after the dialog has been displayed
*
* @return set< QString > the mods to activate
**/
std::set<QString> getModsToActivate();
/**
* @brief get a list of plugins that should be activated
*
* @return set< QString > the plugins to activate. This contains only plugins that
*become available after enabling the mods retrieved with getModsToActivate
**/
std::set<QString> getESPsToActivate();
private slots:
private:
Ui::ActivateModsDialog* ui;
};
#endif // ACTIVATEMODSDIALOG_H
/*
Copyright (C) 2012 Sebastian Herbord. All rights reserved.
This file is part of Mod Organizer.
Mod Organizer is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Mod Organizer is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ACTIVATEMODSDIALOG_H
#define ACTIVATEMODSDIALOG_H
#include "savegameinfo.h"
#include "tutorabledialog.h"
#include <QObject>
class QString;
class QWidget;
#include <set>
namespace Ui {
class ActivateModsDialog;
}
/**
* @brief Dialog that is used to batch activate/deactivate mods and plugins
**/
class ActivateModsDialog : public MOBase::TutorableDialog
{
Q_OBJECT
public:
/**
* @brief constructor
*
* @param missingPlugins a map containing missing plugins that need to be activated
* @param parent ... Defaults to 0.
**/
explicit ActivateModsDialog(SaveGameInfo::MissingAssets const &missingAssets, QWidget *parent = 0);
~ActivateModsDialog();
/**
* @brief get a list of mods that the user chose to activate
*
* @note This can of ocurse only be called after the dialog has been displayed
*
* @return set< QString > the mods to activate
**/
std::set<QString> getModsToActivate();
/**
* @brief get a list of plugins that should be activated
*
* @return set< QString > the plugins to activate. This contains only plugins that become available after enabling the mods retrieved with getModsToActivate
**/
std::set<QString> getESPsToActivate();
private slots:
private:
Ui::ActivateModsDialog *ui;
};
#endif // ACTIVATEMODSDIALOG_H
+17 -10
View File
@@ -2,20 +2,25 @@
QString localizedUserAccountType(APIUserAccountTypes t)
{
switch (t) {
case APIUserAccountTypes::Regular:
return QObject::tr("Regular");
switch (t)
{
case APIUserAccountTypes::Regular:
return QObject::tr("Regular");
case APIUserAccountTypes::Premium:
return QObject::tr("Premium");
case APIUserAccountTypes::Premium:
return QObject::tr("Premium");
case APIUserAccountTypes::None: // fall-through
default:
return QObject::tr("None");
case APIUserAccountTypes::None: // fall-through
default:
return QObject::tr("None");
}
}
APIUserAccount::APIUserAccount() : m_type(APIUserAccountTypes::None) {}
APIUserAccount::APIUserAccount()
: m_type(APIUserAccountTypes::None)
{
}
bool APIUserAccount::isValid() const
{
@@ -79,7 +84,9 @@ APIUserAccount& APIUserAccount::limits(const APILimits& limits)
int APIUserAccount::remainingRequests() const
{
return std::max(m_limits.remainingDailyRequests, m_limits.remainingHourlyRequests);
return std::max(
m_limits.remainingDailyRequests,
m_limits.remainingHourlyRequests);
}
bool APIUserAccount::shouldThrottle() const
+41 -35
View File
@@ -4,8 +4,8 @@
#include <QString>
/**
* represents user account types on a mod provider website such as nexus
*/
* represents user account types on a mod provider website such as nexus
*/
enum class APIUserAccountTypes
{
// not logged in
@@ -20,9 +20,10 @@ enum class APIUserAccountTypes
QString localizedUserAccountType(APIUserAccountTypes t);
/**
* current limits imposed on the user account
**/
* current limits imposed on the user account
**/
struct APILimits
{
// maximum number of requests per day
@@ -38,18 +39,20 @@ struct APILimits
int remainingHourlyRequests = 0;
};
/**
* API statistics
*/
* API statistics
*/
struct APIStats
{
// number of API requests currently queued
int requestsQueued = 0;
};
/**
* represents a user account on the mod provider website
*/
* represents a user account on the mod provider website
*/
class APIUserAccount
{
public:
@@ -59,76 +62,79 @@ public:
APIUserAccount();
/**
* whether the user is logged in
*/
bool isValid() const;
/**
* api key
*/
* api key
*/
const QString& apiKey() const;
/**
* user id
*/
* user id
*/
const QString& id() const;
/**
* user name
*/
* user name
*/
const QString& name() const;
/**
* account type
*/
* account type
*/
APIUserAccountTypes type() const;
/**
* current API limits
*/
* current API limits
*/
const APILimits& limits() const;
/**
* sets the api key
*/
APIUserAccount& apiKey(const QString& key);
/**
* sets the user id
*/
* sets the user id
*/
APIUserAccount& id(const QString& id);
/**
* sets the user name
**/
* sets the user name
**/
APIUserAccount& name(const QString& name);
/**
* sets the account type
*/
* sets the account type
*/
APIUserAccount& type(APIUserAccountTypes type);
/**
* sets the current limits
*/
* sets the current limits
*/
APIUserAccount& limits(const APILimits& limits);
/**
* returns the number of remaining requests
*/
* returns the number of remaining requests
*/
int remainingRequests() const;
/**
* whether the number of remaining requests is low enough that further
* requests should be throttled
*/
* whether the number of remaining requests is low enough that further
* requests should be throttled
*/
bool shouldThrottle() const;
/**
* true if all the remaining requests have been used and the API will refuse
* further requests
*/
* true if all the remaining requests have been used and the API will refuse
* further requests
*/
bool exhausted() const;
private:
@@ -137,4 +143,4 @@ private:
APILimits m_limits;
};
#endif // APIUSERACCOUNT_H
#endif // APIUSERACCOUNT_H
+76 -96
View File
@@ -29,9 +29,9 @@ using namespace MOBase;
/**
* We use custom file entries to store the index.
*/
class ArchiveFileEntry : public virtual FileTreeEntry
{
class ArchiveFileEntry : public virtual FileTreeEntry {
public:
/**
* @brief Create a new entry.
*
@@ -39,12 +39,11 @@ public:
* @param name The name of this entry.
* @param index The index of the entry in the archive.
*/
ArchiveFileEntry(std::shared_ptr<const IFileTree> parent, QString name, int index)
: FileTreeEntry(parent, name), m_Index(index)
{}
ArchiveFileEntry(std::shared_ptr<const IFileTree> parent, QString name, int index) :
FileTreeEntry(parent, name), m_Index(index) {
}
virtual std::shared_ptr<FileTreeEntry> clone() const override
{
virtual std::shared_ptr<FileTreeEntry> clone() const override {
return std::make_shared<ArchiveFileEntry>(nullptr, name(), m_Index);
}
@@ -52,70 +51,67 @@ public:
const int m_Index;
};
/**
*
*/
class ArchiveFileTreeImpl : public virtual ArchiveFileTree,
public virtual ArchiveFileEntry
{
class ArchiveFileTreeImpl: public virtual ArchiveFileTree, public virtual ArchiveFileEntry {
public:
using File = std::tuple<QStringList, bool, int>;
public
: // Public for make_shared (but not accessible by other since not exposed in .h):
ArchiveFileTreeImpl(std::shared_ptr<const IFileTree> parent, QString name, int index,
std::vector<File> files)
: FileTreeEntry(parent, name), ArchiveFileEntry(parent, name, index), IFileTree(),
m_Files(std::move(files))
{}
public: // Public for make_shared (but not accessible by other since not exposed in .h):
public: // Override to avoid VS warnings:
virtual std::shared_ptr<IFileTree> astree() override { return IFileTree::astree(); }
ArchiveFileTreeImpl(std::shared_ptr<const IFileTree> parent, QString name, int index, std::vector<File> files)
: FileTreeEntry(parent, name), ArchiveFileEntry(parent, name, index), IFileTree(), m_Files(std::move(files)) { }
virtual std::shared_ptr<const IFileTree> astree() const override
{
public: // Override to avoid VS warnings:
virtual std::shared_ptr<IFileTree> astree() override {
return IFileTree::astree();
}
virtual std::shared_ptr<const IFileTree> astree() const override {
return IFileTree::astree();
}
protected:
virtual std::shared_ptr<FileTreeEntry> clone() const override
{
virtual std::shared_ptr<FileTreeEntry> clone() const override {
return IFileTree::clone();
}
public: // Overrides:
public: // Overrides:
/**
*
*/
static void mapToArchive(IFileTree const& tree, QString path,
std::vector<FileData*> const& data)
static void mapToArchive(IFileTree const& tree, QString path, std::vector<FileData*> const& data)
{
if (path.length() > 0) {
// when using a long windows path (starting with \\?\) we apparently can have
// redundant . components in the path. This wasn't a problem with "regular" path
// names.
// when using a long windows path (starting with \\?\) we apparently can have redundant
// . components in the path. This wasn't a problem with "regular" path names.
if (path == ".") {
path.clear();
} else {
}
else {
path.append("\\");
}
}
for (auto const& entry : tree) {
if (entry->isDir()) {
const ArchiveFileTreeImpl& archiveEntry =
dynamic_cast<const ArchiveFileTreeImpl&>(*entry);
const ArchiveFileTreeImpl& archiveEntry = dynamic_cast<const ArchiveFileTreeImpl&>(*entry);
QString tmp = path + archiveEntry.name();
if (archiveEntry.m_Index != -1) {
data[archiveEntry.m_Index]->addOutputFilePath(tmp.toStdWString());
}
mapToArchive(*archiveEntry.astree(), tmp, data);
} else {
const ArchiveFileEntry& archiveFileEntry =
dynamic_cast<const ArchiveFileEntry&>(*entry);
}
else {
const ArchiveFileEntry& archiveFileEntry = dynamic_cast<const ArchiveFileEntry&>(*entry);
if (archiveFileEntry.m_Index != -1) {
data[archiveFileEntry.m_Index]->addOutputFilePath(
(path + archiveFileEntry.name()).toStdWString());
data[archiveFileEntry.m_Index]->addOutputFilePath((path + archiveFileEntry.name()).toStdWString());
}
}
}
@@ -124,42 +120,36 @@ public: // Overrides:
/**
*
*/
void mapToArchive(Archive& archive) const override
{
void mapToArchive(Archive &archive) const override {
mapToArchive(*this, "", archive.getFileList());
}
protected:
/**
* Overriding makeDirectory and makeFile to create file tree or file entry with index
* -1.
* Overriding makeDirectory and makeFile to create file tree or file entry with index -1.
*
*/
virtual std::shared_ptr<IFileTree>
makeDirectory(std::shared_ptr<const IFileTree> parent, QString name) const override
{
virtual std::shared_ptr<IFileTree> makeDirectory(
std::shared_ptr<const IFileTree> parent, QString name) const override {
return std::make_shared<ArchiveFileTreeImpl>(parent, name, -1, std::vector<File>{});
}
virtual std::shared_ptr<FileTreeEntry>
makeFile(std::shared_ptr<const IFileTree> parent, QString name) const override
{
virtual std::shared_ptr<FileTreeEntry> makeFile(
std::shared_ptr<const IFileTree> parent, QString name) const override {
return std::make_shared<ArchiveFileEntry>(parent, name, -1);
}
virtual bool
doPopulate(std::shared_ptr<const IFileTree> parent,
std::vector<std::shared_ptr<FileTreeEntry>>& entries) const override
{
virtual bool doPopulate(std::shared_ptr<const IFileTree> parent, std::vector<std::shared_ptr<FileTreeEntry>>& entries) const override {
// Sort by name:
std::sort(std::begin(m_Files), std::end(m_Files), [](const auto& a, const auto& b) {
return std::get<0>(a)[0].compare(std::get<0>(b)[0], Qt::CaseInsensitive) < 0;
});
std::sort(std::begin(m_Files), std::end(m_Files),
[](const auto& a, const auto& b) {
return std::get<0>(a)[0].compare(std::get<0>(b)[0], Qt::CaseInsensitive) < 0; });
// We know that the files are sorted:
QString currentName = "";
int currentIndex = -1;
int currentIndex = -1;
std::vector<File> currentFiles;
for (auto& p : m_Files) {
@@ -168,16 +158,15 @@ protected:
currentName = std::get<0>(p)[0];
}
// If the name is different, we need to create a directory from what we have
// If the name is different, we need to create a directory from what we have
// accumulated:
if (currentName != std::get<0>(p)[0]) {
// We may or may not have an index here, it depends on the type of archive (some
// archives list intermediate non-empty folders, some don't):
entries.push_back(std::make_shared<ArchiveFileTreeImpl>(
parent, currentName, currentIndex, std::move(currentFiles)));
currentFiles.clear(); // Back to a valid state.
// We may or may not have an index here, it depends on the type of archive (some archives list
// intermediate non-empty folders, some don't):
entries.push_back(std::make_shared<ArchiveFileTreeImpl>(parent, currentName, currentIndex, std::move(currentFiles)));
currentFiles.clear(); // Back to a valid state.
// Reset the index:
currentIndex = -1;
@@ -192,39 +181,40 @@ protected:
// If it is not a directory, then it is a file in directly under this tree:
if (!std::get<1>(p)) {
entries.push_back(
std::make_shared<ArchiveFileEntry>(parent, currentName, std::get<2>(p)));
std::make_shared<ArchiveFileEntry>(parent, currentName, std::get<2>(p)));
currentName = "";
} else {
// Otherwize, it is the actual "file" corresponding to the directory we are
// listing, so we can retrieve the index here:
}
else {
// Otherwize, it is the actual "file" corresponding to the directory we are listing, so we can retrieve
// the index here:
currentIndex = std::get<2>(p);
}
} else {
currentFiles.push_back(
{QStringList(std::get<0>(p).begin() + 1, std::get<0>(p).end()),
std::get<1>(p), std::get<2>(p)});
}
else {
currentFiles.push_back({
QStringList(std::get<0>(p).begin() + 1, std::get<0>(p).end()), std::get<1>(p), std::get<2>(p)
});
}
}
if (currentName != "") {
entries.push_back(std::make_shared<ArchiveFileTreeImpl>(
parent, currentName, currentIndex, std::move(currentFiles)));
entries.push_back(std::make_shared<ArchiveFileTreeImpl>(parent, currentName, currentIndex, std::move(currentFiles)));
}
// Let the parent class sort the entries:
return false;
}
virtual std::shared_ptr<IFileTree> doClone() const override
{
virtual std::shared_ptr<IFileTree> doClone() const override {
return std::make_shared<ArchiveFileTreeImpl>(nullptr, name(), m_Index, m_Files);
}
private:
mutable std::vector<File> m_Files;
};
std::shared_ptr<ArchiveFileTree> ArchiveFileTree::makeTree(Archive const& archive)
std::shared_ptr<ArchiveFileTree> ArchiveFileTree::makeTree(Archive const& archive)
{
auto const& data = archive.getFileList();
@@ -232,17 +222,10 @@ std::shared_ptr<ArchiveFileTree> ArchiveFileTree::makeTree(Archive const& archiv
files.reserve(data.size());
for (size_t i = 0; i < data.size(); ++i) {
// Ignore "." and ".." as they're useless and muck things up
if (data[i]->getArchiveFilePath().compare(L".") == 0 ||
data[i]->getArchiveFilePath().compare(L"..") == 0) {
continue;
}
files.push_back(
std::make_tuple(QString::fromStdWString(data[i]->getArchiveFilePath())
.replace("\\", "/")
.split("/", Qt::SkipEmptyParts),
data[i]->isDirectory(), (int)i));
files.push_back(std::make_tuple(
QString::fromStdWString(data[i]->getArchiveFilePath()).replace("\\", "/").split("/", Qt::SkipEmptyParts),
data[i]->isDirectory(),
(int) i));
}
auto tree = std::make_shared<ArchiveFileTreeImpl>(nullptr, "", -1, std::move(files));
@@ -250,16 +233,15 @@ std::shared_ptr<ArchiveFileTree> ArchiveFileTree::makeTree(Archive const& archiv
}
/**
* @brief Recursive function for the ArchiveFileTree::mapToArchive method. Need a
* template here because iterators from a vector of entries are not exactly the same as
* the iterators returned by a IFileTree.
* @brief Recursive function for the ArchiveFileTree::mapToArchive method. Need a template
* here because iterators from a vector of entries are not exactly the same as the iterators
* returned by a IFileTree.
*
*/
template <class It>
void mapToArchive(std::vector<FileData*> const& data, It begin, It end)
{
void mapToArchive(std::vector<FileData*> const& data, It begin, It end) {
for (auto it = begin; it != end; ++it) {
auto entry = *it;
auto entry = *it;
auto* aentry = dynamic_cast<const ArchiveFileEntry*>(entry.get());
if (aentry->m_Index != -1) {
@@ -273,8 +255,6 @@ void mapToArchive(std::vector<FileData*> const& data, It begin, It end)
}
}
void ArchiveFileTree::mapToArchive(
Archive& archive, std::vector<std::shared_ptr<const FileTreeEntry>> const& entries)
{
void ArchiveFileTree::mapToArchive(Archive &archive, std::vector<std::shared_ptr<const FileTreeEntry>> const& entries) {
::mapToArchive(archive.getFileList(), entries.cbegin(), entries.cend());
}

Some files were not shown because too many files have changed in this diff Show More