diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2020-04-23 21:00:00 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2020-04-23 21:00:00 -0400 |
| commit | bbfec30539b31a2b8faa0df79435db94cefee8fe (patch) | |
| tree | 58a6b7f8f0325665b0f3e93f2bfecdbe6beeb536 /src | |
| parent | 530bade5f71806a7ffd317a6ba2b5cdccb1cc69c (diff) | |
now using new common cmakefiles
fixed includes because shared/ isn't in the path anymore
removed unused modeltest files
Diffstat (limited to 'src')
37 files changed, 84 insertions, 1268 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7452a01b..68060a0b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,350 +1,7 @@ -CMAKE_MINIMUM_REQUIRED (VERSION 2.8.11) +cmake_minimum_required(VERSION 3.16) +include(../../cmake_common/src.cmake) -CMAKE_POLICY(SET CMP0020 NEW) -#CMAKE_POLICY(SET CMP0043 NEW) - -SET(PROJ_AUTHOR Tannin) -SET(PROJ_ARCH x86) -IF(CMAKE_SIZEOF_VOID_P EQUAL 8) - SET(PROJ_ARCH x64) -ENDIF() - -macro(add_msvc_precompiled_header PrecompiledHeader PrecompiledSource SourcesVar HeadersVar) - if(MSVC) - get_filename_component(PrecompiledBasename ${PrecompiledHeader} NAME_WE) - set(PrecompiledBinary "${CMAKE_CURRENT_BINARY_DIR}/${PrecompiledBasename}.pch") - set(Sources ${${SourcesVar}}) - - set_source_files_properties( - ${PrecompiledSource} PROPERTIES - COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\"" - OBJECT_OUTPUTS "${PrecompiledBinary}") - - set_source_files_properties( - ${Sources} PROPERTIES - COMPILE_FLAGS "/Yu\"${PrecompiledHeader}\" /FI\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\"" - OBJECT_DEPENDS "${PrecompiledBinary}") - - list(APPEND ${SourcesVar} ${PrecompiledSource}) - list(APPEND ${HeadersVar} ${PrecompiledHeader}) - endif(MSVC) -endmacro(add_msvc_precompiled_header) - - -SET(organizer_SRCS - transfersavesdialog.cpp - syncoverwritedialog.cpp - spawn.cpp - singleinstance.cpp - settingsdialog.cpp - settingsdialogdiagnostics.cpp - settingsdialoggeneral.cpp - settingsdialognexus.cpp - settingsdialogpaths.cpp - settingsdialogplugins.cpp - settingsdialogsteam.cpp - settingsdialogworkarounds.cpp - settings.cpp - settingsutilities.cpp - selfupdater.cpp - selectiondialog.cpp - queryoverwritedialog.cpp - profilesdialog.cpp - profile.cpp - pluginlistsortproxy.cpp - pluginlist.cpp - pluginlistview.cpp - overwriteinfodialog.cpp - nxmaccessmanager.cpp - nexusinterface.cpp - motddialog.cpp - modlistsortproxy.cpp - modlist.cpp - modidlineedit.cpp - modinfodialog.cpp - modinfodialogcategories.cpp - modinfodialogconflicts.cpp - modinfodialogconflictsmodels.cpp - modinfodialogesps.cpp - modinfodialogfiletree.cpp - modinfodialogimages.cpp - modinfodialognexus.cpp - modinfodialogtab.cpp - modinfodialogtextfiles.cpp - modinfo.cpp - modinfobackup.cpp - modinfoforeign.cpp - modinfooverwrite.cpp - modinforegular.cpp - modinfoseparator.cpp - modinfowithconflictinfo.cpp - messagedialog.cpp - mainwindow.cpp - main.cpp - loghighlighter.cpp - loglist.cpp - loadmechanism.cpp - installationmanager.cpp - filedialogmemory.cpp - executableslist.cpp - editexecutablesdialog.cpp - downloadmanager.cpp - downloadlistwidget.cpp - downloadlistsortproxy.cpp - downloadlist.cpp - directoryrefresher.cpp - credentialsdialog.cpp - categoriesdialog.cpp - categories.cpp - bbcode.cpp - activatemodsdialog.cpp - moapplication.cpp - profileinputdialog.cpp - icondelegate.cpp - csvbuilder.cpp - savetextasdialog.cpp - qtgroupingproxy.cpp - modlistview.cpp - problemsdialog.cpp - serverinfo.cpp - browserview.cpp - browserdialog.cpp - persistentcookiejar.cpp - noeditdelegate.cpp - previewgenerator.cpp - previewdialog.cpp - aboutdialog.cpp - modflagicondelegate.cpp - modconflicticondelegate.cpp - genericicondelegate.cpp - organizerproxy.cpp - viewmarkingscrollbar.cpp - plugincontainer.cpp - organizercore.cpp - instancemanager.cpp - usvfsconnector.cpp - moshortcut.cpp - listdialog.cpp - lcdnumber.cpp - forcedloaddialog.cpp - forcedloaddialogwidget.cpp - statusbar.cpp - apiuseraccount.cpp - filerenamer.cpp - texteditor.cpp - env.cpp - envfs.cpp - envmetrics.cpp - envmodule.cpp - envsecurity.cpp - envshell.cpp - envshortcut.cpp - envwindows.cpp - colortable.cpp - sanitychecks.cpp - processrunner.cpp - uilocker.cpp - loot.cpp - lootdialog.cpp - filterlist.cpp - datatab.cpp - filetree.cpp - filetreemodel.cpp - filetreeitem.cpp - iconfetcher.cpp - - shared/windows_error.cpp - shared/error_report.cpp - shared/directoryentry.cpp - shared/fileentry.cpp - shared/filesorigin.cpp - shared/fileregister.cpp - shared/originconnection.cpp - shared/util.cpp - shared/appconfig.cpp - shared/leaktrace.cpp - shared/stackdata.cpp - ) - -SET(organizer_HDRS - transfersavesdialog.h - syncoverwritedialog.h - spawn.h - singleinstance.h - settingsdialog.h - settingsdialogdiagnostics.h - settingsdialoggeneral.h - settingsdialognexus.h - settingsdialogpaths.h - settingsdialogplugins.h - settingsdialogsteam.h - settingsdialogworkarounds.h - settings.h - settingsutilities.h - selfupdater.h - selectiondialog.h - queryoverwritedialog.h - profilesdialog.h - profile.h - pluginlistsortproxy.h - pluginlist.h - pluginlistview.h - overwriteinfodialog.h - nxmaccessmanager.h - nexusinterface.h - motddialog.h - modlistsortproxy.h - modlist.h - modidlineedit.h - modinfodialog.h - modinfodialogcategories.h - modinfodialogconflicts.h - modinfodialogconflictsmodels.h - modinfodialogesps.h - modinfodialogfiletree.h - modinfodialogfwd.h - modinfodialogimages.h - modinfodialognexus.h - modinfodialogtab.h - modinfodialogtextfiles.h - modinfo.h - modinfobackup.h - modinfoforeign.h - modinfooverwrite.h - modinforegular.h - modinfoseparator.h - modinfowithconflictinfo.h - messagedialog.h - mainwindow.h - loghighlighter.h - loglist.h - loadmechanism.h - installationmanager.h - filedialogmemory.h - executableslist.h - editexecutablesdialog.h - downloadmanager.h - downloadlistwidget.h - downloadlistsortproxy.h - downloadlist.h - directoryrefresher.h - credentialsdialog.h - categoriesdialog.h - categories.h - bbcode.h - activatemodsdialog.h - moapplication.h - profileinputdialog.h - icondelegate.h - csvbuilder.h - savetextasdialog.h - qtgroupingproxy.h - modlistview.h - problemsdialog.h - serverinfo.h - browserview.h - browserdialog.h - persistentcookiejar.h - noeditdelegate.h - previewgenerator.h - previewdialog.h - aboutdialog.h - modflagicondelegate.h - modconflicticondelegate.h - genericicondelegate.h - organizerproxy.h - viewmarkingscrollbar.h - plugincontainer.h - organizercore.h - iuserinterface.h - instancemanager.h - usvfsconnector.h - moshortcut.h - listdialog.h - lcdnumber.h - forcedloaddialog.h - forcedloaddialogwidget.h - statusbar.h - apiuseraccount.h - filerenamer.h - texteditor.h - env.h - envfs.h - envmetrics.h - envmodule.h - envsecurity.h - envshell.h - envshortcut.h - envwindows.h - colortable.h - processrunner.h - uilocker.h - loot.h - lootdialog.h - json.h - filterlist.h - datatab.h - filetree.h - filetreeitem.h - filetreemodel.h - iconfetcher.h - - shared/windows_error.h - shared/error_report.h - shared/directoryentry.h - shared/fileentry.h - shared/filesorigin.h - shared/fileregister.h - shared/fileregisterfwd.h - shared/originconnection.h - shared/util.h - shared/appconfig.h - shared/appconfig.inc - shared/leaktrace.h - shared/stackdata.h - ) - -SET(organizer_UIS - transfersavesdialog.ui - syncoverwritedialog.ui - settingsdialog.ui - selectiondialog.ui - queryoverwritedialog.ui - profilesdialog.ui - overwriteinfodialog.ui - motddialog.ui - modinfodialog.ui - messagedialog.ui - mainwindow.ui - editexecutablesdialog.ui - credentialsdialog.ui - categoriesdialog.ui - activatemodsdialog.ui - profileinputdialog.ui - savetextasdialog.ui - problemsdialog.ui - previewdialog.ui - browserdialog.ui - aboutdialog.ui - listdialog.ui - forcedloaddialog.ui - forcedloaddialogwidget.ui - ) - -SET(organizer_QRCS - resources.qrc - stylesheet_resource.qrc - ) - -SET(organizer_RCS - app_icon.rc - version.rc - ) - - -source_group(src REGULAR_EXPRESSION ".*\\.(h|cpp|ui)") - -set(application +add_filter(NAME src/application GROUPS iuserinterface main moapplication @@ -354,12 +11,12 @@ set(application singleinstance ) -set(browser +add_filter(NAME src/browser GROUPS browserdialog browserview ) -set(core +add_filter(NAME src/core GROUPS categories installationmanager instancemanager @@ -373,7 +30,7 @@ set(core uilocker ) -set(dialogs +add_filter(NAME src/dialogs GROUPS aboutdialog activatemodsdialog categoriesdialog @@ -394,14 +51,14 @@ set(dialogs waitingonclosedialog ) -set(downloads +add_filter(NAME src/downloads GROUPS downloadlist downloadlistsortproxy downloadlistwidget downloadmanager ) -set(env +add_filter(NAME src/env GROUPS env envfs envmetrics @@ -412,17 +69,17 @@ set(env envwindows ) -set(executables +add_filter(NAME src/executables GROUPS executableslist editexecutablesdialog ) -set(loot +add_filter(NAME src/loot GROUPS loot lootdialog ) -set(mainwindow +add_filter(NAME src/mainwindow GROUPS datatab iconfetcher filetree @@ -433,7 +90,7 @@ set(mainwindow statusbar ) -set(modinfo +add_filter(NAME src/modinfo GROUPS modinfo modinfobackup modinfoforeign @@ -443,7 +100,7 @@ set(modinfo modinfowithconflictinfo ) -set(modinfo\\dialog +add_filter(NAME src/modinfo/dialog GROUPS modinfodialog modinfodialogcategories modinfodialogconflicts @@ -456,31 +113,31 @@ set(modinfo\\dialog modinfodialogtab modinfodialogtextfiles ) -set(modlist +add_filter(NAME src/modlist GROUPS modlist modlistsortproxy modlistview ) -set(plugins +add_filter(NAME src/plugins GROUPS plugincontainer pluginlist pluginlistsortproxy pluginlistview ) -set(previews +add_filter(NAME src/previews GROUPS previewdialog previewgenerator ) -set(profiles +add_filter(NAME src/profiles GROUPS profile profileinputdialog profilesdialog ) -set(register +add_filter(NAME src/register GROUPS shared/directoryentry shared/fileentry shared/filesorigin @@ -490,12 +147,12 @@ set(register directoryrefresher ) -set(settings +add_filter(NAME src/settings GROUPS settings settingsutilities ) -set(settingsdialog +add_filter(NAME src/settingsdialog GROUPS settingsdialog settingsdialogdiagnostics settingsdialoggeneral @@ -506,7 +163,7 @@ set(settingsdialog settingsdialogworkarounds ) -set(utilities +add_filter(NAME src/utilities GROUPS shared/appconfig bbcode csvbuilder @@ -522,7 +179,7 @@ set(utilities json ) -set(widgets +add_filter(NAME src/widgets GROUPS colortable genericicondelegate filerenamer @@ -539,196 +196,33 @@ set(widgets viewmarkingscrollbar ) -set(src_filters - application core browser dialogs downloads env executables loot mainwindow - modinfo modinfo\\dialog modlist plugins previews profiles register settings - settingsdialog utilities widgets -) - -foreach(filter in list ${src_filters}) - set(files) - foreach(d in lists ${${filter}}) - set(files ${files} ${d}.cpp ${d}.h ${d}.inc ${d}.ui) - endforeach() - - source_group(src\\${filter} FILES ${files}) -endforeach() - -file(GLOB_RECURSE rule_files ../vsbuild/CMakeFiles/*.rule) -file(GLOB qm_files ../vsbuild/src/*.qm) - -set(organizer_misc ../modorganizer.natvis) - -source_group(cmake FILES CMakeLists.txt) -source_group(autogen FILES ${rule_files} ${qm_files}) -source_group(resources FILES ${organizer_RCS} ${organizer_QRCS}) - -# MO projects -SET(dependency_project_path "${DEPENDENCIES_DIR}") -SET(default_project_path "${DEPENDENCIES_DIR}/modorganizer_super") -GET_FILENAME_COMPONENT(${default_project_path} ${default_project_path} REALPATH) -SET(project_path "${default_project_path}" CACHE PATH "path to the other mo projects") - -add_msvc_precompiled_header("pch.h" "pch.cpp" organizer_SRCS organizer_HDRS) -#TODO this should not be a hardcoded path -SET(lib_path "${project_path}/../../install/libs") - -# Qt5 -SET(CMAKE_INCLUDE_CURRENT_DIR ON) -SET(CMAKE_AUTOMOC ON) -SET(CMAKE_AUTOUIC ON) -SET(CMAKE_AUTORCC ON) - -FIND_PACKAGE(Qt5Widgets REQUIRED) -FIND_PACKAGE(Qt5QuickWidgets REQUIRED) -FIND_PACKAGE(Qt5Quick REQUIRED) -FIND_PACKAGE(Qt5Network REQUIRED) -FIND_PACKAGE(Qt5WinExtras REQUIRED) -FIND_PACKAGE(Qt5WebEngineWidgets REQUIRED) -FIND_PACKAGE(Qt5WebSockets REQUIRED) -FIND_PACKAGE(Qt5Qml REQUIRED) -FIND_PACKAGE(Qt5LinguistTools) - -SET(mo_translation_sources ${CMAKE_SOURCE_DIR}/src ${project_path}/uibase/src) -set_property(GLOBAL PROPERTY USE_FOLDERS ON) -set_property(GLOBAL PROPERTY AUTOGEN_SOURCE_GROUP autogen) -set_property(GLOBAL PROPERTY AUTOMOC_SOURCE_GROUP autogen) -set_property(GLOBAL PROPERTY AUTORCC_SOURCE_GROUP autogen) - -QT5_CREATE_TRANSLATION(organizer_translations_qm ${mo_translation_sources} ${CMAKE_SOURCE_DIR}/src/organizer_en.ts OPTIONS -silent) -ADD_CUSTOM_TARGET(translations DEPENDS ${organizer_translations_qm}) - -INCLUDE_DIRECTORIES(${Qt5Declarative_INCLUDES}) - -ADD_DEFINITIONS(-DQT_MESSAGELOGCONTEXT) - -# Boost -SET(Boost_USE_STATIC_LIBS OFF) -SET(Boost_USE_MULTITHREADED ON) -SET(Boost_USE_STATIC_RUNTIME OFF) -FIND_PACKAGE(Boost REQUIRED) - -INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) -LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) - - -FIND_PACKAGE(zlib REQUIRED) -# TODO FindZlib doesn't find the static zlib library - -# fmt -find_package(fmt REQUIRED) - -INCLUDE_DIRECTORIES(${project_path}/uibase/src - ${project_path}/bsatk/src - ${project_path}/esptk/src - ${project_path}/archive/src - ${project_path}/lootcli/include - ${dependency_project_path}/usvfs/include - ${project_path}/game_gamebryo/src/gamebryo - ${project_path}/game_gamebryo/src/creation - ${project_path}/game_features/src - ${project_path}/githubpp/src - ${SPDLOG_ROOT}/include - ${LZ4_ROOT}/lib) - -INCLUDE_DIRECTORIES(shared ${ZLIB_INCLUDE_DIRS}) -LINK_DIRECTORIES(${lib_path} - ${ZLIB_ROOT}/lib - ${LZ4_ROOT}/bin) -EXECUTE_PROCESS( - COMMAND git log -1 --format=%h - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE GIT_COMMIT_HASH - OUTPUT_STRIP_TRAILING_WHITESPACE +target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE + ${modorganizer_super_path}/game_features/src + ${modorganizer_super_path}/lootcli/include + ${modorganizer_super_path}/githubpp/src + ${modorganizer_super_path}/bsatk/src + ${modorganizer_super_path}/archive/src + ${modorganizer_super_path}/esptk/src + ${modorganizer_build_path}/usvfs/include ) -ADD_DEFINITIONS(-D_UNICODE -DUNICODE -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -DBOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE -DGITID="${GIT_COMMIT_HASH}") - -IF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") - SET(usvfs_name usvfs_x64) -ELSE() - SET(usvfs_name usvfs_x86) -ENDIF() - -ADD_EXECUTABLE( - ModOrganizer WIN32 - ${organizer_HDRS} ${organizer_SRCS} ${organizer_UIS} ${organizer_RCS} - ${organizer_QRCS} ${organizer_translations_qm} ${organizer_misc}) - -TARGET_LINK_LIBRARIES(ModOrganizer - Qt5::Widgets Qt5::WinExtras Qt5::WebEngineWidgets Qt5::Quick - Qt5::Qml Qt5::QuickWidgets Qt5::Network Qt5::WebSockets - ${Boost_LIBRARIES} fmt::fmt - zlibstatic - uibase esptk bsatk githubpp - ${usvfs_name} - Dbghelp advapi32 Version Shlwapi liblz4 Crypt32) - -IF (MSVC) - SET_TARGET_PROPERTIES(ModOrganizer PROPERTIES COMPILE_FLAGS "/std:c++latest /permissive-") -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}) -ENDIF() -IF (NOT "${OPTIMIZE_LINK_FLAGS}" STREQUAL "") - SET_TARGET_PROPERTIES(ModOrganizer PROPERTIES LINK_FLAGS_RELWITHDEBINFO ${OPTIMIZE_LINK_FLAGS}) -ENDIF() - - -############### -## Installation - -SET(qt5bin ${Qt5Core_DIR}/../../../bin) +target_link_libraries(${CMAKE_PROJECT_NAME} + uibase usvfs_x64 bsatk esptk githubpp +) -FIND_PROGRAM(WINDEPLOYQT_COMMAND windeployqt PATHS ${qt5bin} NO_DEFAULT_PATH) -INSTALL(TARGETS ModOrganizer - RUNTIME DESTINATION bin) -INSTALL(FILES $<TARGET_PDB_FILE:ModOrganizer> - DESTINATION pdb) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dlls.manifest.qt5 +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dlls.manifest.qt5 DESTINATION bin/dlls RENAME dlls.manifest) -INSTALL(FILES ${organizer_translations_qm} DESTINATION bin/translations) +install(FILES ${qm_files} DESTINATION bin/translations) -INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/stylesheets +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/stylesheets ${CMAKE_CURRENT_SOURCE_DIR}/tutorials DESTINATION bin) -#We should do this last, since windeployqt.exe scans the folders in bin for required modules e.g QtQuick.2 required by tutorials. -# use windeployqt.exe to install all required libraries -SET(windeploy_parameters "--no-translations --plugindir qtplugins --libdir dlls --release-with-debug-info --no-compiler-runtime") -INSTALL( - CODE - "EXECUTE_PROCESS(COMMAND - ${qt5bin}/windeployqt.exe --verbose 0 ModOrganizer.exe --webenginewidgets --websockets ${windeploy_parameters} - WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin - ) - EXECUTE_PROCESS(COMMAND - ${qt5bin}/windeployqt.exe --verbose 0 uibase.dll ${windeploy_parameters} - WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin - ) - EXECUTE_PROCESS(COMMAND - ${qt5bin}/windeployqt.exe --verbose 0 plugins/bsa_packer.dll ${windeploy_parameters} - WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin - ) - file(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/bin/platforms) - file(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/bin/styles) - file(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/bin/dlls/imageformats) - file(RENAME ${CMAKE_INSTALL_PREFIX}/bin/qtplugins/platforms ${CMAKE_INSTALL_PREFIX}/bin/platforms) - file(RENAME ${CMAKE_INSTALL_PREFIX}/bin/qtplugins/styles ${CMAKE_INSTALL_PREFIX}/bin/styles) - file(RENAME ${CMAKE_INSTALL_PREFIX}/bin/qtplugins/imageformats ${CMAKE_INSTALL_PREFIX}/bin/dlls/imageformats) - file(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/bin/qtplugins)" -) - -# qdds.dll needs installing manually as Qt no longer ships with it by default. -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../qdds.dll DESTINATION bin/dlls/imageformats) +deploy_qt(BINARIES ModOrganizer.exe uibase.dll plugins/bsa_packer.dll) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/markdown.html DESTINATION bin/resources) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../qdds.dll DESTINATION bin/dlls/imageformats) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/markdown.html DESTINATION bin/resources) diff --git a/src/aboutdialog.cpp b/src/aboutdialog.cpp index 6ae7f56d..03663cf8 100644 --- a/src/aboutdialog.cpp +++ b/src/aboutdialog.cpp @@ -20,7 +20,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "aboutdialog.h"
#include "ui_aboutdialog.h"
-#include "util.h"
+#include "shared/util.h"
#include <utility.h>
#include <QApplication>
diff --git a/src/activatemodsdialog.h b/src/activatemodsdialog.h index f36b5fde..56dda237 100644 --- a/src/activatemodsdialog.h +++ b/src/activatemodsdialog.h @@ -53,7 +53,7 @@ public: /**
* @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
diff --git a/src/directoryrefresher.cpp b/src/directoryrefresher.cpp index 57948236..0369b1b0 100644 --- a/src/directoryrefresher.cpp +++ b/src/directoryrefresher.cpp @@ -29,7 +29,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "settings.h"
#include "envfs.h"
#include "modinfodialogfwd.h"
-#include "util.h"
+#include "shared/util.h"
#include <gameplugins.h>
diff --git a/src/directoryrefresher.h b/src/directoryrefresher.h index bd08dad6..0677998b 100644 --- a/src/directoryrefresher.h +++ b/src/directoryrefresher.h @@ -20,7 +20,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #ifndef DIRECTORYREFRESHER_H
#define DIRECTORYREFRESHER_H
-#include "fileregisterfwd.h"
+#include "shared/fileregisterfwd.h"
#include "profile.h"
#include <QObject>
#include <QMutex>
diff --git a/src/editexecutablesdialog.cpp b/src/editexecutablesdialog.cpp index 52615c23..cd11d5fb 100644 --- a/src/editexecutablesdialog.cpp +++ b/src/editexecutablesdialog.cpp @@ -20,7 +20,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "editexecutablesdialog.h" #include "ui_editexecutablesdialog.h" #include "filedialogmemory.h" -#include "stackdata.h" #include "modlist.h" #include "forcedloaddialog.h" #include "organizercore.h" @@ -74,9 +73,9 @@ EditExecutablesDialog::EditExecutablesDialog(OrganizerCore& oc, int sel, QWidget for (auto&& m : m_organizerCore.modList()->allMods()) { auto mod = ModInfo::getByName(m); - if (!mod->hasAnyOfTheseFlags({ ModInfo::FLAG_FOREIGN, - ModInfo::FLAG_BACKUP, - ModInfo::FLAG_OVERWRITE, + if (!mod->hasAnyOfTheseFlags({ ModInfo::FLAG_FOREIGN, + ModInfo::FLAG_BACKUP, + ModInfo::FLAG_OVERWRITE, ModInfo::FLAG_SEPARATOR })) { ui->mods->addItem(m); } diff --git a/src/envfs.cpp b/src/envfs.cpp index 721f561a..cea36d3c 100644 --- a/src/envfs.cpp +++ b/src/envfs.cpp @@ -1,6 +1,6 @@ #include "envfs.h" #include "env.h" -#include "util.h" +#include "shared/util.h" #include <utility.h> #include <log.h> diff --git a/src/filetreeitem.cpp b/src/filetreeitem.cpp index 64d902ee..788b4129 100644 --- a/src/filetreeitem.cpp +++ b/src/filetreeitem.cpp @@ -1,7 +1,7 @@ #include "filetreeitem.h" #include "filetreemodel.h" #include "modinfo.h" -#include "util.h" +#include "shared/util.h" #include "modinfodialogfwd.h" #include <log.h> #include <utility.h> diff --git a/src/filetreemodel.cpp b/src/filetreemodel.cpp index 282dfa73..cf5bc665 100644 --- a/src/filetreemodel.cpp +++ b/src/filetreemodel.cpp @@ -1,7 +1,7 @@ #include "filetreemodel.h" #include "organizercore.h" -#include "filesorigin.h" -#include "util.h" +#include "shared/filesorigin.h" +#include "shared/util.h" #include "shared/directoryentry.h" #include "shared/fileentry.h" #include <log.h> diff --git a/src/iconfetcher.cpp b/src/iconfetcher.cpp index 2b19f993..129be50e 100644 --- a/src/iconfetcher.cpp +++ b/src/iconfetcher.cpp @@ -1,5 +1,5 @@ #include "iconfetcher.h" -#include "util.h" +#include "shared/util.h" void IconFetcher::Waiter::wait() { diff --git a/src/instancemanager.cpp b/src/instancemanager.cpp index a9da30d9..6c7f797e 100644 --- a/src/instancemanager.cpp +++ b/src/instancemanager.cpp @@ -22,7 +22,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "selectiondialog.h" #include <utility.h> #include <log.h> -#include <appconfig.h> +#include "shared/appconfig.h" #include <QCoreApplication> #include <QDir> #include <QStandardPaths> diff --git a/src/loadmechanism.cpp b/src/loadmechanism.cpp index 0c81b7b2..e05ec584 100644 --- a/src/loadmechanism.cpp +++ b/src/loadmechanism.cpp @@ -19,10 +19,10 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "loadmechanism.h"
#include "utility.h"
-#include "util.h"
+#include "shared/util.h"
#include <iplugingame.h>
#include <scriptextender.h>
-#include <appconfig.h>
+#include "shared/appconfig.h"
#include <log.h>
#include <QFile>
#include <QFileInfo>
diff --git a/src/main.cpp b/src/main.cpp index eda31eb4..c7a2834c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -27,7 +27,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <windows.h> #include <DbgHelp.h> -#include <appconfig.h> +#include "shared/appconfig.h" #include <utility.h> #include <scopeguard.h> #include "mainwindow.h" @@ -48,10 +48,10 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "organizercore.h" #include "env.h" #include "envmodule.h" -#include "util.h" +#include "shared/util.h" #include <eh.h> -#include <windows_error.h> +#include "shared/windows_error.h" #include <usvfs.h> #include <log.h> diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index a359d94c..01d3e62c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -71,7 +71,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "settingsdialog.h" #include <safewritefile.h> #include "nxmaccessmanager.h" -#include "appconfig.h" +#include "shared/appconfig.h" #include "eventfilter.h" #include "statusbar.h" #include "filterlist.h" diff --git a/src/moapplication.cpp b/src/moapplication.cpp index 2fb12809..dd49bf53 100644 --- a/src/moapplication.cpp +++ b/src/moapplication.cpp @@ -21,7 +21,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <report.h>
#include <utility.h>
#include <log.h>
-#include <appconfig.h>
+#include "shared/appconfig.h"
#include <QFile>
#include <QStringList>
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
diff --git a/src/modeltest.cpp b/src/modeltest.cpp deleted file mode 100644 index 90061261..00000000 --- a/src/modeltest.cpp +++ /dev/null @@ -1,583 +0,0 @@ -/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <QtGui/QtGui>
-
-#include "modeltest.h"
-
-#include <QtTest/QtTest>
-
-#undef QVERIFY
-#define QVERIFY Q_ASSERT
-#undef QCOMPARE
-#define QCOMPARE(x, y) Q_ASSERT(x == y)
-
-Q_DECLARE_METATYPE ( QModelIndex )
-
-/*!
- Connect to all of the models signals. Whenever anything happens recheck everything.
-*/
-ModelTest::ModelTest ( QAbstractItemModel *_model, QObject *parent ) : QObject ( parent ), model ( _model ), fetchingMore ( false )
-{
- if (!model)
- qFatal("%s: model must not be null", Q_FUNC_INFO);
-
- connect ( model, SIGNAL ( columnsAboutToBeInserted ( const QModelIndex &, int, int ) ),
- this, SLOT ( runAllTests() ) );
- connect ( model, SIGNAL ( columnsAboutToBeRemoved ( const QModelIndex &, int, int ) ),
- this, SLOT ( runAllTests() ) );
- connect ( model, SIGNAL ( columnsInserted ( const QModelIndex &, int, int ) ),
- this, SLOT ( runAllTests() ) );
- connect ( model, SIGNAL ( columnsRemoved ( const QModelIndex &, int, int ) ),
- this, SLOT ( runAllTests() ) );
- connect ( model, SIGNAL ( dataChanged ( const QModelIndex &, const QModelIndex & ) ),
- this, SLOT ( runAllTests() ) );
- connect ( model, SIGNAL ( headerDataChanged ( Qt::Orientation, int, int ) ),
- this, SLOT ( runAllTests() ) );
- connect ( model, SIGNAL ( layoutAboutToBeChanged () ), this, SLOT ( runAllTests() ) );
- connect ( model, SIGNAL ( layoutChanged () ), this, SLOT ( runAllTests() ) );
- connect ( model, SIGNAL ( modelReset () ), this, SLOT ( runAllTests() ) );
- connect ( model, SIGNAL ( rowsAboutToBeInserted ( const QModelIndex &, int, int ) ),
- this, SLOT ( runAllTests() ) );
- connect ( model, SIGNAL ( rowsAboutToBeRemoved ( const QModelIndex &, int, int ) ),
- this, SLOT ( runAllTests() ) );
- connect ( model, SIGNAL ( rowsInserted ( const QModelIndex &, int, int ) ),
- this, SLOT ( runAllTests() ) );
- connect ( model, SIGNAL ( rowsRemoved ( const QModelIndex &, int, int ) ),
- this, SLOT ( runAllTests() ) );
-
- // Special checks for inserting/removing
- connect ( model, SIGNAL ( layoutAboutToBeChanged() ),
- this, SLOT ( layoutAboutToBeChanged() ) );
- connect ( model, SIGNAL ( layoutChanged() ),
- this, SLOT ( layoutChanged() ) );
-
- connect ( model, SIGNAL ( rowsAboutToBeInserted ( const QModelIndex &, int, int ) ),
- this, SLOT ( rowsAboutToBeInserted ( const QModelIndex &, int, int ) ) );
- connect ( model, SIGNAL ( rowsAboutToBeRemoved ( const QModelIndex &, int, int ) ),
- this, SLOT ( rowsAboutToBeRemoved ( const QModelIndex &, int, int ) ) );
- connect ( model, SIGNAL ( rowsInserted ( const QModelIndex &, int, int ) ),
- this, SLOT ( rowsInserted ( const QModelIndex &, int, int ) ) );
- connect ( model, SIGNAL ( rowsRemoved ( const QModelIndex &, int, int ) ),
- this, SLOT ( rowsRemoved ( const QModelIndex &, int, int ) ) );
-
- runAllTests();
-}
-
-void ModelTest::runAllTests()
-{
- if ( fetchingMore )
- return;
- nonDestructiveBasicTest();
- rowCount();
- columnCount();
- hasIndex();
- index();
- parent();
- data();
-}
-
-/*!
- nonDestructiveBasicTest tries to call a number of the basic functions (not all)
- to make sure the model doesn't outright segfault, testing the functions that makes sense.
-*/
-void ModelTest::nonDestructiveBasicTest()
-{
- QVERIFY( model->buddy ( QModelIndex() ) == QModelIndex() );
- model->canFetchMore ( QModelIndex() );
- QVERIFY( model->columnCount ( QModelIndex() ) >= 0 );
- QVERIFY( model->data ( QModelIndex() ) == QVariant() );
- fetchingMore = true;
- model->fetchMore ( QModelIndex() );
- fetchingMore = false;
- Qt::ItemFlags flags = model->flags ( QModelIndex() );
- QVERIFY( flags == Qt::ItemIsDropEnabled || flags == 0 );
- model->hasChildren ( QModelIndex() );
- model->hasIndex ( 0, 0 );
- model->headerData ( 0, Qt::Horizontal );
- model->index ( 0, 0 );
- model->itemData ( QModelIndex() );
- QVariant cache;
- model->match ( QModelIndex(), -1, cache );
- model->mimeTypes();
- QVERIFY( model->parent ( QModelIndex() ) == QModelIndex() );
- QVERIFY( model->rowCount() >= 0 );
- QVariant variant;
- model->setData ( QModelIndex(), variant, -1 );
- model->setHeaderData ( -1, Qt::Horizontal, QVariant() );
- model->setHeaderData ( 999999, Qt::Horizontal, QVariant() );
- QMap<int, QVariant> roles;
- model->sibling ( 0, 0, QModelIndex() );
- model->span ( QModelIndex() );
- model->supportedDropActions();
-}
-
-/*!
- Tests model's implementation of QAbstractItemModel::rowCount() and hasChildren()
-
- Models that are dynamically populated are not as fully tested here.
- */
-void ModelTest::rowCount()
-{
-// qDebug() << "rc";
- // check top row
-
- QModelIndex topIndex = model->index ( 0, 0, QModelIndex() );
- if (!model->hasChildren ( topIndex ) && model->rowCount(topIndex) > 0) {
- qDebug() << "it's gonna blow: " << topIndex;
- }
-
- int rows = model->rowCount ( topIndex );
- QVERIFY( rows >= 0 );
- if ( rows > 0 ) {
- QVERIFY( model->hasChildren ( topIndex ) );
- }
-
- QModelIndex secondLevelIndex = model->index ( 0, 0, topIndex );
- if ( secondLevelIndex.isValid() ) { // not the top level
- // check a row count where parent is valid
- rows = model->rowCount ( secondLevelIndex );
- QVERIFY( rows >= 0 );
- if ( rows > 0 )
- QVERIFY( model->hasChildren ( secondLevelIndex ) );
- }
-
- // The models rowCount() is tested more extensively in checkChildren(),
- // but this catches the big mistakes
-}
-
-/*!
- Tests model's implementation of QAbstractItemModel::columnCount() and hasChildren()
- */
-void ModelTest::columnCount()
-{
- // check top row
- QModelIndex topIndex = model->index ( 0, 0, QModelIndex() );
- QVERIFY( model->columnCount ( topIndex ) >= 0 );
-
- // check a column count where parent is valid
- QModelIndex childIndex = model->index ( 0, 0, topIndex );
- if ( childIndex.isValid() )
- QVERIFY( model->columnCount ( childIndex ) >= 0 );
-
- // columnCount() is tested more extensively in checkChildren(),
- // but this catches the big mistakes
-}
-
-/*!
- Tests model's implementation of QAbstractItemModel::hasIndex()
- */
-void ModelTest::hasIndex()
-{
-// qDebug() << "hi";
- // Make sure that invalid values returns an invalid index
- QVERIFY( !model->hasIndex ( -2, -2 ) );
- QVERIFY( !model->hasIndex ( -2, 0 ) );
- QVERIFY( !model->hasIndex ( 0, -2 ) );
-
- int rows = model->rowCount();
- int columns = model->columnCount();
-
- // check out of bounds
- QVERIFY( !model->hasIndex ( rows, columns ) );
- QVERIFY( !model->hasIndex ( rows + 1, columns + 1 ) );
-
- if ( rows > 0 )
- QVERIFY( model->hasIndex ( 0, 0 ) );
-
- // hasIndex() is tested more extensively in checkChildren(),
- // but this catches the big mistakes
-}
-
-/*!
- Tests model's implementation of QAbstractItemModel::index()
- */
-void ModelTest::index()
-{
-// qDebug() << "i";
- // Make sure that invalid values returns an invalid index
-/* QVERIFY( model->index ( -2, -2 ) == QModelIndex() );
- QVERIFY( model->index ( -2, 0 ) == QModelIndex() );
- QVERIFY( model->index ( 0, -2 ) == QModelIndex() );*/
- QVERIFY( !model->index ( -2, -2 ).isValid() );
- QVERIFY( !model->index ( -2, 0 ).isValid() );
- QVERIFY( !model->index ( 0, -2 ).isValid() );
-
- int rows = model->rowCount();
- int columns = model->columnCount();
-
- if ( rows == 0 )
- return;
-
- // Catch off by one errors
- //QVERIFY( model->index ( rows, columns ) == QModelIndex() );
- QVERIFY( !model->index ( rows, columns ).isValid() );
- QVERIFY( model->index ( 0, 0 ).isValid() );
-
- // Make sure that the same index is *always* returned
- QModelIndex a = model->index ( 0, 0 );
- QModelIndex b = model->index ( 0, 0 );
- QVERIFY( a == b );
-
- // index() is tested more extensively in checkChildren(),
- // but this catches the big mistakes
-}
-
-/*!
- Tests model's implementation of QAbstractItemModel::parent()
- */
-void ModelTest::parent()
-{
-// qDebug() << "p";
- // Make sure the model wont crash and will return an invalid QModelIndex
- // when asked for the parent of an invalid index.
- QVERIFY( model->parent ( QModelIndex() ) == QModelIndex() );
-
- if ( model->rowCount() == 0 )
- return;
-
- // Column 0 | Column 1 |
- // QModelIndex() | |
- // \- topIndex | topIndex1 |
- // \- childIndex | childIndex1 |
-
- // Common error test #1, make sure that a top level index has a parent
- // that is a invalid QModelIndex.
- QModelIndex topIndex = model->index ( 0, 0, QModelIndex() );
- QVERIFY( model->parent ( topIndex ) == QModelIndex() );
-
- // Common error test #2, make sure that a second level index has a parent
- // that is the first level index.
- if ( model->rowCount ( topIndex ) > 0 ) {
- QModelIndex childIndex = model->index ( 0, 0, topIndex );
- QVERIFY( model->parent ( childIndex ) == topIndex );
- }
-
- // Common error test #3, the second column should NOT have the same children
- // as the first column in a row.
- // Usually the second column shouldn't have children.
- QModelIndex topIndex1 = model->index ( 0, 1, QModelIndex() );
- if ( model->rowCount ( topIndex1 ) > 0 ) {
- QModelIndex childIndex = model->index ( 0, 0, topIndex );
- QModelIndex childIndex1 = model->index ( 0, 0, topIndex1 );
- QVERIFY( childIndex != childIndex1 );
- }
-
- // Full test, walk n levels deep through the model making sure that all
- // parent's children correctly specify their parent.
- checkChildren ( QModelIndex() );
-}
-
-/*!
- Called from the parent() test.
-
- A model that returns an index of parent X should also return X when asking
- for the parent of the index.
-
- This recursive function does pretty extensive testing on the whole model in an
- effort to catch edge cases.
-
- This function assumes that rowCount(), columnCount() and index() already work.
- If they have a bug it will point it out, but the above tests should have already
- found the basic bugs because it is easier to figure out the problem in
- those tests then this one.
- */
-void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth )
-{
- // First just try walking back up the tree.
- QModelIndex p = parent;
- while ( p.isValid() )
- p = p.parent();
-
- // For models that are dynamically populated
- if ( model->canFetchMore ( parent ) ) {
- fetchingMore = true;
- model->fetchMore ( parent );
- fetchingMore = false;
- }
-
- int rows = model->rowCount ( parent );
- int columns = model->columnCount ( parent );
-
- if ( rows > 0 )
- QVERIFY( model->hasChildren ( parent ) );
-
- // Some further testing against rows(), columns(), and hasChildren()
- QVERIFY( rows >= 0 );
- QVERIFY( columns >= 0 );
- if ( rows > 0 )
- QVERIFY( model->hasChildren ( parent ) );
-
- //qDebug() << "parent:" << model->data(parent).toString() << "rows:" << rows
- // << "columns:" << columns << "parent column:" << parent.column();
-
- QVERIFY( !model->hasIndex ( rows + 1, 0, parent ) );
- for ( int r = 0; r < rows; ++r ) {
- if ( model->canFetchMore ( parent ) ) {
- fetchingMore = true;
- model->fetchMore ( parent );
- fetchingMore = false;
- }
- QVERIFY( !model->hasIndex ( r, columns + 1, parent ) );
- for ( int c = 0; c < columns; ++c ) {
- QVERIFY( model->hasIndex ( r, c, parent ) );
- QModelIndex index = model->index ( r, c, parent );
- // rowCount() and columnCount() said that it existed...
- QVERIFY( index.isValid() );
-
- // index() should always return the same index when called twice in a row
- QModelIndex modifiedIndex = model->index ( r, c, parent );
- QVERIFY( index == modifiedIndex );
-
- // Make sure we get the same index if we request it twice in a row
- QModelIndex a = model->index ( r, c, parent );
- QModelIndex b = model->index ( r, c, parent );
- QVERIFY( a == b );
-
- // Some basic checking on the index that is returned
- QVERIFY( index.model() == model );
- QCOMPARE( index.row(), r );
- QCOMPARE( index.column(), c );
- // While you can technically return a QVariant usually this is a sign
- // of a bug in data(). Disable if this really is ok in your model.
-// QVERIFY( model->data ( index, Qt::DisplayRole ).isValid() );
-
- // If the next test fails here is some somewhat useful debug you play with.
-
- if (model->parent(index) != parent) {
- qDebug() << r << c << currentDepth << model->data(index).toString()
- << model->data(parent).toString();
- qDebug() << index << parent << model->parent(index);
-// And a view that you can even use to show the model.
-// QTreeView view;
-// view.setModel(model);
-// view.show();
- }
-
- // Check that we can get back our real parent.
- QCOMPARE( model->parent ( index ), parent );
-
- // recursively go down the children
- if ( model->hasChildren ( index ) && currentDepth < 10 ) {
- //qDebug() << r << c << "has children" << model->rowCount(index);
- checkChildren ( index, ++currentDepth );
- }/* else { if (currentDepth >= 10) qDebug() << "checked 10 deep"; };*/
-
- // make sure that after testing the children that the index doesn't change.
- QModelIndex newerIndex = model->index ( r, c, parent );
- QVERIFY( index == newerIndex );
- }
- }
-}
-
-/*!
- Tests model's implementation of QAbstractItemModel::data()
- */
-void ModelTest::data()
-{
- // Invalid index should return an invalid qvariant
- QVERIFY( !model->data ( QModelIndex() ).isValid() );
-
- if ( model->rowCount() == 0 )
- return;
-
- // A valid index should have a valid QVariant data
- QVERIFY( model->index ( 0, 0 ).isValid() );
-
- // shouldn't be able to set data on an invalid index
- QVERIFY( !model->setData ( QModelIndex(), QLatin1String ( "foo" ), Qt::DisplayRole ) );
-
- // General Purpose roles that should return a QString
- QVariant variant = model->data ( model->index ( 0, 0 ), Qt::ToolTipRole );
- if ( variant.isValid() ) {
- QVERIFY( variant.canConvert(QMetaType::QString) );
- }
- variant = model->data ( model->index ( 0, 0 ), Qt::StatusTipRole );
- if ( variant.isValid() ) {
- QVERIFY( variant.canConvert(QMetaType::QString) );
- }
- variant = model->data ( model->index ( 0, 0 ), Qt::WhatsThisRole );
- if ( variant.isValid() ) {
- QVERIFY( variant.canConvert(QMetaType::QString) );
- }
-
- // General Purpose roles that should return a QSize
- variant = model->data ( model->index ( 0, 0 ), Qt::SizeHintRole );
- if ( variant.isValid() ) {
- QVERIFY( variant.canConvert(QMetaType::QSize) );
- }
-
- // General Purpose roles that should return a QFont
- QVariant fontVariant = model->data ( model->index ( 0, 0 ), Qt::FontRole );
- if ( fontVariant.isValid() ) {
- QVERIFY( fontVariant.canConvert(QMetaType::QFont) );
- }
-
- // Check that the alignment is one we know about
- QVariant textAlignmentVariant = model->data ( model->index ( 0, 0 ), Qt::TextAlignmentRole );
- if ( textAlignmentVariant.isValid() ) {
- int alignment = textAlignmentVariant.toInt();
- QCOMPARE( alignment, ( alignment & ( Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask ) ) );
- }
-
- // General Purpose roles that should return a QColor
- QVariant colorVariant = model->data ( model->index ( 0, 0 ), Qt::BackgroundColorRole );
- if ( colorVariant.isValid() ) {
- QVERIFY( colorVariant.canConvert(QMetaType::QColor) );
- }
-
- colorVariant = model->data ( model->index ( 0, 0 ), Qt::TextColorRole );
- if ( colorVariant.isValid() ) {
- QVERIFY( colorVariant.canConvert(QMetaType::QColor) );
- }
-
- // Check that the "check state" is one we know about.
- QVariant checkStateVariant = model->data ( model->index ( 0, 0 ), Qt::CheckStateRole );
- if ( checkStateVariant.isValid() ) {
- int state = checkStateVariant.toInt();
- QVERIFY( state == Qt::Unchecked ||
- state == Qt::PartiallyChecked ||
- state == Qt::Checked );
- }
-}
-
-/*!
- Store what is about to be inserted to make sure it actually happens
-
- \sa rowsInserted()
- */
-void ModelTest::rowsAboutToBeInserted ( const QModelIndex &parent, int start, int end )
-{
-// Q_UNUSED(end);
-// qDebug() << "rowsAboutToBeInserted" << "start=" << start << "end=" << end << "parent=" << model->data ( parent ).toString()
-// << "current count of parent=" << model->rowCount ( parent ); // << "display of last=" << model->data( model->index(start-1, 0, parent) );
-// qDebug() << model->index(start-1, 0, parent) << model->data( model->index(start-1, 0, parent) );
- Changing c;
- c.parent = parent;
- c.oldSize = model->rowCount ( parent );
- c.last = model->data ( model->index ( start - 1, 0, parent ) );
- c.next = model->data ( model->index ( start, 0, parent ) );
-qDebug() << start << " - " << parent << " - " << model->data ( model->index ( start, 0, parent ), Qt::UserRole );
- insert.push ( c );
-}
-
-/*!
- Confirm that what was said was going to happen actually did
-
- \sa rowsAboutToBeInserted()
- */
-void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end )
-{
- Changing c = insert.pop();
- QVERIFY( c.parent == parent );
-// qDebug() << "rowsInserted" << "start=" << start << "end=" << end << "oldsize=" << c.oldSize
-// << "parent=" << model->data ( parent ).toString() << "current rowcount of parent=" << model->rowCount ( parent );
-
-// for (int ii=start; ii <= end; ii++)
-// {
-// qDebug() << "itemWasInserted:" << ii << model->data ( model->index ( ii, 0, parent ));
-// }
-// qDebug();
-
- QVERIFY( c.oldSize + ( end - start + 1 ) == model->rowCount ( parent ) );
- QVERIFY( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) );
-
- if (c.next != model->data(model->index(end + 1, 0, c.parent))) {
- qDebug() << start << end;
- for (int i=0; i < model->rowCount(); ++i)
- qDebug() << model->index(i, 0).data().toString();
- qDebug() << c.next << model->data(model->index(end + 1, 0, c.parent));
- }
-
-if (c.next != model->data ( model->index ( end + 1, 0, c.parent ) )) {
- qDebug("break");
-}
- QVERIFY( c.next == model->data ( model->index ( end + 1, 0, c.parent ) ) );
-}
-
-void ModelTest::layoutAboutToBeChanged()
-{
- for ( int i = 0; i < qBound ( 0, model->rowCount(), 100 ); ++i )
- changing.append ( QPersistentModelIndex ( model->index ( i, 0 ) ) );
-}
-
-void ModelTest::layoutChanged()
-{
- for ( int i = 0; i < changing.count(); ++i ) {
- QPersistentModelIndex p = changing[i];
- QVERIFY( p == model->index ( p.row(), p.column(), p.parent() ) );
- }
- changing.clear();
-}
-
-/*!
- Store what is about to be inserted to make sure it actually happens
-
- \sa rowsRemoved()
- */
-void ModelTest::rowsAboutToBeRemoved ( const QModelIndex &parent, int start, int end )
-{
-qDebug() << "ratbr" << parent << start << end;
- Changing c;
- c.parent = parent;
- c.oldSize = model->rowCount ( parent );
- c.last = model->data ( model->index ( start - 1, 0, parent ) );
- c.next = model->data ( model->index ( end + 1, 0, parent ) );
- remove.push ( c );
-}
-
-/*!
- Confirm that what was said was going to happen actually did
-
- \sa rowsAboutToBeRemoved()
- */
-void ModelTest::rowsRemoved ( const QModelIndex & parent, int start, int end )
-{
- qDebug() << "rr" << parent << start << end;
- Changing c = remove.pop();
- QVERIFY( c.parent == parent );
- QVERIFY( c.oldSize - ( end - start + 1 ) == model->rowCount ( parent ) );
- QVERIFY( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) );
- QVERIFY( c.next == model->data ( model->index ( start, 0, c.parent ) ) );
-}
-
-
diff --git a/src/modeltest.h b/src/modeltest.h deleted file mode 100644 index 68090f3f..00000000 --- a/src/modeltest.h +++ /dev/null @@ -1,94 +0,0 @@ -/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef MODELTEST_H
-#define MODELTEST_H
-
-#include <QtCore/QObject>
-#include <QtCore/QAbstractItemModel>
-#include <QtCore/QStack>
-
-class ModelTest : public QObject
-{
- Q_OBJECT
-
-public:
- ModelTest( QAbstractItemModel *model, QObject *parent = 0 );
-
-private Q_SLOTS:
- void nonDestructiveBasicTest();
- void rowCount();
- void columnCount();
- void hasIndex();
- void index();
- void parent();
- void data();
-
-protected Q_SLOTS:
- void runAllTests();
- void layoutAboutToBeChanged();
- void layoutChanged();
- void rowsAboutToBeInserted( const QModelIndex &parent, int start, int end );
- void rowsInserted( const QModelIndex & parent, int start, int end );
- void rowsAboutToBeRemoved( const QModelIndex &parent, int start, int end );
- void rowsRemoved( const QModelIndex & parent, int start, int end );
-
-private:
- void checkChildren( const QModelIndex &parent, int currentDepth = 0 );
-
- QAbstractItemModel *model;
-
- struct Changing {
- QModelIndex parent;
- int oldSize;
- QVariant last;
- QVariant next;
- };
- QStack<Changing> insert;
- QStack<Changing> remove;
-
- bool fetchingMore;
-
- QList<QPersistentModelIndex> changing;
-};
-
-#endif
diff --git a/src/modinfo.cpp b/src/modinfo.cpp index 71a4a386..085eaf80 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -34,7 +34,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <iplugingame.h> #include <versioninfo.h> -#include <appconfig.h> +#include "shared/appconfig.h" #include <scriptextender.h> #include <unmanagedmods.h> #include <log.h> diff --git a/src/modinfooverwrite.cpp b/src/modinfooverwrite.cpp index 9a6a22c1..1f7f9318 100644 --- a/src/modinfooverwrite.cpp +++ b/src/modinfooverwrite.cpp @@ -1,6 +1,6 @@ #include "modinfooverwrite.h" -#include "appconfig.h" +#include "shared/appconfig.h" #include "settings.h" #include <QApplication> diff --git a/src/modlist.cpp b/src/modlist.cpp index c4d0089d..fb3dde13 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -31,7 +31,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "shared/fileentry.h" #include "shared/filesorigin.h" -#include <appconfig.h> +#include "shared/appconfig.h" #include <utility.h> #include <report.h> diff --git a/src/nexusinterface.cpp b/src/nexusinterface.cpp index 8fd6b15a..9eb1540a 100644 --- a/src/nexusinterface.cpp +++ b/src/nexusinterface.cpp @@ -24,7 +24,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "selectiondialog.h" #include "bbcode.h" #include <utility.h> -#include <util.h> +#include "shared/util.h" #include <log.h> #include <QApplication> diff --git a/src/nexusinterface.h b/src/nexusinterface.h index 0b1763c4..35362bdf 100644 --- a/src/nexusinterface.h +++ b/src/nexusinterface.h @@ -21,11 +21,11 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #define NEXUSINTERFACE_H #include "apiuseraccount.h" +#include "plugincontainer.h" #include <utility.h> #include <versioninfo.h> #include <imodrepositorybridge.h> -#include <plugincontainer.h> #include <QNetworkReply> #include <QNetworkDiskCache> diff --git a/src/organizercore.cpp b/src/organizercore.cpp index dacf0175..a6d6e34f 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -25,7 +25,7 @@ #include <scopeguard.h> #include <utility.h> #include <usvfs.h> -#include "appconfig.h" +#include "shared/appconfig.h" #include <report.h> #include <questionboxmemory.h> #include "instancemanager.h" diff --git a/src/organizerproxy.cpp b/src/organizerproxy.cpp index 613de742..e0c122a2 100644 --- a/src/organizerproxy.cpp +++ b/src/organizerproxy.cpp @@ -1,6 +1,6 @@ #include "organizerproxy.h"
-#include "appconfig.h"
+#include "shared/appconfig.h"
#include "organizercore.h"
#include "plugincontainer.h"
diff --git a/src/plugincontainer.cpp b/src/plugincontainer.cpp index 3227f496..caab2115 100644 --- a/src/plugincontainer.cpp +++ b/src/plugincontainer.cpp @@ -3,9 +3,9 @@ #include "organizerproxy.h"
#include "report.h"
#include <ipluginproxy.h>
-#include <iuserinterface.h>
+#include "iuserinterface.h"
#include <idownloadmanager.h>
-#include <appconfig.h>
+#include "shared/appconfig.h"
#include <QAction>
#include <QToolButton>
#include <QCoreApplication>
diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index d58b1c22..1f320982 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -31,7 +31,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <iplugingame.h>
#include <espfile.h>
#include <report.h>
-#include <windows_error.h>
+#include "shared/windows_error.h"
#include <safewritefile.h>
#include <gameplugins.h>
diff --git a/src/profile.cpp b/src/profile.cpp index cb99e586..c1e30c22 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -22,14 +22,14 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "modinfo.h" #include "settings.h" #include <utility.h> -#include <error_report.h> -#include "appconfig.h" +#include "shared/error_report.h" +#include "shared/appconfig.h" #include <iplugingame.h> #include <report.h> #include <safewritefile.h> #include <bsainvalidation.h> #include <dataarchives.h> -#include "util.h" +#include "shared/util.h" #include "registry.h" #include "modinfoforeign.h" #include <questionboxmemory.h> diff --git a/src/profilesdialog.cpp b/src/profilesdialog.cpp index c91f48f4..6f06a6be 100644 --- a/src/profilesdialog.cpp +++ b/src/profilesdialog.cpp @@ -20,7 +20,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "profilesdialog.h"
#include "ui_profilesdialog.h"
-#include "appconfig.h"
+#include "shared/appconfig.h"
#include "bsainvalidation.h"
#include "iplugingame.h"
#include "profile.h"
diff --git a/src/selfupdater.cpp b/src/selfupdater.cpp index 086ae05f..501c7ed1 100644 --- a/src/selfupdater.cpp +++ b/src/selfupdater.cpp @@ -34,7 +34,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "organizercore.h"
#include <versioninfo.h>
#include <report.h>
-#include <util.h>
+#include "shared/util.h"
#include <QApplication>
#include <QCoreApplication>
diff --git a/src/settings.cpp b/src/settings.cpp index 1b8c51b8..3bf8f2a2 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -21,7 +21,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "settingsutilities.h" #include "serverinfo.h" #include "executableslist.h" -#include "appconfig.h" +#include "shared/appconfig.h" #include "env.h" #include "envmetrics.h" #include <expanderwidget.h> diff --git a/src/settingsdialog.h b/src/settingsdialog.h index bae4a469..160f0748 100644 --- a/src/settingsdialog.h +++ b/src/settingsdialog.h @@ -21,7 +21,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #define SETTINGSDIALOG_H #include "tutorabledialog.h" -#include "util.h" +#include "shared/util.h" class PluginContainer; class Settings; diff --git a/src/settingsdialogdiagnostics.cpp b/src/settingsdialogdiagnostics.cpp index 74cadaa9..4ade6900 100644 --- a/src/settingsdialogdiagnostics.cpp +++ b/src/settingsdialogdiagnostics.cpp @@ -1,6 +1,6 @@ #include "settingsdialogdiagnostics.h" #include "ui_settingsdialog.h" -#include "appconfig.h" +#include "shared/appconfig.h" #include "organizercore.h" #include <log.h> diff --git a/src/settingsdialoggeneral.cpp b/src/settingsdialoggeneral.cpp index 58871cee..3d14d521 100644 --- a/src/settingsdialoggeneral.cpp +++ b/src/settingsdialoggeneral.cpp @@ -1,6 +1,6 @@ #include "settingsdialoggeneral.h" #include "ui_settingsdialog.h" -#include "appconfig.h" +#include "shared/appconfig.h" #include "categoriesdialog.h" #include "colortable.h" #include <utility.h> diff --git a/src/settingsdialogpaths.cpp b/src/settingsdialogpaths.cpp index c6fd40a7..74ba4f25 100644 --- a/src/settingsdialogpaths.cpp +++ b/src/settingsdialogpaths.cpp @@ -1,6 +1,6 @@ #include "settingsdialogpaths.h" #include "ui_settingsdialog.h" -#include "appconfig.h" +#include "shared/appconfig.h" #include <iplugingame.h> PathsSettingsTab::PathsSettingsTab(Settings& s, SettingsDialog& d) diff --git a/src/shared/directoryentry.cpp b/src/shared/directoryentry.cpp index 639392d2..43408dcf 100644 --- a/src/shared/directoryentry.cpp +++ b/src/shared/directoryentry.cpp @@ -21,7 +21,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "originconnection.h"
#include "filesorigin.h"
#include "fileentry.h"
-#include "envfs.h"
+#include "../envfs.h"
#include "util.h"
#include "windows_error.h"
#include <log.h>
diff --git a/src/shared/util.cpp b/src/shared/util.cpp index 483b36a9..ba500da9 100644 --- a/src/shared/util.cpp +++ b/src/shared/util.cpp @@ -19,8 +19,8 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "util.h"
#include "windows_error.h"
-#include "mainwindow.h"
-#include "env.h"
+#include "../mainwindow.h"
+#include "../env.h"
#include <log.h>
#include <usvfs.h>
#include <usvfs_version.h>
diff --git a/src/spawn.cpp b/src/spawn.cpp index df6fa379..2016bb23 100644 --- a/src/spawn.cpp +++ b/src/spawn.cpp @@ -32,8 +32,8 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <log.h>
#include <usvfs.h>
#include <Shellapi.h>
-#include <appconfig.h>
-#include <windows_error.h>
+#include "shared/appconfig.h"
+#include "shared/windows_error.h"
#include <QApplication>
#include <QMessageBox>
#include <QtDebug>
|
