Bye bye RenameDialog

This commit is contained in:
itayc0hen 2020-06-14 11:58:14 +03:00 committed by Itay Cohen
parent 02ce60d1af
commit ca84c3d1dc
4 changed files with 0 additions and 196 deletions

View File

@ -302,7 +302,6 @@ SOURCES += \
dialogs/CommentsDialog.cpp \ dialogs/CommentsDialog.cpp \
dialogs/EditInstructionDialog.cpp \ dialogs/EditInstructionDialog.cpp \
dialogs/FlagDialog.cpp \ dialogs/FlagDialog.cpp \
dialogs/RenameDialog.cpp \
dialogs/RemoteDebugDialog.cpp \ dialogs/RemoteDebugDialog.cpp \
dialogs/NativeDebugDialog.cpp \ dialogs/NativeDebugDialog.cpp \
dialogs/XrefsDialog.cpp \ dialogs/XrefsDialog.cpp \
@ -448,7 +447,6 @@ HEADERS += \
dialogs/CommentsDialog.h \ dialogs/CommentsDialog.h \
dialogs/EditInstructionDialog.h \ dialogs/EditInstructionDialog.h \
dialogs/FlagDialog.h \ dialogs/FlagDialog.h \
dialogs/RenameDialog.h \
dialogs/RemoteDebugDialog.h \ dialogs/RemoteDebugDialog.h \
dialogs/NativeDebugDialog.h \ dialogs/NativeDebugDialog.h \
dialogs/XrefsDialog.h \ dialogs/XrefsDialog.h \
@ -597,7 +595,6 @@ FORMS += \
dialogs/CommentsDialog.ui \ dialogs/CommentsDialog.ui \
dialogs/EditInstructionDialog.ui \ dialogs/EditInstructionDialog.ui \
dialogs/FlagDialog.ui \ dialogs/FlagDialog.ui \
dialogs/RenameDialog.ui \
dialogs/RemoteDebugDialog.ui \ dialogs/RemoteDebugDialog.ui \
dialogs/NativeDebugDialog.ui \ dialogs/NativeDebugDialog.ui \
dialogs/XrefsDialog.ui \ dialogs/XrefsDialog.ui \

View File

@ -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;
}

View File

@ -1,46 +0,0 @@
#ifndef RENAMEDIALOG_H
#define RENAMEDIALOG_H
#include <QDialog>
#include <memory>
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::RenameDialog> ui;
};
#endif // RENAMEDIALOG_H

View File

@ -1,97 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>RenameDialog</class>
<widget class="QDialog" name="RenameDialog">
<property name="windowModality">
<enum>Qt::NonModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>75</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true">Rename function</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>5</number>
</property>
<item>
<widget class="QLabel" name="nameLabel">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="nameEdit">
<property name="inputMask">
<string notr="true"/>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="frame">
<bool>false</bool>
</property>
<property name="placeholderText">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>RenameDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>RenameDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>