aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/perforce
diff options
context:
space:
mode:
authorAlessandro Portale <alessandro.portale@nokia.com>2009-05-08 15:31:54 +0200
committerAlessandro Portale <alessandro.portale@nokia.com>2009-05-08 16:43:18 +0200
commit0ffc9ab76aaaf8568aa9a2cab6b0a3d5007e5113 (patch)
tree97c9a08200f5038d9c6c73dd662428621c467c32 /src/plugins/perforce
parentb5c57d9136fd08d9d2105f24086748a4ccc76343 (diff)
Removed unused source files that mentioned "Workbench". While at it,
also removed all code inside USE_P4_API. Gits history be our backup, if we ever want to use the P4 Api directly in the future.
Diffstat (limited to 'src/plugins/perforce')
-rw-r--r--src/plugins/perforce/p4.h45
-rw-r--r--src/plugins/perforce/perforce.pro2
-rw-r--r--src/plugins/perforce/perforceplugin.cpp24
-rw-r--r--src/plugins/perforce/perforceplugin.h10
-rw-r--r--src/plugins/perforce/workbenchclientuser.cpp282
-rw-r--r--src/plugins/perforce/workbenchclientuser.h108
6 files changed, 1 insertions, 470 deletions
diff --git a/src/plugins/perforce/p4.h b/src/plugins/perforce/p4.h
deleted file mode 100644
index 107cf41da8..0000000000
--- a/src/plugins/perforce/p4.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** Commercial Usage
-**
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
-**
-** GNU Lesser General Public License Usage
-**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-**
-**************************************************************************/
-
-#ifndef P4_API_INCL
-#define P4_API_INCL
-
-#include <qconfig.h>
-
-#ifdef USE_P4_API
-#
-# if defined(Q_OS_WIN) && defined(SetPort)
-# undef SetPort
-# endif
-#
-# include <clientapi.h>
-# include <diff.h>
-#endif
-
-#endif // P4_API_INCL
diff --git a/src/plugins/perforce/perforce.pro b/src/plugins/perforce/perforce.pro
index 66fe1fe1f5..017dda2981 100644
--- a/src/plugins/perforce/perforce.pro
+++ b/src/plugins/perforce/perforce.pro
@@ -4,7 +4,7 @@ TARGET = Perforce
include(../../qtcreatorplugin.pri)
include(perforce_dependencies.pri)
-HEADERS += p4.h \
+HEADERS += \
perforceplugin.h \
perforceoutputwindow.h \
settingspage.h \
diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp
index a3112da078..eb3bafc052 100644
--- a/src/plugins/perforce/perforceplugin.cpp
+++ b/src/plugins/perforce/perforceplugin.cpp
@@ -30,7 +30,6 @@
#include "perforceplugin.h"
#include "changenumberdialog.h"
-#include "p4.h"
#include "pendingchangesdialog.h"
#include "perforceconstants.h"
#include "perforceeditor.h"
@@ -188,9 +187,6 @@ PerforcePlugin::PerforcePlugin() :
m_undoAction(0),
m_redoAction(0),
m_changeTmpFile(0),
-#ifdef USE_P4_API
- m_workbenchClientUser(0),
-#endif
m_coreListener(0),
m_submitEditorFactory(0),
m_versionControl(0)
@@ -334,13 +330,6 @@ bool PerforcePlugin::initialize(const QStringList &arguments, QString *errorMess
connect(m_openedAction, SIGNAL(triggered()), this, SLOT(printOpenedFileList()));
mperforce->addAction(command);
-#ifdef USE_P4_API
- m_resolveAction = new QAction(tr("Resolve"), this);
- command = am->registerAction(m_resolveAction, PerforcePlugin::RESOLVE, globalcontext);
- connect(m_resolveAction, SIGNAL(triggered()), this, SLOT(resolve()));
- mperforce->addAction(command);
-#endif
-
m_submitAction = new QAction(tr("Submit Project"), this);
command = am->registerAction(m_submitAction, PerforcePlugin::SUBMIT, globalcontext);
command->setDefaultKeySequence(QKeySequence(tr("Alt+P,Alt+S")));
@@ -493,14 +482,6 @@ void PerforcePlugin::printOpenedFileList()
PerforceResponse result = runP4Cmd(QStringList() << QLatin1String("opened"), QStringList(), CommandToWindow|StdOutToWindow|StdErrToWindow|ErrorToWindow);
}
-#ifdef USE_P4_API
-void PerforcePlugin::resolve()
-{
- m_workbenchClientUser->setMode(WorkbenchClientUser::Resolve);
- runP4APICmd(QLatin1String("resolve"));
-}
-#endif
-
void PerforcePlugin::submit()
{
if (!checkP4Command()) {
@@ -689,11 +670,6 @@ void PerforcePlugin::updateActions()
m_annotateAction->setEnabled(true);
m_filelogAction->setEnabled(true);
m_pendingAction->setEnabled(true);
-
-
-#ifdef USE_P4_API
- m_resolveAction->setEnabled(m_enableP4APIActions);
-#endif
}
bool PerforcePlugin::managesDirectory(const QString &directory) const
diff --git a/src/plugins/perforce/perforceplugin.h b/src/plugins/perforce/perforceplugin.h
index 4191d30e8b..733b514dd2 100644
--- a/src/plugins/perforce/perforceplugin.h
+++ b/src/plugins/perforce/perforceplugin.h
@@ -138,10 +138,6 @@ private slots:;
void printPendingChanges();
void slotDiff(const QStringList &files);
-#ifdef USE_P4_API
- void resolve();
-#endif
-
private:
QStringList environment() const;
@@ -223,12 +219,6 @@ private:
static PerforcePlugin *m_perforcePluginInstance;
QString pendingChangesData();
-#ifdef USE_P4_API
- void runP4APICmd(const QString &cmd, const QStringList &args = QStringList());
- WorkbenchClientUser *m_workbenchClientUser;
- bool m_enableP4APIActions;
-#endif
-
CoreListener *m_coreListener;
Core::IEditorFactory *m_submitEditorFactory;
PerforceVersionControl *m_versionControl;
diff --git a/src/plugins/perforce/workbenchclientuser.cpp b/src/plugins/perforce/workbenchclientuser.cpp
deleted file mode 100644
index 097fe21490..0000000000
--- a/src/plugins/perforce/workbenchclientuser.cpp
+++ /dev/null
@@ -1,282 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** Commercial Usage
-**
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
-**
-** GNU Lesser General Public License Usage
-**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-**
-**************************************************************************/
-
-#include "workbenchclientuser.h"
-#include "perforceoutputwindow.h"
-#include "perforceplugin.h"
-
-#include <coreplugin/filemanager.h>
-#include <coreplugin/actionmanager/actionmanagerinterface.h>
-#include <coreplugin/editormanager/editormanager.h>
-
-#include <QtCore/QEventLoop>
-#include <QtCore/QTemporaryFile>
-#include <QtGui/QMessageBox>
-#include <QtGui/QRadioButton>
-#include <QtGui/QMessageBox>
-#include <QtGui/QMainWindow>
-
-using namespace Perforce::Internal;
-
-PromptDialog::PromptDialog(const QString &choice, const QString &text,
- QWidget *parent)
- : QDialog(parent)
-{
- m_ui.setupUi(this);
- m_ui.msgLabel->setText(text);
-
- const QChar closingParenthesis = QLatin1Char(')');
- const QStringList opts = choice.split(QString(closingParenthesis));
- int row = 0;
- int column = 0;
- QString opt;
- QRadioButton *rb = 0;
- for (int i=0; i<opts.count(); ++i) {
- opt = opts.at(i).trimmed();
- if (opt.isEmpty() || opt.startsWith(QLatin1String("Help")))
- continue;
- if (i == opts.count()-1)
- opt = QLatin1String("Default(") + opt.left(opt.length()-1);
- opt.append(QLatin1String(")"));
- rb = new QRadioButton(opt, this);
- rb->setChecked(true);
- if (column>0 && column%3==0)
- ++row;
- m_ui.gridLayout->addWidget(rb, row, column%3, 1, 1);
- ++column;
-
- const int j = opt.lastIndexOf(QLatin1Char('('));
- opt = opt.mid(j+1, opt.lastIndexOf(closingParenthesis)-j-1);
- m_optionsMap.insert(rb, opt);
- }
-}
-
-QString PromptDialog::input() const
-{
- QMapIterator<QRadioButton*, QString> it(m_optionsMap);
- while (it.hasNext()) {
- it.next();
- if (it.key()->isChecked())
- return it.value();
- }
- return QString();
-}
-
-WorkbenchClientUser::WorkbenchClientUser(PerforceOutputWindow *out, PerforcePlugin *plugin) :
- QObject(out),
- m_plugin(plugin),
- m_core(Core::ICore::instance()),
- m_currentEditorIface(0),
- m_userCancelled(false),
- m_mode(Submit),
- m_perforceOutputWindow(out),
- m_skipNextMsg(false),
- m_eventLoop(new QEventLoop(this))
-{
- connect(m_core, SIGNAL(coreAboutToClose()),
- this, SLOT(cancelP4Command()));
-}
-
-WorkbenchClientUser::~WorkbenchClientUser()
-{
-}
-
-void WorkbenchClientUser::setMode(WorkbenchClientUser::Mode mode)
-{
- m_mode = mode;
-}
-
-void WorkbenchClientUser::cancelP4Command()
-{
- m_userCancelled = true;
- m_eventLoop->quit();
-}
-
-void WorkbenchClientUser::Message(Error* err)
-{
- StrBuf buf;
- err->Fmt(&buf);
- QString s = buf.Text();
- m_perforceOutputWindow->append(s);
- if (!m_skipNextMsg) {
- if (err->GetSeverity() == E_FAILED || err->GetSeverity() == E_FATAL) {
- if (!s.startsWith("Client side operation(s) failed."))
- m_errMsg.append(s);
- } else {
- m_msg.append(s);
- }
- }
- m_skipNextMsg = false;
-}
-
-void WorkbenchClientUser::displayErrorMsg(const QString &msg)
-{
- if (msg.isEmpty())
- return;
-
- const QString title = tr("Perforce Error");
- switch (m_mode) {
- case Submit: {
- QMessageBox msgBox(QMessageBox::Critical, title, msg, QMessageBox::Ok, m_core->mainWindow());
- msgBox.setDetailedText(m_msg);
- msgBox.exec();
- }
- break;
- default:
- QMessageBox::critical(m_core->mainWindow(), title, msg);
- break;
- }
- m_errMsg.clear();
-}
-
-void WorkbenchClientUser::OutputError(const char *errBuf)
-{
- QString s(errBuf);
- s = s.trimmed();
- m_perforceOutputWindow->append(s);
- displayErrorMsg(s);
-}
-
-void WorkbenchClientUser::Finished()
-{
- m_errMsg = m_errMsg.trimmed();
- displayErrorMsg(m_errMsg);
- m_msg.clear();
- m_currentEditorIface = 0;
- m_userCancelled = false;
- m_skipNextMsg = false;
-}
-
-bool WorkbenchClientUser::editorAboutToClose(Core::IEditor *editor)
-{
- if (editor && editor == m_currentEditorIface) {
- if (m_mode == WorkbenchClientUser::Submit) {
- const QMessageBox::StandardButton answer =
- QMessageBox::question(m_core->mainWindow(),
- tr("Closing p4 Editor"),
- tr("Do you want to submit this change list?"),
- QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel, QMessageBox::Yes);
- if (answer == QMessageBox::Cancel)
- return false;
- if (answer == QMessageBox::No)
- m_userCancelled = true;
- m_core->fileManager()->blockFileChange(m_currentEditorIface->file());
- m_currentEditorIface->file()->save();
- m_core->fileManager()->unblockFileChange(m_currentEditorIface->file());
- }
- m_eventLoop->quit();
- m_currentEditorIface = 0;
- }
- return true;
-}
-
-void WorkbenchClientUser::Diff(FileSys *f1, FileSys *f2, int, char *, Error *err)
-{
- if (!f1->IsTextual() || !f2->IsTextual())
- return;
-
- FileSys *file1 = File(FST_BINARY);
- file1->Set(f1->Name());
-
- FileSys *file2 = File(FST_BINARY);
- file2->Set(f2->Name());
-
- QTemporaryFile tmp;
- tmp.open();
- QString fileName = tmp.fileName();
-
- {
- ::Diff d;
- d.SetInput(file1, file2, DiffFlags(), err);
- if (!err->Test())
- d.SetOutput(fileName.toLatin1().constData(), err);
- if (!err->Test())
- d.DiffUnified();
- d.CloseOutput(err);
- }
- delete file1;
- delete file2;
-
- QString title = QString("diff %1").arg(f1->Name());
- m_currentEditorIface = m_core->editorManager()->newFile("Perforce Editor", &title, tmp.readAll());
- if (!m_currentEditorIface) {
- err->Set(E_FAILED, "p4 data could not be opened!");
- return;
- }
- m_userCancelled = false;
- m_eventLoop->exec();
- if (m_userCancelled)
- err->Set(E_FAILED, "");
-}
-
-void WorkbenchClientUser::Edit(FileSys *f, Error *err)
-{
- QString fileName(f->Name());
- if (m_mode == Submit) {
- m_currentEditorIface = m_plugin->openPerforceSubmitEditor(fileName, QStringList());
- }
- else {
- m_currentEditorIface = m_core->editorManager()->openEditor(fileName);
- m_core->editorManager()->ensureEditorManagerVisible();
- }
- if (!m_currentEditorIface) {
- err->Set(E_FAILED, "p4 data could not be opened!");
- return;
- }
- m_userCancelled = false;
- m_eventLoop->exec();
- if (m_userCancelled)
- err->Set(E_FAILED, "");
-}
-
-void WorkbenchClientUser::Prompt(const StrPtr &msg, StrBuf &answer, int , Error *err)
-{
- if (m_userCancelled) {
- err->Set(E_FATAL, "");
- return;
- }
- PromptDialog dia(msg.Text(), m_msg, qobject_cast<QWidget*>(m_core));
- dia.exec();
- answer = qstrdup(dia.input().toLatin1().constData());
- if (m_mode == WorkbenchClientUser::Resolve) {
- if (strcmp(answer.Text(), "e") == 0) {
- ;
- } else if (strcmp(answer.Text(), "d") == 0) {
- ;
- } else {
- m_msg.clear();
- m_skipNextMsg = true;
- }
- }
-}
-
-void WorkbenchClientUser::ErrorPause(char *msg, Error *)
-{
- QMessageBox::warning(m_core->mainWindow(), tr("Perforce Error"), QString::fromUtf8(msg));
-}
diff --git a/src/plugins/perforce/workbenchclientuser.h b/src/plugins/perforce/workbenchclientuser.h
deleted file mode 100644
index 359bc1da29..0000000000
--- a/src/plugins/perforce/workbenchclientuser.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/**************************************************************************
-**
-** This file is part of Qt Creator
-**
-** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** Commercial Usage
-**
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
-**
-** GNU Lesser General Public License Usage
-**
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-**
-**************************************************************************/
-
-#ifndef WORKBENCHCLIENTUSER_H
-#define WORKBENCHCLIENTUSER_H
-
-#include "p4.h"
-#include "ui_promptdialog.h"
-
-#include <coreplugin/icorelistener.h>
-
-#include <QtCore/QObject>
-#include <QtCore/QMap>
-
-QT_BEGIN_NAMESPACE
-class QRadioButton;
-class QEventLoop;
-QT_END_NAMESPACE
-
-namespace Core {
-class ICore;
-class IEditor;
-}
-
-namespace Perforce {
-namespace Internal {
-
-class PerforceOutputWindow;
-class PerforcePlugin;
-
-class PromptDialog : public QDialog
-{
-public:
- PromptDialog(const QString &choice, const QString &text, QWidget *parent = 0);
- QString input() const;
-
-private:
- Ui::PromptDialog m_ui;
- QMap<QRadioButton*, QString> m_optionsMap;
-};
-
-class WorkbenchClientUser : public QObject, public ClientUser
-{
- Q_OBJECT
-
-public:
- enum Mode {Submit, Resolve};
- WorkbenchClientUser(PerforceOutputWindow *out, PerforcePlugin *plugin);
- ~WorkbenchClientUser();
- void setMode(WorkbenchClientUser::Mode mode);
-
- void Message(Error* err);
- void OutputError(const char *errBuf);
- void Finished();
- void Diff(FileSys *f1, FileSys *f2, int, char *, Error *err);
- void Edit( FileSys *f, Error *err);
- void Prompt(const StrPtr &msg, StrBuf &answer, int , Error *err);
- void ErrorPause(char *msg, Error *);
- bool editorAboutToClose(Core::IEditor *editor);
-
-private slots:
- void cancelP4Command();
-
-private:
- void displayErrorMsg(const QString &msg);
-
- PerforcePlugin *m_plugin;
- Core::ICore *m_core;
- Core::IEditor *m_currentEditorIface;
- bool m_userCancelled;
- Mode m_mode;
- PerforceOutputWindow *m_perforceOutputWindow;
- QString m_msg;
- QString m_errMsg;
- bool m_skipNextMsg;
- QEventLoop *m_eventLoop;
-};
-
-} // namespace Perforce
-} // namespace Internal
-
-#endif // WORKBENCHCLIENTUSER_H