From ca84c3d1dcd5111e1c4b0afc75da0f652e338887 Mon Sep 17 00:00:00 2001 From: itayc0hen Date: Sun, 14 Jun 2020 11:58:14 +0300 Subject: [PATCH] Bye bye RenameDialog --- src/Cutter.pro | 3 -- src/dialogs/RenameDialog.cpp | 50 ------------------- src/dialogs/RenameDialog.h | 46 ----------------- src/dialogs/RenameDialog.ui | 97 ------------------------------------ 4 files changed, 196 deletions(-) delete mode 100644 src/dialogs/RenameDialog.cpp delete mode 100644 src/dialogs/RenameDialog.h delete mode 100644 src/dialogs/RenameDialog.ui diff --git a/src/Cutter.pro b/src/Cutter.pro index 86b65626..f2ec81bf 100644 --- a/src/Cutter.pro +++ b/src/Cutter.pro @@ -302,7 +302,6 @@ SOURCES += \ dialogs/CommentsDialog.cpp \ dialogs/EditInstructionDialog.cpp \ dialogs/FlagDialog.cpp \ - dialogs/RenameDialog.cpp \ dialogs/RemoteDebugDialog.cpp \ dialogs/NativeDebugDialog.cpp \ dialogs/XrefsDialog.cpp \ @@ -448,7 +447,6 @@ HEADERS += \ dialogs/CommentsDialog.h \ dialogs/EditInstructionDialog.h \ dialogs/FlagDialog.h \ - dialogs/RenameDialog.h \ dialogs/RemoteDebugDialog.h \ dialogs/NativeDebugDialog.h \ dialogs/XrefsDialog.h \ @@ -597,7 +595,6 @@ FORMS += \ dialogs/CommentsDialog.ui \ dialogs/EditInstructionDialog.ui \ dialogs/FlagDialog.ui \ - dialogs/RenameDialog.ui \ dialogs/RemoteDebugDialog.ui \ dialogs/NativeDebugDialog.ui \ dialogs/XrefsDialog.ui \ diff --git a/src/dialogs/RenameDialog.cpp b/src/dialogs/RenameDialog.cpp deleted file mode 100644 index f43d5416..00000000 --- a/src/dialogs/RenameDialog.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "RenameDialog.h" -#include "ui_RenameDialog.h" - -RenameDialog::RenameDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::RenameDialog) -{ - ui->setupUi(this); - setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint)); -} - -RenameDialog::~RenameDialog() {} - -void RenameDialog::on_buttonBox_accepted() -{ - // Rename function and refresh widgets - QString name = ui->nameEdit->text(); -} - -void RenameDialog::on_buttonBox_rejected() -{ - close(); -} - -void RenameDialog::setName(QString fcnName) -{ - ui->nameEdit->setText(fcnName); - ui->nameEdit->selectAll(); -} - -QString RenameDialog::getName() const -{ - return ui->nameEdit->text(); -} - -void RenameDialog::setPlaceholderText(const QString &text) -{ - ui->nameEdit->setPlaceholderText(text); -} - -bool RenameDialog::showDialog(const QString &title, QString *name, const QString &placeholder, QWidget *parent) -{ - RenameDialog dialog(parent); - dialog.setWindowTitle(title); - dialog.setPlaceholderText(placeholder); - dialog.setName(*name); - int result = dialog.exec(); - *name = dialog.getName(); - return result == QDialog::DialogCode::Accepted; -} diff --git a/src/dialogs/RenameDialog.h b/src/dialogs/RenameDialog.h deleted file mode 100644 index 855075de..00000000 --- a/src/dialogs/RenameDialog.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef RENAMEDIALOG_H -#define RENAMEDIALOG_H - -#include -#include - -namespace Ui { -class RenameDialog; -} - -/** - * @brief General Dialog for entering a name - */ -class RenameDialog : public QDialog -{ - Q_OBJECT - -public: - explicit RenameDialog(QWidget *parent = nullptr); - ~RenameDialog(); - - void setName(QString fcnName); - QString getName() const; - - void setPlaceholderText(const QString &text); - - /** - * @brief Helper function to display and execute the dialog - * - * @param title title of the dialog - * @param name initial name, will be overwritten if the user entered something else - * @param placeholder placeholder text for the QLineEdit - * @return whether the dialog was accepted by the user - */ - static bool showDialog(const QString &title, QString *name, const QString &placeholder, QWidget *parent = nullptr); - -private slots: - void on_buttonBox_accepted(); - - void on_buttonBox_rejected(); - -private: - std::unique_ptr ui; -}; - -#endif // RENAMEDIALOG_H diff --git a/src/dialogs/RenameDialog.ui b/src/dialogs/RenameDialog.ui deleted file mode 100644 index 3aa24827..00000000 --- a/src/dialogs/RenameDialog.ui +++ /dev/null @@ -1,97 +0,0 @@ - - - RenameDialog - - - Qt::NonModal - - - - 0 - 0 - 400 - 75 - - - - Rename function - - - - - - 5 - - - - - Name: - - - - - - - - - - - - - false - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - RenameDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - RenameDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - -