add iconLoader class, new icons added to resources

This commit is contained in:
Rafael 2016-03-29 17:37:46 +02:00
parent 25e3c1a263
commit 956863c07c
5 changed files with 85 additions and 3 deletions

40
IconLoader.cpp Executable file
View file

@ -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;
}

31
IconLoader.h Executable file
View file

@ -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

View file

@ -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 \

View file

@ -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();

View file

@ -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>