72 lines
1.5 KiB
C++
Executable File
72 lines
1.5 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
*
|
|
* MainWindow for settings editor
|
|
*
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <nglwidgets/nglmainwindow.h>
|
|
|
|
#include <QMap>
|
|
#include <QPair>
|
|
#include <QTreeWidgetItem>
|
|
#include <QString>
|
|
#include <QVariant>
|
|
|
|
namespace Ui
|
|
{
|
|
class MainWindow;
|
|
}
|
|
|
|
namespace SettingsEditor
|
|
{
|
|
// --------------------------------------------------------------------------------
|
|
// | Class MainWindow |
|
|
// --------------------------------------------------------------------------------
|
|
class MainWindow : public NGLMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit MainWindow(QWidget *parent = nullptr);
|
|
~MainWindow();
|
|
|
|
private slots:
|
|
void oncurrentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
|
void onSaveSettings();
|
|
void onExportSettings();
|
|
void onLoadFromExport();
|
|
void onLoadPresetFromTemplate();
|
|
|
|
private:
|
|
bool saveSettings(const QString &filename);
|
|
bool loadSettings(const QString &filename);
|
|
enum SettingType
|
|
{
|
|
String = 1,
|
|
StringList = 2,
|
|
Json = 3,
|
|
FunctionKeys = 4,
|
|
Boolean = 5,
|
|
};
|
|
|
|
void enableTextEdit(bool enabled = true);
|
|
void enableFunctionKeyEdit();
|
|
void enableBoolEdit();
|
|
void setVersionView();
|
|
static QString craftKey(const QString &group, const QString &key);
|
|
static QString typeToString(SettingType t);
|
|
static SettingType stringToType(const QString &s);
|
|
|
|
QMap<QString, QPair<SettingType, QVariant>> m_data;
|
|
QString m_settingsFileName;
|
|
|
|
Ui::MainWindow *m_ui;
|
|
};
|
|
}
|