-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #138 from fxdeniz/issue_137
Issue 137
- Loading branch information
Showing
23 changed files
with
655 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#include "DialogSettings.h" | ||
#include "ui_DialogSettings.h" | ||
|
||
#include "Utility/AppConfig.h" | ||
|
||
#include <QFileDialog> | ||
#include <QStandardPaths> | ||
|
||
DialogSettings::DialogSettings(QWidget *parent) : | ||
QDialog(parent), | ||
ui(new Ui::DialogSettings) | ||
{ | ||
ui->setupUi(this); | ||
} | ||
|
||
DialogSettings::~DialogSettings() | ||
{ | ||
delete ui; | ||
} | ||
|
||
void DialogSettings::show() | ||
{ | ||
AppConfig config; | ||
ui->lineEdit->setText(config.getStorageFolderPath()); | ||
showStatusInfo(tr("No changes made made to settings yet."), ui->labelStatus); | ||
ui->buttonSave->setDisabled(true); | ||
|
||
QWidget::show(); | ||
} | ||
|
||
void DialogSettings::on_buttonSelectStorageFolder_clicked() | ||
{ | ||
QString desktopPath = QStandardPaths::writableLocation(QStandardPaths::StandardLocation::DesktopLocation); | ||
desktopPath = QDir::toNativeSeparators(desktopPath); | ||
desktopPath += QDir::separator(); | ||
|
||
QString folderPath = QFileDialog::getExistingDirectory(this, tr("Select a profile folder"), desktopPath); | ||
|
||
if(folderPath.isEmpty()) | ||
return; | ||
|
||
folderPath = QDir::toNativeSeparators(folderPath) + QDir::separator(); | ||
ui->lineEdit->setText(folderPath); | ||
|
||
bool isExist = QFile::exists(folderPath + "ns_database.db3"); | ||
|
||
if(isExist) | ||
{ | ||
QString message = tr("Existing profile found at selected location.<br>" | ||
"After saving, selected profile will be loaded. <b>NOTE:</b> Saving requires restard."); | ||
|
||
showStatusSuccess(message, ui->labelStatus); | ||
} | ||
else | ||
{ | ||
QString message = tr("No profile found at selected location. New profile will be created.<br>" | ||
"After saving, new and empty profile will be loaded. <b>NOTE:</b> Saving requires restard."); | ||
|
||
showStatusWarning(message, ui->labelStatus); | ||
} | ||
|
||
ui->buttonSave->setEnabled(true); | ||
} | ||
|
||
|
||
void DialogSettings::on_buttonSave_clicked() | ||
{ | ||
AppConfig config; | ||
config.setStorageFolderPath(ui->lineEdit->text()); | ||
qApp->exit(0); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef DIALOGSETTINGS_H | ||
#define DIALOGSETTINGS_H | ||
|
||
#include "BaseDialog.h" | ||
|
||
#include <QDialog> | ||
|
||
namespace Ui { | ||
class DialogSettings; | ||
} | ||
|
||
class DialogSettings : public QDialog, public BaseDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit DialogSettings(QWidget *parent = nullptr); | ||
~DialogSettings(); | ||
|
||
void show(); | ||
|
||
private slots: | ||
void on_buttonSelectStorageFolder_clicked(); | ||
|
||
void on_buttonSave_clicked(); | ||
|
||
private: | ||
Ui::DialogSettings *ui; | ||
}; | ||
|
||
#endif // DIALOGSETTINGS_H |
Oops, something went wrong.