Commit 15374275 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

Git: Rename ResetDialog -> LogChangeDialog



Required for interactive rebase

Change-Id: I024505bbde1c58a7ccb4ce931322e0f5b467552b
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 2f302d64
......@@ -27,7 +27,7 @@ HEADERS += gitplugin.h \
remotemodel.h \
remotedialog.h \
branchadddialog.h \
resetdialog.h \
logchangedialog.h \
mergetool.h \
branchcheckoutdialog.h
......@@ -51,7 +51,7 @@ SOURCES += gitplugin.cpp \
remotemodel.cpp \
remotedialog.cpp \
branchadddialog.cpp \
resetdialog.cpp \
logchangedialog.cpp \
mergetool.cpp \
branchcheckoutdialog.cpp
......
......@@ -54,6 +54,8 @@ QtcPlugin {
"gitutils.h",
"gitversioncontrol.cpp",
"gitversioncontrol.h",
"logchangedialog.cpp",
"logchangedialog.h",
"mergetool.cpp",
"mergetool.h",
"remoteadditiondialog.ui",
......@@ -62,8 +64,6 @@ QtcPlugin {
"remotedialog.ui",
"remotemodel.cpp",
"remotemodel.h",
"resetdialog.cpp",
"resetdialog.h",
"settingspage.cpp",
"settingspage.h",
"settingspage.ui",
......
......@@ -42,7 +42,7 @@
#include "gitorious/gitoriousclonewizard.h"
#include "stashdialog.h"
#include "settingspage.h"
#include "resetdialog.h"
#include "logchangedialog.h"
#include "mergetool.h"
#include "gitutils.h"
......@@ -706,7 +706,7 @@ void GitPlugin::resetRepository()
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
ResetDialog dialog;
LogChangeDialog dialog(true);
if (dialog.runDialog(state.topLevel()))
switch (dialog.resetType()) {
case HardReset:
......
......@@ -27,7 +27,7 @@
**
****************************************************************************/
#include "resetdialog.h"
#include "logchangedialog.h"
#include "gitplugin.h"
#include "gitclient.h"
......@@ -51,12 +51,12 @@ enum Columns
ColumnCount
};
ResetDialog::ResetDialog(QWidget *parent)
LogChangeDialog::LogChangeDialog(bool isReset, QWidget *parent)
: QDialog(parent)
, m_treeView(new QTreeView(this))
, m_model(new QStandardItemModel(0, ColumnCount, this))
, m_dialogButtonBox(new QDialogButtonBox(this))
, m_resetTypeComboBox(new QComboBox(this))
, m_resetTypeComboBox(0)
{
QStringList headers;
headers << tr("Sha1")<< tr("Subject");
......@@ -69,12 +69,15 @@ ResetDialog::ResetDialog(QWidget *parent)
m_treeView->setRootIsDecorated(false);
m_treeView->setSelectionBehavior(QAbstractItemView::SelectRows);
layout->addWidget(m_treeView);
QHBoxLayout *popUpLayout = new QHBoxLayout();
popUpLayout->addWidget(new QLabel(tr("Reset type:"), this));
m_resetTypeComboBox->addItem(tr("Hard Reset"), HardReset);
m_resetTypeComboBox->addItem(tr("Soft Reset"), SoftReset);
popUpLayout->addWidget(m_resetTypeComboBox);
popUpLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored));
QHBoxLayout *popUpLayout = new QHBoxLayout;
if (isReset) {
popUpLayout->addWidget(new QLabel(tr("Reset type:"), this));
m_resetTypeComboBox = new QComboBox(this);
m_resetTypeComboBox->addItem(tr("Hard Reset"), HardReset);
m_resetTypeComboBox->addItem(tr("Soft Reset"), SoftReset);
popUpLayout->addWidget(m_resetTypeComboBox);
popUpLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored));
}
popUpLayout->addWidget(m_dialogButtonBox);
m_dialogButtonBox->addButton(QDialogButtonBox::Cancel);
......@@ -91,7 +94,7 @@ ResetDialog::ResetDialog(QWidget *parent)
resize(600, 400);
}
bool ResetDialog::runDialog(const QString &repository)
bool LogChangeDialog::runDialog(const QString &repository)
{
setWindowTitle(tr("Undo Changes to %1").arg(QDir::toNativeSeparators(repository)));
......@@ -104,7 +107,7 @@ bool ResetDialog::runDialog(const QString &repository)
return exec() == QDialog::Accepted;
}
QString ResetDialog::commit() const
QString LogChangeDialog::commit() const
{
// Return Sha1, or empty for top commit.
if (const QStandardItem *sha1Item = currentItem(Sha1Column))
......@@ -112,12 +115,14 @@ QString ResetDialog::commit() const
return QString();
}
ResetType ResetDialog::resetType() const
ResetType LogChangeDialog::resetType() const
{
if (!m_resetTypeComboBox)
return HardReset;
return static_cast<ResetType>(m_resetTypeComboBox->itemData(m_resetTypeComboBox->currentIndex()).toInt());
}
bool ResetDialog::populateLog(const QString &repository)
bool LogChangeDialog::populateLog(const QString &repository)
{
if (const int rowCount = m_model->rowCount())
m_model->removeRows(0, rowCount);
......@@ -151,7 +156,7 @@ bool ResetDialog::populateLog(const QString &repository)
return true;
}
const QStandardItem *ResetDialog::currentItem(int column) const
const QStandardItem *LogChangeDialog::currentItem(int column) const
{
const QModelIndex currentIndex = m_treeView->selectionModel()->currentIndex();
if (currentIndex.isValid())
......
......@@ -51,11 +51,11 @@ enum ResetType {
SoftReset
};
class ResetDialog : public QDialog
class LogChangeDialog : public QDialog
{
Q_OBJECT
public:
explicit ResetDialog(QWidget *parent = 0);
explicit LogChangeDialog(bool isReset, QWidget *parent = 0);
bool runDialog(const QString &repository);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment