From 956863c07ca5c647032fffd0eca31e02e66f4fa9 Mon Sep 17 00:00:00 2001
From: Rafael <Syping@users.noreply.github.com>
Date: Tue, 29 Mar 2016 17:37:46 +0200
Subject: [PATCH] add iconLoader class, new icons added to resources

---
 IconLoader.cpp | 40 ++++++++++++++++++++++++++++++++++++++++
 IconLoader.h   | 31 +++++++++++++++++++++++++++++++
 gta5sync.pro   |  2 ++
 main.cpp       |  7 ++++---
 res/app.qrc    |  8 ++++++++
 5 files changed, 85 insertions(+), 3 deletions(-)
 create mode 100755 IconLoader.cpp
 create mode 100755 IconLoader.h

diff --git a/IconLoader.cpp b/IconLoader.cpp
new file mode 100755
index 0000000..f093fb7
--- /dev/null
+++ b/IconLoader.cpp
@@ -0,0 +1,40 @@
+/*****************************************************************************
+* gta5sync GRAND THEFT AUTO V SYNC
+* Copyright (C) 2016 Syping
+*
+* This program 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.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*****************************************************************************/
+
+#include "IconLoader.h"
+#include <QIcon>
+
+IconLoader::IconLoader()
+{
+
+}
+
+QIcon IconLoader::loadingAppIcon()
+{
+    QIcon appIcon;
+    appIcon.addFile(":/img/5sync-16.png", QSize(16, 16));
+    appIcon.addFile(":/img/5sync-24.png", QSize(24, 24));
+    appIcon.addFile(":/img/5sync-32.png", QSize(32, 32));
+    appIcon.addFile(":/img/5sync-40.png", QSize(40, 40));
+    appIcon.addFile(":/img/5sync-48.png", QSize(48, 48));
+    appIcon.addFile(":/img/5sync-64.png", QSize(64, 64));
+    appIcon.addFile(":/img/5sync-96.png", QSize(96, 96));
+    appIcon.addFile(":/img/5sync-128.png", QSize(128, 128));
+    appIcon.addFile(":/img/5sync-256.png", QSize(256, 256));
+    return appIcon;
+}
diff --git a/IconLoader.h b/IconLoader.h
new file mode 100755
index 0000000..3fd8f07
--- /dev/null
+++ b/IconLoader.h
@@ -0,0 +1,31 @@
+/*****************************************************************************
+* gta5sync GRAND THEFT AUTO V SYNC
+* Copyright (C) 2016 Syping
+*
+* This program 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.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*****************************************************************************/
+
+#ifndef ICONLOADER_H
+#define ICONLOADER_H
+
+#include <QIcon>
+
+class IconLoader
+{
+public:
+    IconLoader();
+    static QIcon loadingAppIcon();
+};
+
+#endif // ICONLOADER_H
diff --git a/gta5sync.pro b/gta5sync.pro
index 9c4ba5f..77b2c15 100755
--- a/gta5sync.pro
+++ b/gta5sync.pro
@@ -27,6 +27,7 @@ SOURCES += main.cpp \
     AboutDialog.cpp \
     CrewDatabase.cpp \
     DatabaseThread.cpp \
+    IconLoader.cpp \
     PictureDialog.cpp \
     ProfileDatabase.cpp \
     ProfileInterface.cpp \
@@ -44,6 +45,7 @@ HEADERS  += \
     AboutDialog.h \
     CrewDatabase.h \
     DatabaseThread.h \
+    IconLoader.h \
     PictureDialog.h \
     ProfileDatabase.h \
     ProfileInterface.h \
diff --git a/main.cpp b/main.cpp
index 775b9c9..9089f9c 100755
--- a/main.cpp
+++ b/main.cpp
@@ -24,6 +24,7 @@
 #include "UserInterface.h"
 #include "CrewDatabase.h"
 #include "SavegameData.h"
+#include "IconLoader.h"
 #include <QApplication>
 #include <QStringList>
 #include <QTranslator>
@@ -243,7 +244,7 @@ int main(int argc, char *argv[])
 
         bool readOk = picture.readingPictureFromFile(arg1);
         picDialog->setWindowFlags(picDialog->windowFlags()^Qt::WindowContextHelpButtonHint);
-        picDialog->setWindowIcon(QIcon(":/img/5sync-48.png"));
+        picDialog->setWindowIcon(IconLoader::loadingAppIcon());
         picDialog->setSnapmaticPicture(&picture, readOk);
 
         int crewID = picture.getCrewNumber();
@@ -265,7 +266,7 @@ int main(int argc, char *argv[])
 
         bool readOk = savegame.readingSavegameFromFile(arg1);
         savegameDialog->setWindowFlags(savegameDialog->windowFlags()^Qt::WindowContextHelpButtonHint);
-        savegameDialog->setWindowIcon(QIcon(":/img/5sync-48.png"));
+        savegameDialog->setWindowIcon(IconLoader::loadingAppIcon());
         savegameDialog->setSavegameData(&savegame, readOk);
 
         if (!readOk) { return 1; }
@@ -283,7 +284,7 @@ int main(int argc, char *argv[])
     threadDB->start();
 
     UserInterface *uiWindow = new UserInterface(profileDB, crewDB, threadDB);
-    uiWindow->setWindowIcon(QIcon(":/img/5sync-48.png"));
+    uiWindow->setWindowIcon(IconLoader::loadingAppIcon());
     uiWindow->show();
 
     return a.exec();
diff --git a/res/app.qrc b/res/app.qrc
index 5517c88..490e86b 100755
--- a/res/app.qrc
+++ b/res/app.qrc
@@ -7,5 +7,13 @@
     <qresource prefix="/img">
         <file>savegame.png</file>
         <file>5sync-48.png</file>
+        <file>5sync-16.png</file>
+        <file>5sync-24.png</file>
+        <file>5sync-32.png</file>
+        <file>5sync-40.png</file>
+        <file>5sync-64.png</file>
+        <file>5sync-96.png</file>
+        <file>5sync-128.png</file>
+        <file>5sync-256.png</file>
     </qresource>
 </RCC>