using new Settings and Profiles;
not compatible with older minetestMapperGui versions.master
parent
66d7c55967
commit
c0d6870299
3
main.cpp
3
main.cpp
|
@ -4,6 +4,9 @@
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
//set organization to MinetestMapperGui which is read by settings
|
||||||
|
QCoreApplication::setOrganizationName("MinetestMapperGui");
|
||||||
|
QCoreApplication::setApplicationName("MinetestMapperGui");
|
||||||
MainWindow w;
|
MainWindow w;
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
|
|
275
mainwindow.cpp
275
mainwindow.cpp
|
@ -4,20 +4,12 @@
|
||||||
#include <qstringlist.h>
|
#include <qstringlist.h>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QSettings>
|
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QCompleter>
|
#include <QCompleter>
|
||||||
#include <QDirModel>
|
#include <QDirModel>
|
||||||
|
|
||||||
#include "configdialog.h"
|
#include "configdialog.h"
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
|
||||||
static const QString qSettingsOrganisation("addi");
|
|
||||||
static const QString qSettingsApplicationPrefix("Minetestmapper_");
|
|
||||||
#else
|
|
||||||
static const QString qSettingsOrganisation("minetestmapper");
|
|
||||||
static const QString qSettingsApplicationPrefix("");
|
|
||||||
#endif
|
|
||||||
static QMap<int, QString> geometryGranularitySymbolic;
|
static QMap<int, QString> geometryGranularitySymbolic;
|
||||||
static QMap<QString, int> geometryGranularityNumeric;
|
static QMap<QString, int> geometryGranularityNumeric;
|
||||||
static QMap<int, QString> geometrySizeModeSymbolic;
|
static QMap<int, QString> geometrySizeModeSymbolic;
|
||||||
|
@ -43,8 +35,6 @@ InitStatics::InitStatics(void)
|
||||||
geometrySizeModeNumeric[geometrySizeModeSymbolic[i]] = i;
|
geometrySizeModeNumeric[geometrySizeModeSymbolic[i]] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) :
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
ui(new Ui::MainWindow),
|
ui(new Ui::MainWindow),
|
||||||
|
@ -54,6 +44,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
if (!migrateSettingsProfiles())
|
if (!migrateSettingsProfiles())
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
finishUiInitialisation();
|
finishUiInitialisation();
|
||||||
readSettings();
|
readSettings();
|
||||||
|
@ -253,7 +244,6 @@ void MainWindow::on_button_generate_clicked()
|
||||||
QDir imgPath = QFileInfo(imgName).absoluteDir();
|
QDir imgPath = QFileInfo(imgName).absoluteDir();
|
||||||
if(!imgPath.exists())
|
if(!imgPath.exists())
|
||||||
{
|
{
|
||||||
qDebug()<<"Ordner Existiert nicht";
|
|
||||||
int ret = QMessageBox::question(this, tr("the directory does not exist"),
|
int ret = QMessageBox::question(this, tr("the directory does not exist"),
|
||||||
tr("The directory <i>%1</i> does not exist. <br><br>"
|
tr("The directory <i>%1</i> does not exist. <br><br>"
|
||||||
"Should it be created?")
|
"Should it be created?")
|
||||||
|
@ -540,12 +530,17 @@ void MainWindow::wrapupMapper()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Todo: Move migrateSettingsProfiles into an other program/script,
|
||||||
|
because it needs only to run once (eg. after installation); not every startup.
|
||||||
|
*/
|
||||||
bool MainWindow::migrateSettingsProfiles()
|
bool MainWindow::migrateSettingsProfiles()
|
||||||
{
|
{
|
||||||
QSettings oldSettings("addi", "Minetestmapper");
|
QSettings oldSettings("addi", "Minetestmapper");
|
||||||
QFile oldSettingsFile(oldSettings.fileName());
|
QFile oldSettingsFile(oldSettings.fileName());
|
||||||
if (!oldSettingsFile.exists()) return true;
|
if (!oldSettingsFile.exists()) return true;
|
||||||
QSettings newSettings(qSettingsOrganisation, "Minetestmapper");
|
QSettings newSettings;
|
||||||
QFile newSettingsFile(newSettings.fileName());
|
QFile newSettingsFile(newSettings.fileName());
|
||||||
|
|
||||||
QDir oldDir(oldSettings.fileName().section('/', 0, -2));
|
QDir oldDir(oldSettings.fileName().section('/', 0, -2));
|
||||||
|
@ -634,38 +629,40 @@ void MainWindow::createProfilesMenu(){
|
||||||
|
|
||||||
connect(profileGroup, SIGNAL (triggered(QAction *)), this, SLOT (slotProfileChanged(QAction *)));
|
connect(profileGroup, SIGNAL (triggered(QAction *)), this, SLOT (slotProfileChanged(QAction *)));
|
||||||
|
|
||||||
QSettings settings(QSettings::IniFormat,QSettings::UserScope,qSettingsOrganisation, qSettingsApplicationPrefix+"profile_default");
|
#if QT_VERSION >=0x050500
|
||||||
QString profilePath = settings.fileName();
|
//if using Qt version >= 5.5.0;
|
||||||
qDebug()<<"Profile path "<< profilePath;
|
QDir dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation).append("/profiles/"));
|
||||||
QDir dir(profilePath);
|
|
||||||
dir.cdUp();
|
|
||||||
QStringList fileNames = dir.entryList(QStringList("profile_*.ini"));
|
|
||||||
qDebug()<<fileNames;
|
|
||||||
if(fileNames.size()==0)fileNames.append("profile_default.ini");
|
|
||||||
for (int i = 0; i < fileNames.size(); ++i) {
|
|
||||||
// get locale extracted by filename
|
|
||||||
QString profile;
|
|
||||||
profile = fileNames[i]; // "gui_de.qm"
|
|
||||||
profile.truncate(profile.lastIndexOf('.')); // "gui_de"
|
|
||||||
profile.remove(0, profile.lastIndexOf('_') + 1); // "de"
|
|
||||||
|
|
||||||
// QString lang = QLocale::languageToString(QLocale(locale).language());
|
#else
|
||||||
// QIcon ico(QString("%1/%2.png").arg(m_langPath).arg(locale));
|
//Qt 5.4 or less
|
||||||
|
QSettings dummySettings(QSettings::IniFormat, QSettings::UserScope,QCoreApplication::organizationName(),"/profiles/default");
|
||||||
|
|
||||||
QAction *action = new QAction(profile, this);
|
QDir dir = QFileInfo(dummySettings.fileName()).absoluteDir();
|
||||||
|
#endif
|
||||||
|
QStringList fileNames = dir.entryList(QStringList("*.ini"));
|
||||||
|
|
||||||
|
qDebug()<<"found the Profiles"<< fileNames<< "in"<<dir.absolutePath();
|
||||||
|
|
||||||
|
if(fileNames.size()==0){
|
||||||
|
fileNames.append("default");//if nothing found create default profile
|
||||||
|
}
|
||||||
|
foreach (QString file, fileNames) {
|
||||||
|
QFileInfo fi(file);
|
||||||
|
QString name = fi.completeBaseName();
|
||||||
|
|
||||||
|
QAction *action = new QAction(name, this);
|
||||||
action->setCheckable(true);
|
action->setCheckable(true);
|
||||||
action->setData(profile);
|
action->setData(name);
|
||||||
|
|
||||||
ui->menuChoose_profile->addAction(action);
|
ui->menuChoose_profile->addAction(action);
|
||||||
profileGroup->addAction(action);
|
profileGroup->addAction(action);
|
||||||
|
|
||||||
// set default translators and language checked
|
// check if this profile the selected profile
|
||||||
if (currentProfile == profile)
|
if (currentProfile == name)
|
||||||
{
|
{
|
||||||
action->setChecked(true);
|
action->setChecked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called every time, when a menu entry of the profile menu is called
|
// Called every time, when a menu entry of the profile menu is called
|
||||||
|
@ -675,15 +672,11 @@ void MainWindow::slotProfileChanged(QAction* action)
|
||||||
//writeProfile(currentProfile);
|
//writeProfile(currentProfile);
|
||||||
currentProfile = action->data().toString();
|
currentProfile = action->data().toString();
|
||||||
readProfile(currentProfile);
|
readProfile(currentProfile);
|
||||||
// load the language dependant on the action content
|
|
||||||
//ui->menuLanguage->setIcon(action->icon());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::writeSettings()
|
void MainWindow::writeSettings()
|
||||||
{
|
{
|
||||||
QSettings settings(qSettingsOrganisation, "Minetestmapper");
|
|
||||||
|
|
||||||
settings.beginGroup("MainWindow");
|
settings.beginGroup("MainWindow");
|
||||||
if(isMaximized()){
|
if(isMaximized()){
|
||||||
settings.setValue("maximized", isMaximized());
|
settings.setValue("maximized", isMaximized());
|
||||||
|
@ -700,64 +693,77 @@ void MainWindow::writeSettings()
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::writeProfile(QString profile)
|
void MainWindow::writeProfile(QString strProfile)
|
||||||
{
|
{
|
||||||
QSettings settings(QSettings::IniFormat,QSettings::UserScope,qSettingsOrganisation, qSettingsApplicationPrefix+"profile_"+profile);
|
//QSettings::setDefaultFormat(QSettings::IniFormat);
|
||||||
//todo: check the current profile
|
//QSettings profile;
|
||||||
|
|
||||||
settings.beginGroup("Mapper");
|
//looks odd, but it constructs the correct settingsfile
|
||||||
|
QSettings profile(QSettings::IniFormat, QSettings::UserScope,QCoreApplication::organizationName(),"/profiles/"+strProfile);
|
||||||
|
qDebug()<<"Write profile"<< strProfile<<"to:"<<profile.fileName();
|
||||||
|
|
||||||
|
profile.beginGroup("Mapper");
|
||||||
//'currentSettings'
|
//'currentSettings'
|
||||||
settings.setValue("path_minetestmapper", currentSettings.mapperPath);
|
profile.setValue("path_minetestmapper", currentSettings.mapperPath);
|
||||||
|
profile.endGroup();
|
||||||
|
|
||||||
//tab1 General
|
profile.beginGroup("general");//tab1 General
|
||||||
settings.setValue("path_OutputImage", ui->path_OutputImage->text());
|
profile.setValue("path_OutputImage", ui->path_OutputImage->text());
|
||||||
settings.setValue("path_World", ui->path_World->text());
|
profile.setValue("path_World", ui->path_World->text());
|
||||||
settings.setValue("backend",ui->backend->currentIndex());
|
profile.setValue("backend",ui->backend->currentIndex());
|
||||||
|
profile.endGroup();
|
||||||
|
|
||||||
//tab2 area
|
profile.beginGroup("area"); //tab2 area
|
||||||
settings.setValue("scalefactor",ui->scalefactor->currentIndex());
|
profile.setValue("scalefactor",ui->scalefactor->currentIndex());
|
||||||
settings.setValue("geometry",ui->geometry->getGeometry());
|
profile.setValue("geometry",ui->geometry->getGeometry());
|
||||||
settings.setValue("geometry_format",ui->geometry->getFormatStr());
|
profile.setValue("geometry_format",ui->geometry->getFormatStr());
|
||||||
settings.setValue("minY",ui->minY->value());
|
profile.setValue("minY",ui->minY->value());
|
||||||
settings.setValue("maxY",ui->maxY->value());
|
profile.setValue("maxY",ui->maxY->value());
|
||||||
settings.setValue("geometry_granularity",geometryGranularitySymbolic[ui->geometrymode_granularity_group->checkedId()]);
|
profile.setValue("geometry_granularity",geometryGranularitySymbolic[ui->geometrymode_granularity_group->checkedId()]);
|
||||||
settings.setValue("geometry_sizemode",geometrySizeModeSymbolic[ui->geometrymode_size_group->checkedId()]);
|
profile.setValue("geometry_sizemode",geometrySizeModeSymbolic[ui->geometrymode_size_group->checkedId()]);
|
||||||
|
profile.endGroup();
|
||||||
|
|
||||||
//tab3 heightmap
|
profile.beginGroup("heightmap"); //tab3 heightmap
|
||||||
settings.setValue("generateHeightmap",ui->generateHeightmap->isChecked());
|
profile.setValue("generateHeightmap",ui->generateHeightmap->isChecked());
|
||||||
settings.setValue("path_HeightmapNodes", ui->path_HeightmapNodes->text());
|
profile.setValue("path_HeightmapNodes", ui->path_HeightmapNodes->text());
|
||||||
settings.setValue("colorHeightmap", ui->colorHeightmap->text());
|
profile.setValue("colorHeightmap", ui->colorHeightmap->text());
|
||||||
settings.setValue("path_HeightmapColors", ui->path_HeightmapColors->text());
|
profile.setValue("path_HeightmapColors", ui->path_HeightmapColors->text());
|
||||||
settings.setValue("drawHeightscale", ui->drawHeightscale->isChecked());
|
profile.setValue("drawHeightscale", ui->drawHeightscale->isChecked());
|
||||||
settings.setValue("heightLevelNull", ui->heightLevelNull->value());
|
profile.setValue("heightLevelNull", ui->heightLevelNull->value());
|
||||||
|
profile.endGroup();
|
||||||
|
|
||||||
//tab4 Colors
|
profile.beginGroup("colors"); //tab4 Colors
|
||||||
settings.setValue("path_ColorsTxt",ui->path_ColorsTxt->text());
|
profile.setValue("path_ColorsTxt",ui->path_ColorsTxt->text());
|
||||||
settings.setValue("bgcolor",ui->bgcolor->text());
|
profile.setValue("bgcolor",ui->bgcolor->text());
|
||||||
settings.setValue("blockcolor",ui->blockcolor->text());
|
profile.setValue("blockcolor",ui->blockcolor->text());
|
||||||
settings.setValue("scalecolor",ui->scalecolor->text());
|
profile.setValue("scalecolor",ui->scalecolor->text());
|
||||||
settings.setValue("origincolor",ui->origincolor->text());
|
profile.setValue("origincolor",ui->origincolor->text());
|
||||||
settings.setValue("playercolor",ui->playercolor->text());
|
profile.setValue("playercolor",ui->playercolor->text());
|
||||||
settings.setValue("tileborderrcolor",ui->tilebordercolor->text());
|
profile.setValue("tileborderrcolor",ui->tilebordercolor->text());
|
||||||
|
profile.endGroup();
|
||||||
|
|
||||||
//tab5 Featurs
|
profile.beginGroup("features"); //tab5 Featurs
|
||||||
settings.setValue("drawScaleLeft",ui->drawScaleLeft->isChecked());
|
profile.setValue("drawScaleLeft",ui->drawScaleLeft->isChecked());
|
||||||
settings.setValue("drawScaleTop",ui->drawScaleTop->isChecked());
|
profile.setValue("drawScaleTop",ui->drawScaleTop->isChecked());
|
||||||
settings.setValue("drawOrigin",ui->drawOrigin->isChecked());
|
profile.setValue("drawOrigin",ui->drawOrigin->isChecked());
|
||||||
settings.setValue("drawPlayers",ui->drawPlayers->isChecked());
|
profile.setValue("drawPlayers",ui->drawPlayers->isChecked());
|
||||||
settings.setValue("drawAlpha",ui->drawAlpha->currentIndex());
|
profile.setValue("drawAlpha",ui->drawAlpha->currentIndex());
|
||||||
settings.setValue("drawAir",ui->drawAir->isChecked());
|
profile.setValue("drawAir",ui->drawAir->isChecked());
|
||||||
settings.setValue("noShading",ui->noShading->isChecked());
|
profile.setValue("noShading",ui->noShading->isChecked());
|
||||||
|
profile.endGroup();
|
||||||
|
|
||||||
//tab6 Tiles
|
profile.beginGroup("tiles"); //tab6 Tiles
|
||||||
settings.setValue("drawTiles",ui->tiles->isChecked());
|
profile.setValue("drawTiles",ui->tiles->isChecked());
|
||||||
|
/*
|
||||||
|
* Todo: also save and restore other tiles
|
||||||
|
*/
|
||||||
|
|
||||||
settings.endGroup();
|
profile.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::readSettings()
|
void MainWindow::readSettings()
|
||||||
{
|
{
|
||||||
QSettings settings(qSettingsOrganisation, "Minetestmapper");
|
qDebug()<<"Read settings from"<<settings.fileName();
|
||||||
|
|
||||||
settings.beginGroup("MainWindow");
|
settings.beginGroup("MainWindow");
|
||||||
if (settings.value("maximized",false).toBool()) {
|
if (settings.value("maximized",false).toBool()) {
|
||||||
|
@ -778,68 +784,79 @@ void MainWindow::readSettings()
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::readProfile(QString profile)
|
void MainWindow::readProfile(QString strProfile)
|
||||||
{
|
{
|
||||||
QSettings settings(QSettings::IniFormat,QSettings::UserScope,qSettingsOrganisation, qSettingsApplicationPrefix+"profile_"+profile);
|
QSettings profile(QSettings::IniFormat,
|
||||||
settings.beginGroup("Mapper");
|
QSettings::UserScope,
|
||||||
|
QCoreApplication::organizationName(),
|
||||||
|
"/profiles/"+strProfile);
|
||||||
|
qDebug()<< "Reading profile"<< profile.fileName();
|
||||||
|
|
||||||
|
profile.beginGroup("Mapper");
|
||||||
//'currentSettings'
|
//'currentSettings'
|
||||||
currentSettings.mapperPath = settings.value("path_minetestmapper").toString();
|
currentSettings.mapperPath = profile.value("path_minetestmapper").toString();
|
||||||
|
profile.endGroup();
|
||||||
|
|
||||||
//tab1 Genral
|
profile.beginGroup("general"); //tab1 Genral
|
||||||
ui->path_World->setText(settings.value("path_World",QDir::homePath()).toString());
|
ui->path_World->setText(profile.value("path_World",QDir::homePath()).toString());
|
||||||
ui->path_OutputImage->setText(settings.value("path_OutputImage",QDir::homePath().append("/map.png")).toString());
|
ui->path_OutputImage->setText(profile.value("path_OutputImage",QDir::homePath().append("/map.png")).toString());
|
||||||
ui->backend->setCurrentIndex(settings.value("backend",0).toInt());
|
ui->backend->setCurrentIndex(profile.value("backend",0).toInt());
|
||||||
|
profile.endGroup();
|
||||||
|
|
||||||
//tab2 Area
|
profile.beginGroup("area"); //tab2 Area
|
||||||
ui->scalefactor->setCurrentIndex(settings.value("scalefactor",0).toInt());
|
ui->scalefactor->setCurrentIndex(profile.value("scalefactor",0).toInt());
|
||||||
ui->geometry->set(settings.value("geometry").toString());
|
ui->geometry->set(profile.value("geometry").toString());
|
||||||
ui->geometry->setFormat(settings.value("geometry_format").toString());
|
ui->geometry->setFormat(profile.value("geometry_format").toString());
|
||||||
ui->checkBox_maxY->setChecked(settings.value("checkBox_maxY",false).toBool());
|
ui->checkBox_maxY->setChecked(profile.value("checkBox_maxY",false).toBool());
|
||||||
ui->checkBox_minY->setChecked(settings.value("checkBox_minY",false).toBool());
|
ui->checkBox_minY->setChecked(profile.value("checkBox_minY",false).toBool());
|
||||||
ui->maxY->setValue(settings.value("maxY",0).toInt());
|
ui->maxY->setValue(profile.value("maxY",0).toInt());
|
||||||
ui->minY->setValue(settings.value("minY",0).toInt());
|
ui->minY->setValue(profile.value("minY",0).toInt());
|
||||||
QString granularity = settings.value("geometry_granularity").toString();
|
QString granularity = profile.value("geometry_granularity").toString();
|
||||||
if (geometryGranularityNumeric.find(granularity) != geometryGranularityNumeric.end())
|
if (geometryGranularityNumeric.find(granularity) != geometryGranularityNumeric.end())
|
||||||
ui->geometrymode_granularity_group->button(geometryGranularityNumeric[granularity])->setChecked(true);
|
ui->geometrymode_granularity_group->button(geometryGranularityNumeric[granularity])->setChecked(true);
|
||||||
// Else post a warning message ??
|
// Else post a warning message ??
|
||||||
QString sizemode = settings.value("geometry_sizemode").toString();
|
QString sizemode = profile.value("geometry_sizemode").toString();
|
||||||
if (geometrySizeModeNumeric.find(sizemode) != geometrySizeModeNumeric.end())
|
if (geometrySizeModeNumeric.find(sizemode) != geometrySizeModeNumeric.end())
|
||||||
ui->geometrymode_size_group->button(geometrySizeModeNumeric[sizemode])->setChecked(true);
|
ui->geometrymode_size_group->button(geometrySizeModeNumeric[sizemode])->setChecked(true);
|
||||||
// Else post a warning message ??
|
// Else post a warning message ??
|
||||||
|
profile.endGroup();
|
||||||
|
|
||||||
//tab3 Heightmap
|
profile.beginGroup("heightmap"); //tab3 Heightmap
|
||||||
ui->generateHeightmap->setChecked(settings.value("generateHeightmap",false).toBool());
|
ui->generateHeightmap->setChecked(profile.value("generateHeightmap",false).toBool());
|
||||||
ui->path_HeightmapNodes->setText(settings.value("path_HeightmapNodes","./colors/heightmap-nodes.txt").toString());
|
ui->path_HeightmapNodes->setText(profile.value("path_HeightmapNodes","./colors/heightmap-nodes.txt").toString());
|
||||||
ui->path_HeightmapColors->setText(settings.value("path_HeightmapColors","./colors/heightmap-colors.txt").toString());
|
ui->path_HeightmapColors->setText(profile.value("path_HeightmapColors","./colors/heightmap-colors.txt").toString());
|
||||||
ui->colorHeightmap->setText(settings.value("colorHeightmap","").toString());
|
ui->colorHeightmap->setText(profile.value("colorHeightmap","").toString());
|
||||||
ui->drawHeightscale->setChecked(settings.value("drawHeightscale",false).toBool());
|
ui->drawHeightscale->setChecked(profile.value("drawHeightscale",false).toBool());
|
||||||
ui->heightLevelNull->setValue(settings.value("heightLevelNull",0).toInt());
|
ui->heightLevelNull->setValue(profile.value("heightLevelNull",0).toInt());
|
||||||
|
profile.endGroup();
|
||||||
|
|
||||||
//tab4 Colors
|
profile.beginGroup("colors"); //tab4 Colors
|
||||||
ui->path_ColorsTxt->setText(settings.value("path_ColorsTxt","./colors/colors.txt").toString());
|
ui->path_ColorsTxt->setText(profile.value("path_ColorsTxt","./colors/colors.txt").toString());
|
||||||
ui->bgcolor->setText(settings.value("bgcolor","white").toString());
|
ui->bgcolor->setText(profile.value("bgcolor","white").toString());
|
||||||
ui->blockcolor->setText(settings.value("blockcolor","white").toString());
|
ui->blockcolor->setText(profile.value("blockcolor","white").toString());
|
||||||
ui->scalecolor->setText(settings.value("scalecolor","black").toString());
|
ui->scalecolor->setText(profile.value("scalecolor","black").toString());
|
||||||
ui->origincolor->setText(settings.value("origincolor","red").toString());
|
ui->origincolor->setText(profile.value("origincolor","red").toString());
|
||||||
ui->playercolor->setText(settings.value("playercolor","yellow").toString());
|
ui->playercolor->setText(profile.value("playercolor","yellow").toString());
|
||||||
ui->tilebordercolor->setText(settings.value("tilebordercolor","black").toString());
|
ui->tilebordercolor->setText(profile.value("tilebordercolor","black").toString());
|
||||||
|
profile.endGroup();
|
||||||
|
|
||||||
//tab5 Featurs
|
profile.beginGroup("features"); //tab5 Featurs
|
||||||
ui->drawScaleLeft->setChecked(settings.value("drawScaleLeft",false).toBool());
|
ui->drawScaleLeft->setChecked(profile.value("drawScaleLeft",false).toBool());
|
||||||
ui->drawScaleTop->setChecked(settings.value("drawScaleTop",false).toBool());
|
ui->drawScaleTop->setChecked(profile.value("drawScaleTop",false).toBool());
|
||||||
ui->drawOrigin->setChecked(settings.value("drawOrigin",false).toBool());
|
ui->drawOrigin->setChecked(profile.value("drawOrigin",false).toBool());
|
||||||
ui->drawPlayers->setChecked(settings.value("drawPlayers",false).toBool());
|
ui->drawPlayers->setChecked(profile.value("drawPlayers",false).toBool());
|
||||||
ui->drawAlpha->setCurrentIndex(settings.value("drawAlpha",0).toInt());
|
ui->drawAlpha->setCurrentIndex(profile.value("drawAlpha",0).toInt());
|
||||||
ui->drawAir->setChecked(settings.value("drawAir",false).toBool());
|
ui->drawAir->setChecked(profile.value("drawAir",false).toBool());
|
||||||
ui->noShading->setChecked(settings.value("noShading",false).toBool());
|
ui->noShading->setChecked(profile.value("noShading",false).toBool());
|
||||||
|
profile.endGroup();
|
||||||
|
|
||||||
//tab6 Tiles
|
profile.beginGroup("tiles"); //tab6 Tiles
|
||||||
ui->tiles->setChecked(settings.value("drawTiles",false).toBool());
|
ui->tiles->setChecked(profile.value("drawTiles",false).toBool());
|
||||||
ui->tilesize->setValue(settings.value("tilesize",20).toInt());
|
ui->tilesize->setValue(profile.value("tilesize",20).toInt());
|
||||||
ui->tileborder->setValue(settings.value("tileborder",1).toInt());
|
ui->tileborder->setValue(profile.value("tileborder",1).toInt());
|
||||||
ui->tiles_coordinateX->setValue(settings.value("tiles_coordinateX",0).toInt());
|
ui->tiles_coordinateX->setValue(profile.value("tiles_coordinateX",0).toInt());
|
||||||
ui->tiles_coordinateY->setValue(settings.value("tiles_coordinateY",0).toInt());
|
ui->tiles_coordinateY->setValue(profile.value("tiles_coordinateY",0).toInt());
|
||||||
settings.endGroup();
|
profile.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::closeEvent(QCloseEvent *event)
|
void MainWindow::closeEvent(QCloseEvent *event)
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QActionGroup>
|
#include <QActionGroup>
|
||||||
|
#include <QSettings>
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#include <QWinTaskbarProgress>
|
#include <QWinTaskbarProgress>
|
||||||
#include <QWinTaskbarButton>
|
#include <QWinTaskbarButton>
|
||||||
|
@ -55,9 +56,9 @@ private slots:
|
||||||
void wrapupMapper();
|
void wrapupMapper();
|
||||||
void createProfilesMenu();
|
void createProfilesMenu();
|
||||||
void writeSettings();
|
void writeSettings();
|
||||||
void writeProfile(QString profile);
|
void writeProfile(QString strProfile);
|
||||||
void readSettings();
|
void readSettings();
|
||||||
void readProfile(QString profile);
|
void readProfile(QString strProfile);
|
||||||
bool migrateSettingsProfiles();
|
bool migrateSettingsProfiles();
|
||||||
|
|
||||||
void on_browseWorld_clicked();
|
void on_browseWorld_clicked();
|
||||||
|
@ -104,7 +105,6 @@ private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
QProgressBar *progressBar;
|
QProgressBar *progressBar;
|
||||||
QProcess *myProcess;
|
QProcess *myProcess;
|
||||||
QString currentProfile;
|
|
||||||
QActionGroup *profileGroup;
|
QActionGroup *profileGroup;
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
QWinTaskbarButton *taskbarButton;
|
QWinTaskbarButton *taskbarButton;
|
||||||
|
@ -125,6 +125,8 @@ private:
|
||||||
QTranslator m_translatorQt; // contains the translations for qt
|
QTranslator m_translatorQt; // contains the translations for qt
|
||||||
QString m_currLang; // contains the currently loaded language
|
QString m_currLang; // contains the currently loaded language
|
||||||
QString m_langPath; // Path of language files. This is always fixed to /languages.
|
QString m_langPath; // Path of language files. This is always fixed to /languages.
|
||||||
|
QString currentProfile; //contains the name of current loaded profile
|
||||||
|
QSettings settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|
Loading…
Reference in New Issue