aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-12-01 16:34:51 +0100
committerPetr Mrázek <peterix@gmail.com>2013-12-01 16:34:51 +0100
commitf56eff04ef4d23b62a6e095eca5d4b9f2b52e023 (patch)
treed7e5ccd335f4be09d11d3d6bb9c333fa6945516c
parenta3fbf05c7b77d513b107e34732b2d04045a05c3c (diff)
downloadPrismLauncher-f56eff04ef4d23b62a6e095eca5d4b9f2b52e023.tar.gz
PrismLauncher-f56eff04ef4d23b62a6e095eca5d4b9f2b52e023.tar.bz2
PrismLauncher-f56eff04ef4d23b62a6e095eca5d4b9f2b52e023.zip
Fix (hopefully) library dependency resolution.
Installing libs is now enabled, hardcoded. Enable -Wall for all builds. Fix many warnings and latent bugs.
-rw-r--r--CMakeLists.txt188
-rw-r--r--MultiMC.cpp3
-rw-r--r--depends/groupview/src/categorizedview.cpp29
-rw-r--r--depends/groupview/src/categorizedview_p.h17
-rw-r--r--depends/groupview/src/categorydrawer.cpp2
-rw-r--r--depends/pack200/src/bands.cpp2
-rw-r--r--depends/pack200/src/bytes.h2
-rw-r--r--depends/pack200/src/coding.cpp1
-rw-r--r--depends/pack200/src/unpack.cpp17
-rw-r--r--depends/pack200/src/unpack200.cpp2
-rw-r--r--depends/quazip/unzip.c2
-rw-r--r--depends/quazip/zip.c2
-rw-r--r--depends/settings/include/keyring.h5
-rw-r--r--depends/settings/src/stubkeyring.h5
-rw-r--r--gui/dialogs/CopyInstanceDialog.cpp2
-rw-r--r--gui/dialogs/EditNotesDialog.cpp4
-rw-r--r--gui/dialogs/InstanceSettings.cpp2
-rw-r--r--gui/dialogs/LegacyModEditDialog.cpp2
-rw-r--r--gui/dialogs/OneSixModEditDialog.cpp2
-rw-r--r--gui/widgets/InstanceDelegate.cpp176
-rw-r--r--logic/BaseInstance.cpp2
-rw-r--r--logic/InstanceFactory.cpp12
-rw-r--r--logic/JavaChecker.cpp2
-rw-r--r--logic/JavaChecker.h2
-rw-r--r--logic/LegacyInstance.cpp1
-rw-r--r--logic/ModList.cpp10
-rw-r--r--logic/OneSixInstance.cpp1
-rw-r--r--logic/OneSixUpdate.cpp1
-rw-r--r--logic/lists/InstanceList.cpp8
29 files changed, 244 insertions, 260 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a33e4736..0986b900 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,14 +27,14 @@ ENDIF()
######## Set compiler flags ########
IF(APPLE)
message(STATUS "Using APPLE CMAKE_CXX_FLAGS")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
ELSEIF(UNIX)
# assume GCC, add C++0x/C++11 stuff
MESSAGE(STATUS "Using UNIX CMAKE_CXX_FLAGS")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
ELSEIF(MINGW)
MESSAGE(STATUS "Using MINGW CMAKE_CXX_FLAGS")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -Wall")
ENDIF()
################################ INCLUDE LIBRARIES ################################
@@ -48,6 +48,23 @@ find_package(Qt5LinguistTools REQUIRED)
include_directories(${Qt5Widgets_INCLUDE_DIRS})
+# The Qt5 cmake files don't provide its install paths, so ask qmake.
+get_target_property(QMAKE_EXECUTABLE Qt5::qmake LOCATION)
+function(QUERY_QMAKE VAR RESULT)
+ exec_program(${QMAKE_EXECUTABLE} ARGS "-query ${VAR}" RETURN_VALUE return_code OUTPUT_VARIABLE output )
+ if(NOT return_code)
+ file(TO_CMAKE_PATH "${output}" output)
+ set(${RESULT} ${output} PARENT_SCOPE)
+ endif(NOT return_code)
+endfunction(QUERY_QMAKE)
+
+query_qmake(QT_INSTALL_PLUGINS QT_PLUGINS_DIR)
+query_qmake(QT_INSTALL_IMPORTS QT_IMPORTS_DIR)
+query_qmake(QT_INSTALL_LIBS QT_LIBS_DIR)
+query_qmake(QT_HOST_DATA QT_DATA_DIR)
+set(QT_MKSPECS_DIR ${QT_DATA_DIR}/mkspecs)
+
+
######## Included Libs ########
# Add quazip
@@ -429,7 +446,6 @@ CONFIGURE_FILE(generated.qrc.in generated.qrc)
QT5_ADD_RESOURCES(GENERATED_QRC ${CMAKE_CURRENT_BINARY_DIR}/generated.qrc)
QT5_ADD_RESOURCES(GRAPHICS_QRC graphics.qrc)
-
# Add executable
ADD_EXECUTABLE(MultiMC MACOSX_BUNDLE WIN32
${MULTIMC_SOURCES} ${MULTIMC_UI} ${GRAPHICS_QRC} ${GENERATED_QRC} ${MULTIMC_RCS})
@@ -439,110 +455,102 @@ TARGET_LINK_LIBRARIES(MultiMC xz-embedded unpack200 quazip libUtil libSettings l
QT5_USE_MODULES(MultiMC Core Widgets Network Xml ${MultiMC_QT_ADDITIONAL_MODULES})
ADD_DEPENDENCIES(MultiMC MultiMCLauncher JavaCheck)
-option(BUILD_KEYRING_TEST "Build the simple keyring test binary" OFF)
-IF(BUILD_KEYRING_TEST)
- # test.cpp
- ADD_EXECUTABLE(Test test.cpp)
- QT5_USE_MODULES(Test Core)
- TARGET_LINK_LIBRARIES(Test libUtil libSettings)
-ENDIF()
-
################################ INSTALLATION AND PACKAGING ################################
-# use QtCreator's QTDIR var
-IF(DEFINED ENV{QTDIR})
- SET(Qt5_DIR $ENV{QTDIR})
-ENDIF()
-######## Plugin and library folders ########
-
-SET(PLUGIN_DEST_DIR plugins)
-SET(QTCONF_DEST_DIR .)
-SET(APPS "\${CMAKE_INSTALL_PREFIX}/MultiMC")
-
-IF(WIN32)
- SET(PLUGIN_DEST_DIR .)
- SET(QTCONF_DEST_DIR .)
- SET(APPS "\${CMAKE_INSTALL_PREFIX}/MultiMC.exe")
-ENDIF()
+######## Packaging/install paths setup ########
-IF(UNIX)
-IF(APPLE)
+IF(UNIX AND APPLE)
SET(PLUGIN_DEST_DIR MultiMC.app/Contents/MacOS)
SET(QTCONF_DEST_DIR MultiMC.app/Contents/Resources)
- SET(APPS "\${CMAKE_INSTALL_PREFIX}/MultiMC.app")
-ELSE()
- SET(APPS "\${CMAKE_INSTALL_PREFIX}/bin/MultiMC")
-ENDIF()
-ENDIF()
-
-SET(QT_PLUGINS_DIR ${Qt5_DIR}/plugins)
-SET(QT_LIBRARY_DIRS ${Qt5_DIR}/lib)
+ SET(APPS "\${CMAKE_INSTALL_PREFIX}/MultiMC.app")
-
-######## OS X Bundle Info ########
-
-IF(APPLE)
SET(MACOSX_BUNDLE_BUNDLE_NAME "MultiMC")
SET(MACOSX_BUNDLE_INFO_STRING "MultiMC Minecraft launcher and management utility.")
- SET(MACOSX_BUNDLE_BUNDLE_VERSION
- "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_REV}.${MultiMC_VERSION_BUILD}")
+ SET(MACOSX_BUNDLE_BUNDLE_VERSION "${MultiMC_VERSION_MAJOR}.${MultiMC_VERSION_MINOR}.${MultiMC_VERSION_REV}.${MultiMC_VERSION_BUILD}")
#SET(MACOSX_BUNDLE_GUI_IDENTIFIER "")
SET(MACOSX_BUNDLE_ICON_FILE MultiMC.icns)
-ENDIF(APPLE)
+ELSEIF(UNIX)
+ SET(PLUGIN_DEST_DIR plugins)
+ SET(QTCONF_DEST_DIR .)
+ SET(APPS "\${CMAKE_INSTALL_PREFIX}/bin/MultiMC")
+ELSEIF(WIN32)
+ SET(PLUGIN_DEST_DIR .)
+ SET(QTCONF_DEST_DIR .)
+ SET(APPS "\${CMAKE_INSTALL_PREFIX}/MultiMC.exe")
+ENDIF()
+
+# directories to look for dependencies
+SET(DIRS "${QT_LIBS_DIR}")
######## Install ########
#### Executable ####
-IF(WIN32)
-INSTALL(TARGETS MultiMC
- BUNDLE DESTINATION . COMPONENT Runtime
- LIBRARY DESTINATION . COMPONENT Runtime
- RUNTIME DESTINATION . COMPONENT Runtime
-)
-ENDIF()
-IF(UNIX)
-IF(APPLE)
-INSTALL(TARGETS MultiMC
- BUNDLE DESTINATION . COMPONENT Runtime
- RUNTIME DESTINATION MultiMC.app/Contents/MacOS COMPONENT Runtime
-)
-ELSE()
-INSTALL(TARGETS MultiMC
- BUNDLE DESTINATION . COMPONENT Runtime
- RUNTIME DESTINATION bin COMPONENT Runtime
-)
-INSTALL(PROGRAMS package/linux/MultiMC DESTINATION .)
-ENDIF()
-ENDIF()
+IF(APPLE AND UNIX) ## OSX
+ INSTALL(TARGETS MultiMC
+ BUNDLE DESTINATION . COMPONENT Runtime
+ RUNTIME DESTINATION MultiMC.app/Contents/MacOS COMPONENT Runtime
+ )
+ELSEIF(UNIX) ## LINUX and similar
+ INSTALL(TARGETS MultiMC
+ BUNDLE DESTINATION . COMPONENT Runtime
+ RUNTIME DESTINATION bin COMPONENT Runtime
+ )
+ INSTALL(PROGRAMS package/linux/MultiMC DESTINATION .)
-#### Plugins ####
+ELSEIF(WIN32) ## WINDOWS
+ INSTALL(TARGETS MultiMC
+ BUNDLE DESTINATION . COMPONENT Runtime
+ LIBRARY DESTINATION . COMPONENT Runtime
+ RUNTIME DESTINATION . COMPONENT Runtime
+ )
+ENDIF()
-OPTION(MultiMC_INSTALL_SHARED_LIBS "if set, Qt's shared libraries will be copied to the installation directory on install")
+#### Dist package logic ####
-IF (MultiMC_INSTALL_SHARED_LIBS)
- # Image formats
- INSTALL(DIRECTORY "${QT_PLUGINS_DIR}/imageformats" DESTINATION ${PLUGIN_DEST_DIR} COMPONENT Runtime)
+# Image formats
+INSTALL(
+ DIRECTORY "${QT_PLUGINS_DIR}/imageformats"
+ DESTINATION ${PLUGIN_DEST_DIR}
+ COMPONENT Runtime
+ REGEX "tga|svg|tiff|mng" EXCLUDE
+ REGEX "d\\." EXCLUDE
+)
- # Platform plugins
- INSTALL(DIRECTORY "${QT_PLUGINS_DIR}/platforms" DESTINATION ${PLUGIN_DEST_DIR} COMPONENT Runtime)
+# Platform plugins
+INSTALL(
+ DIRECTORY "${QT_PLUGINS_DIR}/platforms"
+ DESTINATION ${PLUGIN_DEST_DIR}
+ COMPONENT Runtime
+ REGEX "minimal|linuxfb|offscreen" EXCLUDE
+ REGEX "d\\." EXCLUDE
+)
- # qtconf
- INSTALL(CODE "
- FILE(WRITE \"\${CMAKE_INSTALL_PREFIX}/${QTCONF_DEST_DIR}/qt.conf\" \"\")
- " COMPONENT Runtime)
+# qtconf
+INSTALL(
+ CODE "
+FILE(WRITE \"\${CMAKE_INSTALL_PREFIX}/${QTCONF_DEST_DIR}/qt.conf\" \"\")
+"
+ COMPONENT Runtime
+)
- # Dirs to look for dependencies.
- SET(DIRS "${QT_LIBRARY_DIRS}")
+INSTALL(
+ CODE "
+FILE(GLOB_RECURSE QTPLUGINS \"\${CMAKE_INSTALL_PREFIX}/${PLUGIN_DEST_DIR}/*${CMAKE_SHARED_LIBRARY_SUFFIX}\")
+function(gp_resolved_file_type_override resolved_file type_var)
+ if(resolved_file MATCHES \"^/usr/lib/libQt\")
+ message(\"resolving \${resolved_file} as system\")
+ set(\${type_var} other PARENT_SCOPE)
+ endif()
+endfunction()
+
+include(BundleUtilities)
+fixup_bundle(\"${APPS}\" \"\${QTPLUGINS}\" \"${DIRS}\")
+"
+ COMPONENT Runtime
+)
- INSTALL(CODE "
- file(GLOB_RECURSE QTPLUGINS
- \"\${CMAKE_INSTALL_PREFIX}/${PLUGIN_DEST_DIR}/*${CMAKE_SHARED_LIBRARY_SUFFIX}\")
- include(BundleUtilities)
- fixup_bundle(\"${APPS}\" \"\${QTPLUGINS}\" \"${DIRS}\")
- " COMPONENT Runtime)
-ENDIF()
######## Package ########
@@ -586,11 +594,11 @@ include_directories(${PROJECT_BINARY_DIR}/include)
file (GLOB TRANSLATIONS_FILES translations/*.ts)
option (UPDATE_TRANSLATIONS "Update source translation translations/*.ts files (WARNING: make clean will delete the source .ts files! Danger!)")
-if (UPDATE_TRANSLATIONS)
- qt5_create_translation(QM_FILES ${FILES_TO_TRANSLATE} ${TRANSLATIONS_FILES})
-else (UPDATE_TRANSLATIONS)
- qt5_add_translation(QM_FILES ${TRANSLATIONS_FILES})
-endif (UPDATE_TRANSLATIONS)
+IF(UPDATE_TRANSLATIONS)
+ qt5_create_translation(QM_FILES ${FILES_TO_TRANSLATE} ${TRANSLATIONS_FILES})
+ELSE()
+ qt5_add_translation(QM_FILES ${TRANSLATIONS_FILES})
+ENDIF()
add_custom_target (translations DEPENDS ${QM_FILES})
diff --git a/MultiMC.cpp b/MultiMC.cpp
index 1ac84629..b699dbc5 100644
--- a/MultiMC.cpp
+++ b/MultiMC.cpp
@@ -190,6 +190,9 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
case QNetworkProxy::FtpCachingProxy:
proxyDesc = "FTP caching: ";
break;
+ default:
+ proxyDesc = "DERP proxy: ";
+ break;
}
proxyDesc += QString("%3@%1:%2 pass %4")
.arg(proxy.hostName())
diff --git a/depends/groupview/src/categorizedview.cpp b/depends/groupview/src/categorizedview.cpp
index f4449949..1345205c 100644
--- a/depends/groupview/src/categorizedview.cpp
+++ b/depends/groupview/src/categorizedview.cpp
@@ -58,18 +58,6 @@ struct KCategorizedView::Private::Item
struct KCategorizedView::Private::Block
{
- Block()
- : topLeft ( QPoint() )
- , height ( -1 )
- , firstIndex ( QModelIndex() )
- , quarantineStart ( QModelIndex() )
- , items ( QList<Item>() )
- , outOfQuarantine ( false )
- , alternate ( false )
- , collapsed ( false )
- {
- }
-
bool operator!= ( const Block &rhs ) const
{
return firstIndex != rhs.firstIndex;
@@ -83,7 +71,7 @@ struct KCategorizedView::Private::Block
}
QPoint topLeft;
- int height;
+ int height = -1;
QPersistentModelIndex firstIndex;
// if we have n elements on this block, and we inserted an element at position i. The quarantine
// will start at index (i, column, parent). This means that for all elements j where i <= j <= n, the
@@ -97,25 +85,16 @@ struct KCategorizedView::Private::Block
// this affects the whole block, not items separately. items contain the topLeft point relative
// to the block. Because of insertions or removals a whole block can be moved, so the whole block
// will enter in quarantine, what is faster than moving all items in absolute terms.
- bool outOfQuarantine;
+ bool outOfQuarantine = false;
// should we alternate its color ? is just a hint, could not be used
- bool alternate;
- bool collapsed;
+ bool alternate = false;
+ bool collapsed = false;
};
KCategorizedView::Private::Private ( KCategorizedView *q )
: q ( q )
- , proxyModel ( 0 )
- , categoryDrawer ( 0 )
- , categorySpacing ( 5 )
- , alternatingBlockColors ( false )
- , collapsibleBlocks ( false )
, hoveredBlock ( new Block() )
- , hoveredIndex ( QModelIndex() )
- , pressedPosition ( QPoint() )
- , rubberBandRect ( QRect() )
- , constantItemWidth( 0 )
{
}
diff --git a/depends/groupview/src/categorizedview_p.h b/depends/groupview/src/categorizedview_p.h
index 13809312..524bba3a 100644
--- a/depends/groupview/src/categorizedview_p.h
+++ b/depends/groupview/src/categorizedview_p.h
@@ -137,14 +137,15 @@ public:
*/
void _k_slotCollapseOrExpandClicked(QModelIndex);
- KCategorizedView *q;
- KCategorizedSortFilterProxyModel *proxyModel;
- KCategoryDrawer *categoryDrawer;
- int categorySpacing;
- bool alternatingBlockColors;
- bool collapsibleBlocks;
- bool constantItemWidth;
-
+ KCategorizedView *q = nullptr;
+ KCategorizedSortFilterProxyModel *proxyModel = nullptr;
+ KCategoryDrawer *categoryDrawer = nullptr;
+ int categorySpacing = 5;
+ bool alternatingBlockColors = false;
+ bool collapsibleBlocks = false;
+ bool constantItemWidth = false;
+
+ // FIXME: this is some really weird logic. Investigate.
Block *hoveredBlock;
QString hoveredCategory;
QModelIndex hoveredIndex;
diff --git a/depends/groupview/src/categorydrawer.cpp b/depends/groupview/src/categorydrawer.cpp
index 04903206..214ce3b2 100644
--- a/depends/groupview/src/categorydrawer.cpp
+++ b/depends/groupview/src/categorydrawer.cpp
@@ -42,9 +42,9 @@ public:
~Private()
{
}
+ KCategorizedView *view;
int leftMargin;
int rightMargin;
- KCategorizedView *view;
};
KCategoryDrawer::KCategoryDrawer(KCategorizedView *view)
diff --git a/depends/pack200/src/bands.cpp b/depends/pack200/src/bands.cpp
index 1c10b35b..1608d838 100644
--- a/depends/pack200/src/bands.cpp
+++ b/depends/pack200/src/bands.cpp
@@ -79,7 +79,6 @@ void band::readData(int expectedLength)
// Read one value to see what it might be.
int XB = _meta_default;
- int cp1 = 0, cp2 = 0;
if (!is_BYTE1)
{
// must be a variable-length coding
@@ -109,7 +108,6 @@ void band::readData(int expectedLength)
{
// Skip over the escape value.
u->rp = xvs.rp;
- cp1 = 1;
}
else
{
diff --git a/depends/pack200/src/bytes.h b/depends/pack200/src/bytes.h
index 2e4a9daf..6ed0b729 100644
--- a/depends/pack200/src/bytes.h
+++ b/depends/pack200/src/bytes.h
@@ -87,7 +87,7 @@ struct bytes
bytes res;
res.ptr = ptr + beg;
res.len = end - beg;
- assert(res.len == 0 || inBounds(res.ptr) && inBounds(res.limit() - 1));
+ assert(res.len == 0 ||(inBounds(res.ptr) && inBounds(res.limit() - 1)));
return res;
}
// building C strings inside byte buffers:
diff --git a/depends/pack200/src/coding.cpp b/depends/pack200/src/coding.cpp
index 226ba458..3e311131 100644
--- a/depends/pack200/src/coding.cpp
+++ b/depends/pack200/src/coding.cpp
@@ -121,7 +121,6 @@ coding *coding::init()
this->min = this->umin = 0;
if (S != 0 && range != 0)
{
- int Smask = (1 << S) - 1;
int64_t maxPosCode = range - 1;
int64_t maxNegCode = range - 1;
while (IS_NEG_CODE(S, maxPosCode))
diff --git a/depends/pack200/src/unpack.cpp b/depends/pack200/src/unpack.cpp
index b286269d..55d253b2 100644
--- a/depends/pack200/src/unpack.cpp
+++ b/depends/pack200/src/unpack.cpp
@@ -483,10 +483,6 @@ void unpacker::putu1ref(entry *e)
putu1_at(put_space(1), oidx);
}
-static int total_cp_size[] = {0, 0};
-static int largest_cp_ref[] = {0, 0};
-static int hash_probes[] = {0, 0};
-
// Allocation of small and large blocks.
enum
@@ -705,7 +701,7 @@ void unpacker::read_file_header()
unpack_abort("impossible archive size"); // bad input data
return;
}
- if (archive_size < header_size_1)
+ if (archive_size < (size_t)header_size_1)
{
unpack_abort("too much read-ahead"); // somehow we pre-fetched too much?
return;
@@ -1316,8 +1312,6 @@ void unpacker::read_signature_values(entry *cpMap, int len)
// Cf. PackageReader.readConstantPool
void unpacker::read_cp()
{
- byte *rp0 = rp;
-
int i;
for (int k = 0; k < (int)N_TAGS_IN_ORDER; k++)
@@ -1596,7 +1590,6 @@ band **unpacker::attr_definitions::buildBands(unpacker::layout_definition *lo)
const char *unpacker::attr_definitions::parseIntLayout(const char *lp, band *&res, byte le_kind,
bool can_be_signed)
{
- const char *lp0 = lp;
band *b = U_NEW(band, 1);
char le = *lp++;
int spec = UNSIGNED5_spec;
@@ -1638,7 +1631,6 @@ const char *unpacker::attr_definitions::parseIntLayout(const char *lp, band *&re
const char *unpacker::attr_definitions::parseNumeral(const char *lp, int &res)
{
- const char *lp0 = lp;
bool sgn = false;
if (*lp == '0')
{
@@ -1703,7 +1695,6 @@ band **unpacker::attr_definitions::popBody(int bs_base)
const char *unpacker::attr_definitions::parseLayout(const char *lp, band **&res, int curCble)
{
- const char *lp0 = lp;
int bs_base = band_stack.length();
bool top_level = (bs_base == 0);
band *b;
@@ -3135,8 +3126,6 @@ unpacker::read_bcs()
void unpacker::read_bands()
{
- byte *rp0 = rp;
-
read_file_header();
if (cp.nentries == 0)
@@ -3312,7 +3301,7 @@ void constant_pool::initMemberIndexes()
// Get the pre-existing indexes:
int nclasses = tag_count[CONSTANT_Class];
- entry *classes = tag_base[CONSTANT_Class] + entries;
+ // entry *classes = tag_base[CONSTANT_Class] + entries; // UNUSED
int nfields = tag_count[CONSTANT_Fieldref];
entry *fields = tag_base[CONSTANT_Fieldref] + entries;
int nmethods = tag_count[CONSTANT_Methodref];
@@ -3563,8 +3552,6 @@ void unpacker::start(void *packptr, size_t len)
void unpacker::check_options()
{
- const char *strue = "true";
- const char *sfalse = "false";
if (deflate_hint_or_zero != 0)
{
bool force_deflate_hint = (deflate_hint_or_zero > 0);
diff --git a/depends/pack200/src/unpack200.cpp b/depends/pack200/src/unpack200.cpp
index 2ff8c34a..0a9d2714 100644
--- a/depends/pack200/src/unpack200.cpp
+++ b/depends/pack200/src/unpack200.cpp
@@ -97,8 +97,6 @@ static int read_magic(unpacker *u, char peek[], int peeklen)
void unpack_200(std::string input_path, std::string output_path)
{
unpacker u;
- int status = 0;
-
FILE *input = fopen(input_path.c_str(), "rb");
if (!input)
{
diff --git a/depends/quazip/unzip.c b/depends/quazip/unzip.c
index 6e115ae6..52bc081f 100644
--- a/depends/quazip/unzip.c
+++ b/depends/quazip/unzip.c
@@ -1173,7 +1173,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
if (password != NULL)
{
int i;
- s->pcrc_32_tab = get_crc_table();
+ s->pcrc_32_tab = (const unsigned long*) get_crc_table();
init_keys(password,s->keys,s->pcrc_32_tab);
if (ZSEEK(s->z_filefunc, s->filestream,
s->pfile_in_zip_read->pos_in_zipfile +
diff --git a/depends/quazip/zip.c b/depends/quazip/zip.c
index bf8c0a10..a36a20a1 100644
--- a/depends/quazip/zip.c
+++ b/depends/quazip/zip.c
@@ -903,7 +903,7 @@ extern int ZEXPORT zipOpenNewFileInZip3 (file, filename, zipfi,
unsigned char bufHead[RAND_HEAD_LEN];
unsigned int sizeHead;
zi->ci.encrypt = 1;
- zi->ci.pcrc_32_tab = get_crc_table();
+ zi->ci.pcrc_32_tab = (const unsigned long*) get_crc_table();
/*init_keys(password,zi->ci.keys,zi->ci.pcrc_32_tab);*/
crcForCrypting = (uLong)zi->ci.dosDate << 16; // ATTANTION! Without this row, you don't unpack your password protected archive in other app.
diff --git a/depends/settings/include/keyring.h b/depends/settings/include/keyring.h
index 747211de..a4da23b1 100644
--- a/depends/settings/include/keyring.h
+++ b/depends/settings/include/keyring.h
@@ -34,6 +34,11 @@ class LIBSETTINGS_EXPORT Keyring
{
public:
/**
+ * @brief virtual dtor
+ */
+ virtual ~Keyring() {};
+
+ /**
* @brief the System Keyring instance
* @return the Keyring instance
*/
diff --git a/depends/settings/src/stubkeyring.h b/depends/settings/src/stubkeyring.h
index f25cefde..1f4b1be0 100644
--- a/depends/settings/src/stubkeyring.h
+++ b/depends/settings/src/stubkeyring.h
@@ -24,6 +24,11 @@
class StubKeyring : public Keyring
{
public:
+ /**
+ * @brief virtual dtor
+ */
+ virtual ~StubKeyring() {};
+
virtual bool storePassword(QString service, QString username, QString password);
virtual QString getPassword(QString service, QString username);
virtual bool hasPassword(QString service, QString username);
diff --git a/gui/dialogs/CopyInstanceDialog.cpp b/gui/dialogs/CopyInstanceDialog.cpp
index 4d588a1e..9d7ac30c 100644
--- a/gui/dialogs/CopyInstanceDialog.cpp
+++ b/gui/dialogs/CopyInstanceDialog.cpp
@@ -33,7 +33,7 @@
#include "logic/BaseInstance.h"
CopyInstanceDialog::CopyInstanceDialog(BaseInstance *original, QWidget *parent)
- : m_original(original), QDialog(parent), ui(new Ui::CopyInstanceDialog)
+ :QDialog(parent), ui(new Ui::CopyInstanceDialog), m_original(original)
{
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this);
diff --git a/gui/dialogs/EditNotesDialog.cpp b/gui/dialogs/EditNotesDialog.cpp
index cd52e694..a265a4d0 100644
--- a/gui/dialogs/EditNotesDialog.cpp
+++ b/gui/dialogs/EditNotesDialog.cpp
@@ -21,8 +21,8 @@
#include <QApplication>
EditNotesDialog::EditNotesDialog(QString notes, QString name, QWidget *parent)
- : m_instance_notes(notes), m_instance_name(name), QDialog(parent),
- ui(new Ui::EditNotesDialog)
+ : QDialog(parent), ui(new Ui::EditNotesDialog), m_instance_name(name),
+ m_instance_notes(notes)
{
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this);
diff --git a/gui/dialogs/InstanceSettings.cpp b/gui/dialogs/InstanceSettings.cpp
index f059047f..bc6b266a 100644
--- a/gui/dialogs/InstanceSettings.cpp
+++ b/gui/dialogs/InstanceSettings.cpp
@@ -32,7 +32,7 @@
#include <QMessageBox>
InstanceSettings::InstanceSettings(SettingsObject *obj, QWidget *parent)
- : m_obj(obj), QDialog(parent), ui(new Ui::InstanceSettings)
+ : QDialog(parent), ui(new Ui::InstanceSettings), m_obj(obj)
{
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this);
diff --git a/gui/dialogs/LegacyModEditDialog.cpp b/gui/dialogs/LegacyModEditDialog.cpp
index 25a1c616..66d53ee1 100644
--- a/gui/dialogs/LegacyModEditDialog.cpp
+++ b/gui/dialogs/LegacyModEditDialog.cpp
@@ -31,7 +31,7 @@
#include <QKeyEvent>
LegacyModEditDialog::LegacyModEditDialog(LegacyInstance *inst, QWidget *parent)
- : m_inst(inst), QDialog(parent), ui(new Ui::LegacyModEditDialog)
+ : QDialog(parent), ui(new Ui::LegacyModEditDialog), m_inst(inst)
{
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this);
diff --git a/gui/dialogs/OneSixModEditDialog.cpp b/gui/dialogs/OneSixModEditDialog.cpp
index dea1b86b..51ea2d19 100644
--- a/gui/dialogs/OneSixModEditDialog.cpp
+++ b/gui/dialogs/OneSixModEditDialog.cpp
@@ -40,7 +40,7 @@
#include "logic/ForgeInstaller.h"
OneSixModEditDialog::OneSixModEditDialog(OneSixInstance *inst, QWidget *parent)
- : m_inst(inst), QDialog(parent), ui(new Ui::OneSixModEditDialog)
+ : QDialog(parent), ui(new Ui::OneSixModEditDialog), m_inst(inst)
{
MultiMCPlatform::fixWM_CLASS(this);
ui->setupUi(this);
diff --git a/gui/widgets/InstanceDelegate.cpp b/gui/widgets/InstanceDelegate.cpp
index 487fed61..5020b8b6 100644
--- a/gui/widgets/InstanceDelegate.cpp
+++ b/gui/widgets/InstanceDelegate.cpp
@@ -21,45 +21,45 @@
#include <QtCore/qmath.h>
// Origin: Qt
-static void viewItemTextLayout ( QTextLayout &textLayout, int lineWidth, qreal &height, qreal &widthUsed )
+static void viewItemTextLayout(QTextLayout &textLayout, int lineWidth, qreal &height,
+ qreal &widthUsed)
{
height = 0;
widthUsed = 0;
textLayout.beginLayout();
QString str = textLayout.text();
- while ( true )
+ while (true)
{
QTextLine line = textLayout.createLine();
- if ( !line.isValid() )
+ if (!line.isValid())
break;
- if(line.textLength() == 0)
+ if (line.textLength() == 0)
break;
- line.setLineWidth ( lineWidth );
- line.setPosition ( QPointF ( 0, height ) );
+ line.setLineWidth(lineWidth);
+ line.setPosition(QPointF(0, height));
height += line.height();
- widthUsed = qMax ( widthUsed, line.naturalTextWidth() );
+ widthUsed = qMax(widthUsed, line.naturalTextWidth());
}
textLayout.endLayout();
}
-#define QFIXED_MAX (INT_MAX/256)
+#define QFIXED_MAX (INT_MAX / 256)
-ListViewDelegate::ListViewDelegate ( QObject* parent ) : QStyledItemDelegate ( parent )
+ListViewDelegate::ListViewDelegate(QObject *parent) : QStyledItemDelegate(parent)
{
-
}
-void drawSelectionRect(QPainter *painter, const QStyleOptionViewItemV4 &option, const QRect &rect)
+void drawSelectionRect(QPainter *painter, const QStyleOptionViewItemV4 &option,
+ const QRect &rect)
{
if ((option.state & QStyle::State_Selected))
- painter->fillRect ( rect, option.palette.brush ( QPalette::Highlight ) );
+ painter->fillRect(rect, option.palette.brush(QPalette::Highlight));
else
{
QColor backgroundColor = option.palette.color(QPalette::Background);
backgroundColor.setAlpha(160);
- painter->fillRect ( rect, QBrush(backgroundColor) );
+ painter->fillRect(rect, QBrush(backgroundColor));
}
-
}
void drawFocusRect(QPainter *painter, const QStyleOptionViewItemV4 &option, const QRect &rect)
@@ -67,11 +67,12 @@ void drawFocusRect(QPainter *painter, const QStyleOptionViewItemV4 &option, cons
if (!(option.state & QStyle::State_HasFocus))
return;
QStyleOptionFocusRect opt;
- opt.direction = option.direction;
- opt.fontMetrics = option.fontMetrics;
- opt.palette = option.palette;
- opt.rect = rect;
- //opt.state = option.state | QStyle::State_KeyboardFocusChange | QStyle::State_Item;
+ opt.direction = option.direction;
+ opt.fontMetrics = option.fontMetrics;
+ opt.palette = option.palette;
+ opt.rect = rect;
+ // opt.state = option.state | QStyle::State_KeyboardFocusChange |
+ // QStyle::State_Item;
auto col = option.state & QStyle::State_Selected ? QPalette::Highlight : QPalette::Base;
opt.backgroundColor = option.palette.color(col);
// Apparently some widget styles expect this hint to not be set
@@ -84,29 +85,31 @@ void drawFocusRect(QPainter *painter, const QStyleOptionViewItemV4 &option, cons
painter->setRenderHint(QPainter::Antialiasing);
}
-static QSize viewItemTextSize ( const QStyleOptionViewItemV4 *option )
+static QSize viewItemTextSize(const QStyleOptionViewItemV4 *option)
{
QStyle *style = option->widget ? option->widget->style() : QApplication::style();
QTextOption textOption;
- textOption.setWrapMode ( QTextOption::WrapAtWordBoundaryOrAnywhere );
+ textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
QTextLayout textLayout;
- textLayout.setTextOption ( textOption );
- textLayout.setFont ( option->font );
- textLayout.setText ( option->text );
- const int textMargin = style->pixelMetric ( QStyle::PM_FocusFrameHMargin, option, option->widget ) + 1;
- QRect bounds ( 0,0,100 - 2*textMargin,600 );
+ textLayout.setTextOption(textOption);
+ textLayout.setFont(option->font);
+ textLayout.setText(option->text);
+ const int textMargin =
+ style->pixelMetric(QStyle::PM_FocusFrameHMargin, option, option->widget) + 1;
+ QRect bounds(0, 0, 100 - 2 * textMargin, 600);
qreal height = 0, widthUsed = 0;
- viewItemTextLayout ( textLayout, bounds.width(), height, widthUsed );
- const QSize size ( qCeil ( widthUsed ), qCeil ( height ) );
- return QSize ( size.width() + 2 * textMargin, size.height() );
+ viewItemTextLayout(textLayout, bounds.width(), height, widthUsed);
+ const QSize size(qCeil(widthUsed), qCeil(height));
+ return QSize(size.width() + 2 * textMargin, size.height());
}
-void ListViewDelegate::paint ( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
+void ListViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
+ const QModelIndex &index) const
{