-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetupdialog.cpp
More file actions
executable file
·49 lines (39 loc) · 1 KB
/
setupdialog.cpp
File metadata and controls
executable file
·49 lines (39 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <QFileDialog>
#include "setupdialog.h"
#include "ui_setupdialog.h"
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
#define STANDART_PATHS_IS_PRESENT
#include <QStandardPaths>
#endif
SetupDialog::SetupDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::SetupDialog)
{
ui->setupUi(this);
QString appDataFolder( "." );
#ifdef STANDART_PATHS_IS_PRESENT
appDataFolder = QStandardPaths::writableLocation( QStandardPaths::AppDataLocation );
#undef STANDART_PATHS_IS_PRESENT
#endif
ui->pathEdit->setText( appDataFolder + "/database.sqlite" );
}
SetupDialog::~SetupDialog()
{
delete ui;
}
void SetupDialog::on_browseButton_clicked()
{
const QString result = QFileDialog::getSaveFileName( this
, "Choose DB file location"
, ui->pathEdit->text()
, "SQLite DB(*.sqlite)" );
ui->pathEdit->setText( result );
}
QString SetupDialog::selectedFile() const
{
return ui->pathEdit->text();
}
void SetupDialog::setReasonText(const QString &reason)
{
ui->reasonLabel->setText( reason );
}