forked from qt-creator/qt-creator
Git: Do not reuse RemoteAdditionDialog
There's no reason. Move it to the cpp file while at it. Change-Id: I365443fa58db278777ec2f06ea172e9f91992287 Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
committed by
Orgad Shaneh
parent
861d30cf68
commit
8d5e8f6874
@@ -43,34 +43,29 @@ namespace Internal {
|
|||||||
// RemoteAdditionDialog:
|
// RemoteAdditionDialog:
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
RemoteAdditionDialog::RemoteAdditionDialog(QWidget *parent) :
|
class RemoteAdditionDialog : public QDialog
|
||||||
QDialog(parent),
|
|
||||||
m_ui(new Ui::RemoteAdditionDialog)
|
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
public:
|
||||||
|
RemoteAdditionDialog()
|
||||||
|
{
|
||||||
|
m_ui.setupUi(this);
|
||||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteAdditionDialog::~RemoteAdditionDialog()
|
QString remoteName() const
|
||||||
{
|
{
|
||||||
delete m_ui;
|
return m_ui.nameEdit->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString RemoteAdditionDialog::remoteName() const
|
QString remoteUrl() const
|
||||||
{
|
{
|
||||||
return m_ui->nameEdit->text();
|
return m_ui.urlEdit->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString RemoteAdditionDialog::remoteUrl() const
|
private:
|
||||||
{
|
Ui::RemoteAdditionDialog m_ui;
|
||||||
return m_ui->urlEdit->text();
|
};
|
||||||
}
|
|
||||||
|
|
||||||
void RemoteAdditionDialog::clear()
|
|
||||||
{
|
|
||||||
m_ui->nameEdit->clear();
|
|
||||||
m_ui->urlEdit->clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// RemoteDialog:
|
// RemoteDialog:
|
||||||
@@ -130,14 +125,11 @@ void RemoteDialog::refreshRemotes()
|
|||||||
|
|
||||||
void RemoteDialog::addRemote()
|
void RemoteDialog::addRemote()
|
||||||
{
|
{
|
||||||
if (!m_addDialog)
|
RemoteAdditionDialog addDialog;
|
||||||
m_addDialog = new RemoteAdditionDialog;
|
if (addDialog.exec() != QDialog::Accepted)
|
||||||
m_addDialog->clear();
|
|
||||||
|
|
||||||
if (m_addDialog->exec() != QDialog::Accepted)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_remoteModel->addRemote(m_addDialog->remoteName(), m_addDialog->remoteUrl());
|
m_remoteModel->addRemote(addDialog.remoteName(), addDialog.remoteUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteDialog::removeRemote()
|
void RemoteDialog::removeRemote()
|
||||||
|
|||||||
@@ -30,39 +30,10 @@
|
|||||||
namespace Git {
|
namespace Git {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui { class RemoteDialog; }
|
||||||
class RemoteDialog;
|
|
||||||
class RemoteAdditionDialog;
|
|
||||||
} // namespace Ui
|
|
||||||
|
|
||||||
class GitClient;
|
|
||||||
class RemoteModel;
|
class RemoteModel;
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
// RemoteAdditionDialog:
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class RemoteAdditionDialog : public QDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit RemoteAdditionDialog(QWidget *parent = 0);
|
|
||||||
~RemoteAdditionDialog() override;
|
|
||||||
|
|
||||||
QString remoteName() const;
|
|
||||||
QString remoteUrl() const;
|
|
||||||
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::RemoteAdditionDialog *m_ui;
|
|
||||||
};
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
// RemoteDialog:
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class RemoteDialog : public QDialog
|
class RemoteDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -85,7 +56,6 @@ private:
|
|||||||
Ui::RemoteDialog *m_ui;
|
Ui::RemoteDialog *m_ui;
|
||||||
|
|
||||||
RemoteModel *m_remoteModel;
|
RemoteModel *m_remoteModel;
|
||||||
RemoteAdditionDialog *m_addDialog = nullptr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user