diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-01-16 04:33:14 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-01-16 06:45:52 +0100 |
commit | 2b1c5593b0bc1ebfcd2e808f128e4b0312f59d93 (patch) | |
tree | e7e8f5d8d3af88a6df37cbd482edcbd3ff8def26 /gui/new_file_dialog.h | |
parent | 3583e3d3cd0b6ca2515ada16ca7dcc8cce83031f (diff) |
gui, variant/default: move default UI
Diffstat (limited to 'gui/new_file_dialog.h')
-rw-r--r-- | gui/new_file_dialog.h | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/gui/new_file_dialog.h b/gui/new_file_dialog.h deleted file mode 100644 index cd5ca528..00000000 --- a/gui/new_file_dialog.h +++ /dev/null @@ -1,51 +0,0 @@ -#pragma once - -#include "ui_new_config.h" -#include "options/options.hpp" -#include <QFile> -#include <QRegExp> -#include <QString> -#include <QMessageBox> - -class new_file_dialog : public QDialog -{ - Q_OBJECT -public: - new_file_dialog(QWidget* parent = 0) : QDialog(parent), ok(false) - { - ui.setupUi(this); - connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(ok_clicked())); - connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(cancel_clicked())); - setFixedSize(size()); - } - bool is_ok(QString& name_) - { - name_ = name; - return ok; - } -private: - Ui::UI_new_config ui; - bool ok; - QString name; -private slots: - void cancel_clicked() { close(); } - void ok_clicked() - { - QString text = ui.lineEdit->text(); - text = text.replace('/', ""); - text = text.replace('\\', ""); - if (text != "" && !text.endsWith(".ini")) - text += ".ini"; - if (text == "" || text == ".ini" || QFile(options::group::ini_directory() + "/" + text).exists()) - { - QMessageBox::warning(this, - tr("File exists"), - tr("This file already exists. Pick another name."), - QMessageBox::Ok, QMessageBox::NoButton); - return; - } - ok = true; - close(); - name = text; - } -}; |