Skip to content

Commit ebfa55b

Browse files
committed
Began adding translations and using Qt Designer .ui files.
Also added QSetting value names to common.h Work is halfway on both translations and .ui files. I added a very quick and rough finnish translation. The program now requires the translation files to be created before running that can be done with lrelease gui.pro. To compile the whole GUI one must do the following cd gui qmake lrelease gui.pro make
1 parent b245b7a commit ebfa55b

24 files changed

+3717
-441
lines changed

gui/applicationlist.cpp

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818

1919
#include "applicationlist.h"
2020
#include <QStringList>
21+
#include "common.h"
2122

22-
ApplicationList::ApplicationList()
23+
ApplicationList::ApplicationList(QObject *parent) :
24+
QObject(parent)
2325
{
2426
//ctor
2527
}
@@ -29,11 +31,12 @@ ApplicationList::~ApplicationList()
2931
Clear();
3032
}
3133

32-
void ApplicationList::LoadSettings(QSettings &programSettings)
34+
void ApplicationList::LoadSettings(QSettings *programSettings)
3335
{
3436

35-
QStringList names = programSettings.value("Application names", QStringList()).toStringList();
36-
QStringList paths = programSettings.value("Application paths", QStringList()).toStringList();
37+
QStringList names = programSettings->value(SETTINGS_APPLICATION_NAMES, QStringList()).toStringList();
38+
QStringList paths = programSettings->value(SETTINGS_APPLICATION_PATHS, QStringList()).toStringList();
39+
3740
if (names.size() == paths.size())
3841
{
3942
for (int i = 0; i < names.size(); i++)
@@ -43,7 +46,7 @@ void ApplicationList::LoadSettings(QSettings &programSettings)
4346
}
4447
}
4548

46-
void ApplicationList::SaveSettings(QSettings &programSettings)
49+
void ApplicationList::SaveSettings(QSettings *programSettings)
4750
{
4851
QStringList names;
4952
QStringList paths;
@@ -54,8 +57,8 @@ void ApplicationList::SaveSettings(QSettings &programSettings)
5457
paths << GetApplicationPath(i);
5558
}
5659

57-
programSettings.setValue("Application names", names);
58-
programSettings.setValue("Application paths", paths);
60+
programSettings->setValue(SETTINGS_APPLICATION_NAMES, names);
61+
programSettings->setValue(SETTINGS_APPLICATION_PATHS, paths);
5962

6063
}
6164

@@ -125,12 +128,17 @@ void ApplicationList::MoveFirst(const int index)
125128
}
126129

127130

128-
void ApplicationList::Copy(ApplicationList &list)
131+
void ApplicationList::Copy(ApplicationList *list)
129132
{
133+
if (!list)
134+
{
135+
return;
136+
}
137+
130138
Clear();
131-
for (int i = 0; i < list.GetApplicationCount(); i++)
139+
for (int i = 0;i < list->GetApplicationCount();i++)
132140
{
133-
AddApplicationType(list.GetApplicationName(i), list.GetApplicationPath(i));
141+
AddApplicationType(list->GetApplicationName(i), list->GetApplicationPath(i));
134142
}
135143
}
136144

gui/applicationlist.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
*/
4444
class ApplicationList : public QObject
4545
{
46+
Q_OBJECT
4647
public:
4748

4849
/**
@@ -64,21 +65,21 @@ class ApplicationList : public QObject
6465
QString Path;
6566
} ApplicationType;
6667

67-
ApplicationList();
68+
ApplicationList(QObject *parent = 0);
6869
virtual ~ApplicationList();
6970

7071
/**
7172
* @brief Load all applications
7273
*
7374
* @param programSettings QSettings to load application list from
7475
*/
75-
void LoadSettings(QSettings &programSettings);
76+
void LoadSettings(QSettings *programSettings);
7677

7778
/**
7879
* @brief Save all applications
7980
* @param programSettings QSettings to save applications to
8081
*/
81-
void SaveSettings(QSettings &programSettings);
82+
void SaveSettings(QSettings *programSettings);
8283

8384
/**
8485
* @brief Get the amount of applications in the list
@@ -143,7 +144,7 @@ class ApplicationList : public QObject
143144
* list given as a parameter.
144145
* @param list Copying source
145146
*/
146-
void Copy(ApplicationList &list);
147+
void Copy(ApplicationList *list);
147148
protected:
148149

149150
/**

gui/common.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,30 @@ typedef enum
3333
}
3434
ShowTypes;
3535

36+
/**
37+
* QSetting value names
38+
*/
39+
#define SETTINGS_WINDOW_MAXIMIZED "Window maximized"
40+
#define SETTINGS_WINDOW_WIDTH "Window width"
41+
#define SETTINGS_WINDOW_HEIGHT "Window height"
42+
#define SETTINGS_SHOW_ALL "Show all"
43+
#define SETTINGS_SHOW_SECURITY "Show security"
44+
#define SETTINGS_SHOW_STYLE "Show style"
45+
#define SETTINGS_SHOW_ERRORS "Show errors"
46+
#define SETTINGS_CHECK_PATH "Check path"
47+
#define SETTINGS_CHECK_FORCE "Check force"
48+
#define SETTINGS_CHECK_THREADS "Check threads"
49+
#define SETTINGS_SHOW_FULL_PATH "Show full path"
50+
#define SETTINGS_SHOW_NO_ERRORS "Show no errors message"
51+
#define SETTINGS_SAVE_ALL_ERRORS "Save all errors"
52+
#define SETTINGS_SAVE_FULL_PATH "Save full path"
53+
#define SETTINGS_CHECK_DIALOG_WIDTH "Check dialog width"
54+
#define SETTINGS_CHECK_DIALOG_HEIGHT "Check dialog height"
55+
#define SETTINGS_APPLICATION_NAMES "Application names"
56+
#define SETTINGS_APPLICATION_PATHS "Application paths"
57+
#define SETTINGS_RESULT_COLUMN_WIDTH "Result column %1 width"
58+
#define SETTINGS_LANGUAGE "Application language"
59+
#define SETTINGS_TOOLBARS_SHOW "Toolbars/ShowStandard"
60+
61+
3662
#endif

0 commit comments

Comments
 (0)