Commit ae7c99eb authored by con's avatar con
Browse files

Merge branch '1.0.0'

Conflicts:
	src/plugins/subversion/subversionplugin.cpp
parents a54fa5a5 19670c5b
......@@ -76,6 +76,7 @@
#include <QtCore/QSettings>
#include <QtCore/QTimer>
#include <QtCore/QtPlugin>
#include <QtCore/QUrl>
#include <QtGui/QApplication>
#include <QtGui/QCloseEvent>
......@@ -102,10 +103,9 @@ extern "C" void handleSigInt(int sig)
using namespace Core;
using namespace Core::Internal;
namespace {
enum { debugMainWindow = 0 };
}
static const char *uriListMimeFormatC = "text/uri-list";
enum { debugMainWindow = 0 };
MainWindow::MainWindow() :
QMainWindow(),
......@@ -156,15 +156,15 @@ MainWindow::MainWindow() :
QCoreApplication::setOrganizationName(QLatin1String("Nokia"));
QSettings::setDefaultFormat(QSettings::IniFormat);
QString baseName = qApp->style()->objectName();
#ifdef Q_WS_X11
if (baseName == "windows") {
#ifdef Q_WS_X11
if (baseName == QLatin1String("windows")) {
// Sometimes we get the standard windows 95 style as a fallback
// e.g. if we are running on a KDE4 desktop
QByteArray desktopEnvironment = qgetenv("DESKTOP_SESSION");
if (desktopEnvironment == "kde")
baseName = "plastique";
baseName = QLatin1String("plastique");
else
baseName = "cleanlooks";
baseName = QLatin1String("cleanlooks");
}
#endif
qApp->setStyle(new ManhattanStyle(baseName));
......@@ -201,6 +201,7 @@ MainWindow::MainWindow() :
#endif
statusBar()->setProperty("p_styled", true);
setAcceptDrops(true);
}
void MainWindow::setSidebarVisible(bool visible)
......@@ -360,6 +361,55 @@ void MainWindow::closeEvent(QCloseEvent *event)
event->accept();
}
// Check for desktop file manager file drop events
static bool isDesktopFileManagerDrop(const QMimeData *d, QStringList *files = 0)
{
if (files)
files->clear();
// Extract dropped files from Mime data.
if (!d->hasFormat(QLatin1String(uriListMimeFormatC)))
return false;
const QList<QUrl> urls = d->urls();
if (urls.empty())
return false;
// Try to find local files
bool hasFiles = false;
const QList<QUrl>::const_iterator cend = urls.constEnd();
for (QList<QUrl>::const_iterator it = urls.constBegin(); it != cend; ++it) {
const QString fileName = it->toLocalFile();
if (!fileName.isEmpty()) {
hasFiles = true;
if (files) {
files->push_back(fileName);
} else {
break; // No result list, sufficient for checking
}
}
}
return hasFiles;
}
void MainWindow::dragEnterEvent(QDragEnterEvent *event)
{
if (isDesktopFileManagerDrop(event->mimeData())) {
event->accept();
} else {
event->ignore();
}
}
void MainWindow::dropEvent(QDropEvent *event)
{
QStringList files;
if (isDesktopFileManagerDrop(event->mimeData(), &files)) {
event->accept();
openFiles(files);
} else {
event->ignore();
}
}
IContext *MainWindow::currentContextObject() const
{
return m_activeContext;
......
......@@ -139,8 +139,10 @@ public slots:
void showOptionsDialog(const QString &category = QString(), const QString &page = QString());
protected:
void changeEvent(QEvent *e);
void closeEvent(QCloseEvent *event);
virtual void changeEvent(QEvent *e);
virtual void closeEvent(QCloseEvent *event);
virtual void dragEnterEvent(QDragEnterEvent *event);
virtual void dropEvent(QDropEvent *event);
private slots:
void openFile();
......
......@@ -150,6 +150,7 @@ WelcomeMode::WelcomeMode() :
updateWelcomePage(welcomePageData);
l->addWidget(m_d->m_webview);
m_d->m_webview->setAcceptDrops(false);
#else
m_d->m_label->setWordWrap(true);
......
......@@ -104,10 +104,17 @@ void FindToolWindow::setCurrentFilter(int index)
QWidget *configWidget = m_configWidgets.at(i);
if (!configWidget)
continue;
if (i == index)
if (i == index) {
m_ui.configWidget->layout()->addWidget(configWidget);
else
bool enabled = m_filters.at(i)->isEnabled();
m_ui.matchCase->setEnabled(enabled);
m_ui.wholeWords->setEnabled(enabled);
m_ui.searchTerm->setEnabled(enabled);
m_ui.searchButton->setEnabled(enabled);
configWidget->setEnabled(enabled);
} else {
configWidget->setParent(0);
}
}
}
......
......@@ -6,5 +6,6 @@
<sub-class-of type="text/plain"/>
<comment>Qt Script file</comment>
<glob pattern="*.js"/>
<glob pattern="*.qs"/>
</mime-type>
</mime-info>
/***************************************************************************
**
** 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)
......@@ -856,7 +864,20 @@ void SubversionPlugin::describe(const QString &source, const QString &changeNr)
const int number = changeNr.toInt(&ok);
if (!ok || number < 2)
return;
QStringList args(QLatin1String("diff"));
// Run log to obtain message (local utf8)
QString description;
QStringList args(QLatin1String("log"));
args.push_back(QLatin1String("-r"));
args.push_back(changeNr);
args.push_back(topLevel);
const SubversionResponse logResponse = runSvn(args, subversionShortTimeOut, false);
if (logResponse.error)
return;
description = logResponse.stdOut;
// Run diff (encoding via source codec)
args.clear();
args.push_back(QLatin1String("diff"));
args.push_back(QLatin1String("-r"));
QString diffArg;
QTextStream(&diffArg) << (number - 1) << ':' << number;
......@@ -867,20 +888,40 @@ void SubversionPlugin::describe(const QString &source, const QString &changeNr)
const SubversionResponse response = runSvn(args, subversionShortTimeOut, false, codec);
if (response.error)
return;
description += response.stdOut;
// Re-use an existing view if possible to support
// the common usage pattern of continuously changing and diffing a file
const QString id = diffArg + source;
if (Core::IEditor *editor = locateEditor("describeChange", id)) {
editor->createNew(response.stdOut);
Core::EditorManager::instance()->activateEditor(editor);
editor->createNew(description);
Core::EditorManager::instance()->setCurrentEditor(editor);
} else {
const QString title = tr("svn describe %1#%2").arg(QFileInfo(source).fileName(), changeNr);
Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VCSBase::DiffOutput, source, codec);
Core::IEditor *newEditor = showOutputInEditor(title, description, VCSBase::DiffOutput, source, codec);
newEditor->setProperty("describeChange", id);
}
}
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;
......
......@@ -167,7 +167,7 @@ private:
HelpPage::HelpPage(CentralWidget *central, QHelpEngine *engine, QObject *parent)
: QWebPage(parent), centralWidget(central), helpEngine(engine)
{
{
}
QWebPage *HelpPage::createWindow(QWebPage::WebWindowType)
......@@ -215,7 +215,7 @@ bool HelpPage::acceptNavigationRequest(QWebFrame *,
HelpViewer::HelpViewer(QHelpEngine *engine, CentralWidget *parent)
: QWebView(parent), helpEngine(engine), parentWidget(parent)
{
{
setPage(new HelpPage(parent, helpEngine, this));
page()->setNetworkAccessManager(new HelpNetworkAccessManager(engine, this));
......@@ -238,6 +238,7 @@ HelpViewer::HelpViewer(QHelpEngine *engine, CentralWidget *parent)
connect(page(), SIGNAL(linkHovered(QString, QString, QString)), this,
SIGNAL(highlighted(QString)));
connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl)));
setAcceptDrops(false);
}
void HelpViewer::setSource(const QUrl &url)
......
QT_BUILD_TREE=$$(QT_BUILD_TREE)
isEmpty(QT_BUILD_TREE):QT_BUILD_TREE=$$(QTDIR)
QT_QRC_BUILD_TREE = $$fromfile($$QT_BUILD_TREE/.qmake.cache,QT_SOURCE_TREE)
INCLUDEPATH *= $$QT_QRC_BUILD_TREE/tools/designer/src/lib/shared
INCLUDEPATH *= $$PWD $$PWD/..
QT *= xml
DEFINES *= QT_NO_SHARED_EXPORT