Skip to content
Snippets Groups Projects
Commit 53fde645 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Fixes: Add "Describe" to svn plugin.

Details: Also remove unused change number dialog.
parent 1bb65685
No related branches found
No related tags found
No related merge requests found
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#include <QtGui/QIntValidator>
#include "changenumberdialog.h"
using namespace Subversion::Internal;
ChangeNumberDialog::ChangeNumberDialog(QWidget *parent)
: QDialog(parent)
{
m_ui.setupUi(this);
m_ui.numberLineEdit->setValidator(new QIntValidator(0, 1000000, this));
}
int ChangeNumberDialog::number() const
{
if (m_ui.numberLineEdit->text().isEmpty())
return -1;
bool ok;
return m_ui.numberLineEdit->text().toInt(&ok);
}
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef CHANGENUMBERDIALOG_H
#define CHANGENUMBERDIALOG_H
#include "ui_changenumberdialog.h"
#include <QtGui/QDialog>
namespace Subversion {
namespace Internal {
class ChangeNumberDialog : public QDialog
{
Q_OBJECT
public:
ChangeNumberDialog(QWidget *parent = 0);
int number() const;
private:
Ui::ChangeNumberDialog m_ui;
};
} // namespace Subversion
} // namespace Internal
#endif // CHANGENUMBERDIALOG_H
<ui version="4.0" >
<class>Subversion::Internal::ChangeNumberDialog</class>
<widget class="QDialog" name="Subversion::Internal::ChangeNumberDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>319</width>
<height>76</height>
</rect>
</property>
<property name="windowTitle" >
<string>Change Number</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="1" >
<widget class="QLineEdit" name="numberLineEdit" />
</item>
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Change Number:</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2" >
<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>Subversion::Internal::ChangeNumberDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>59</x>
<y>24</y>
</hint>
<hint type="destinationlabel" >
<x>160</x>
<y>38</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Subversion::Internal::ChangeNumberDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>59</x>
<y>24</y>
</hint>
<hint type="destinationlabel" >
<x>160</x>
<y>38</y>
</hint>
</hints>
</connection>
</connections>
</ui>
......@@ -14,7 +14,6 @@ HEADERS += annotationhighlighter.h \
subversionoutputwindow.h \
settingspage.h \
subversioneditor.h \
changenumberdialog.h \
subversionsubmiteditor.h \
subversionsettings.h
......@@ -24,11 +23,9 @@ SOURCES += annotationhighlighter.cpp \
subversionoutputwindow.cpp \
settingspage.cpp \
subversioneditor.cpp \
changenumberdialog.cpp \
subversionsubmiteditor.cpp \
subversionsettings.cpp
FORMS += settingspage.ui \
changenumberdialog.ui
FORMS += settingspage.ui
RESOURCES += subversion.qrc
......@@ -38,7 +38,6 @@
#include "subversionoutputwindow.h"
#include "subversionsubmiteditor.h"
#include "changenumberdialog.h"
#include "subversionconstants.h"
#include "subversioncontrol.h"
......@@ -70,6 +69,9 @@
#include <QtGui/QMainWindow>
#include <QtGui/QMenu>
#include <QtGui/QMessageBox>
#include <QtGui/QInputDialog>
#include <limits.h>
using namespace Subversion::Internal;
......@@ -96,6 +98,7 @@ const char * const SubversionPlugin::ANNOTATE_CURRENT = "Subversion.AnnotateCu
const char * const SubversionPlugin::SEPARATOR3 = "Subversion.Separator3";
const char * const SubversionPlugin::STATUS = "Subversion.Status";
const char * const SubversionPlugin::UPDATE = "Subversion.Update";
const char * const SubversionPlugin::DESCRIBE = "Subversion.Describe";
static const VCSBase::VCSBaseEditorParameters editorParameters[] = {
{
......@@ -186,6 +189,7 @@ SubversionPlugin::SubversionPlugin() :
m_annotateCurrentAction(0),
m_statusAction(0),
m_updateProjectAction(0),
m_describeAction(0),
m_submitCurrentLogAction(0),
m_submitDiffAction(0),
m_submitUndoAction(0),
......@@ -248,6 +252,16 @@ static const VCSBase::VCSBaseSubmitEditorParameters submitParameters = {
Subversion::Constants::SUBVERSIONCOMMITEDITOR
};
static inline Core::Command *createSeparator(QObject *parent,
Core::ActionManager *ami,
const char*id,
const QList<int> &globalcontext)
{
QAction *tmpaction = new QAction(parent);
tmpaction->setSeparator(true);
return ami->registerAction(tmpaction, id, globalcontext);
}
bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
Q_UNUSED(arguments);
......@@ -330,10 +344,7 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe
connect(m_revertAction, SIGNAL(triggered()), this, SLOT(revertCurrentFile()));
subversionMenu->addAction(command);
QAction *tmpaction = new QAction(this);
tmpaction->setSeparator(true);
subversionMenu->addAction(ami->registerAction(tmpaction,
SubversionPlugin::SEPARATOR0, globalcontext));
subversionMenu->addAction(createSeparator(this, ami, SubversionPlugin::SEPARATOR0, globalcontext));
m_diffProjectAction = new QAction(tr("Diff Project"), this);
command = ami->registerAction(m_diffProjectAction, SubversionPlugin::DIFF_PROJECT,
......@@ -349,10 +360,7 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe
connect(m_diffCurrentAction, SIGNAL(triggered()), this, SLOT(diffCurrentFile()));
subversionMenu->addAction(command);
tmpaction = new QAction(this);
tmpaction->setSeparator(true);
subversionMenu->addAction(ami->registerAction(tmpaction,
SubversionPlugin::SEPARATOR1, globalcontext));
subversionMenu->addAction(createSeparator(this, ami, SubversionPlugin::SEPARATOR1, globalcontext));
m_commitAllAction = new QAction(tr("Commit All Files"), this);
command = ami->registerAction(m_commitAllAction, SubversionPlugin::COMMIT_ALL,
......@@ -368,10 +376,7 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe
connect(m_commitCurrentAction, SIGNAL(triggered()), this, SLOT(startCommitCurrentFile()));
subversionMenu->addAction(command);
tmpaction = new QAction(this);
tmpaction->setSeparator(true);
subversionMenu->addAction(ami->registerAction(tmpaction,
SubversionPlugin::SEPARATOR2, globalcontext));
subversionMenu->addAction(createSeparator(this, ami, SubversionPlugin::SEPARATOR2, globalcontext));
m_filelogCurrentAction = new QAction(tr("Filelog Current File"), this);
command = ami->registerAction(m_filelogCurrentAction,
......@@ -389,10 +394,12 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe
SLOT(annotateCurrentFile()));
subversionMenu->addAction(command);
tmpaction = new QAction(this);
tmpaction->setSeparator(true);
subversionMenu->addAction(ami->registerAction(tmpaction,
SubversionPlugin::SEPARATOR3, globalcontext));
m_describeAction = new QAction(tr("Describe..."), this);
command = ami->registerAction(m_describeAction, SubversionPlugin::DESCRIBE, globalcontext);
connect(m_describeAction, SIGNAL(triggered()), this, SLOT(slotDescribe()));
subversionMenu->addAction(command);
subversionMenu->addAction(createSeparator(this, ami, SubversionPlugin::SEPARATOR3, globalcontext));
m_statusAction = new QAction(tr("Project Status"), this);
command = ami->registerAction(m_statusAction, SubversionPlugin::STATUS,
......@@ -536,7 +543,7 @@ SubversionSubmitEditor *SubversionPlugin::openSubversionSubmitEditor(const QStri
void SubversionPlugin::updateActions()
{
QString fileName = currentFileName();
const QString fileName = currentFileName();
const bool hasFile = !fileName.isEmpty();
m_addAction->setEnabled(hasFile);
......@@ -549,6 +556,7 @@ void SubversionPlugin::updateActions()
m_filelogCurrentAction->setEnabled(hasFile);
m_annotateCurrentAction->setEnabled(hasFile);
m_statusAction->setEnabled(true);
m_describeAction->setEnabled(true);
QString baseName;
if (hasFile)
......@@ -881,6 +889,25 @@ void SubversionPlugin::describe(const QString &source, const QString &changeNr)
}
}
void SubversionPlugin::slotDescribe()
{
const QStringList topLevels = currentProjectsTopLevels();
if (topLevels.size() != 1)
return;
QInputDialog inputDialog(Core::ICore::instance()->mainWindow());
inputDialog.setWindowFlags(inputDialog.windowFlags() & ~Qt::WindowContextHelpButtonHint);
inputDialog.setInputMode(QInputDialog::IntInput);
inputDialog.setIntRange(2, INT_MAX);
inputDialog.setWindowTitle(tr("Describe"));
inputDialog.setLabelText(tr("Revision number:"));
if (inputDialog.exec() != QDialog::Accepted)
return;
const int revision = inputDialog.intValue();
describe(topLevels.front(), QString::number(revision));
}
void SubversionPlugin::submitCurrentLog()
{
Core::EditorManager::instance()->closeEditors(QList<Core::IEditor*>()
......
......@@ -119,6 +119,7 @@ private slots:
void annotateCurrentFile();
void projectStatus();
void describe(const QString &source, const QString &changeNr);
void slotDescribe();
void updateProject();
void submitCurrentLog();
void diffFiles(const QStringList &);
......@@ -165,6 +166,7 @@ private:
QAction *m_annotateCurrentAction;
QAction *m_statusAction;
QAction *m_updateProjectAction;
QAction *m_describeAction;
QAction *m_submitCurrentLogAction;
QAction *m_submitDiffAction;
......@@ -187,6 +189,7 @@ private:
static const char * const SEPARATOR3;
static const char * const STATUS;
static const char * const UPDATE;
static const char * const DESCRIBE;
static SubversionPlugin *m_subversionPluginInstance;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment