2011-02-28 13:40:06 +01:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (c) 2014 Hugues Delorme
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2011-02-28 13:40:06 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-02-28 13:40:06 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2011-02-28 13:40:06 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2011-02-28 13:40:06 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2014-07-19 16:04:46 +02:00
|
|
|
|
2011-02-28 13:40:06 +01:00
|
|
|
#ifndef BAZAARPLUGIN_H
|
|
|
|
|
#define BAZAARPLUGIN_H
|
|
|
|
|
|
|
|
|
|
#include "bazaarsettings.h"
|
|
|
|
|
|
2011-08-22 15:33:03 +00:00
|
|
|
#include <vcsbase/vcsbaseclient.h>
|
2011-02-28 13:40:06 +01:00
|
|
|
#include <vcsbase/vcsbaseplugin.h>
|
|
|
|
|
#include <coreplugin/icontext.h>
|
|
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QAction;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
class ActionContainer;
|
2014-01-13 16:17:34 +01:00
|
|
|
class CommandLocator;
|
2011-02-28 13:40:06 +01:00
|
|
|
class Id;
|
|
|
|
|
} // namespace Core
|
|
|
|
|
|
2014-02-11 21:55:42 +02:00
|
|
|
namespace Utils { class ParameterAction; }
|
2011-02-28 13:40:06 +01:00
|
|
|
|
|
|
|
|
namespace Bazaar {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class OptionsPage;
|
|
|
|
|
class BazaarClient;
|
|
|
|
|
class BazaarControl;
|
|
|
|
|
class BazaarEditor;
|
|
|
|
|
|
2012-01-07 12:31:48 +01:00
|
|
|
class BazaarPlugin : public VcsBase::VcsBasePlugin
|
2011-02-28 13:40:06 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2012-02-21 16:52:28 +01:00
|
|
|
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Bazaar.json")
|
2011-02-28 13:40:06 +01:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
BazaarPlugin();
|
2013-01-17 21:51:27 +02:00
|
|
|
~BazaarPlugin();
|
2011-03-14 15:37:30 +01:00
|
|
|
bool initialize(const QStringList &arguments, QString *errorMessage);
|
2011-02-28 13:40:06 +01:00
|
|
|
|
|
|
|
|
static BazaarPlugin *instance();
|
|
|
|
|
BazaarClient *client() const;
|
|
|
|
|
|
|
|
|
|
const BazaarSettings &settings() const;
|
|
|
|
|
void setSettings(const BazaarSettings &settings);
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
// File menu action slots
|
|
|
|
|
void addCurrentFile();
|
|
|
|
|
void annotateCurrentFile();
|
|
|
|
|
void diffCurrentFile();
|
|
|
|
|
void logCurrentFile();
|
|
|
|
|
void revertCurrentFile();
|
|
|
|
|
void statusCurrentFile();
|
|
|
|
|
|
|
|
|
|
// Directory menu action slots
|
|
|
|
|
void diffRepository();
|
|
|
|
|
void logRepository();
|
|
|
|
|
void revertAll();
|
|
|
|
|
void statusMulti();
|
|
|
|
|
|
|
|
|
|
// Repository menu action slots
|
|
|
|
|
void pull();
|
|
|
|
|
void push();
|
|
|
|
|
void update();
|
|
|
|
|
void commit();
|
2012-01-07 12:31:48 +01:00
|
|
|
void showCommitWidget(const QList<VcsBase::VcsBaseClient::StatusItem> &status);
|
2011-02-28 13:40:06 +01:00
|
|
|
void commitFromEditor();
|
2013-12-06 14:56:24 +01:00
|
|
|
void uncommit();
|
2011-02-28 13:40:06 +01:00
|
|
|
void diffFromEditorSelected(const QStringList &files);
|
2013-01-19 23:19:38 +02:00
|
|
|
#ifdef WITH_TESTS
|
|
|
|
|
void testDiffFileResolving_data();
|
|
|
|
|
void testDiffFileResolving();
|
2013-01-28 22:02:35 +02:00
|
|
|
void testLogResolving();
|
2013-01-19 23:19:38 +02:00
|
|
|
#endif
|
2011-02-28 13:40:06 +01:00
|
|
|
|
|
|
|
|
protected:
|
2012-01-07 12:31:48 +01:00
|
|
|
void updateActions(VcsBase::VcsBasePlugin::ActionState);
|
2013-04-18 12:06:43 +02:00
|
|
|
bool submitEditorAboutToClose();
|
2011-02-28 13:40:06 +01:00
|
|
|
|
|
|
|
|
private:
|
2013-10-07 13:34:40 +02:00
|
|
|
// Functions
|
2011-02-28 13:40:06 +01:00
|
|
|
void createMenu();
|
|
|
|
|
void createSubmitEditorActions();
|
|
|
|
|
void createFileActions(const Core::Context &context);
|
|
|
|
|
void createDirectoryActions(const Core::Context &context);
|
|
|
|
|
void createRepositoryActions(const Core::Context &context);
|
|
|
|
|
|
|
|
|
|
// Variables
|
|
|
|
|
static BazaarPlugin *m_instance;
|
|
|
|
|
BazaarSettings m_bazaarSettings;
|
|
|
|
|
OptionsPage *m_optionsPage;
|
|
|
|
|
BazaarClient *m_client;
|
|
|
|
|
|
2014-01-13 16:17:34 +01:00
|
|
|
Core::CommandLocator *m_commandLocator;
|
2011-02-28 13:40:06 +01:00
|
|
|
Core::ActionContainer *m_bazaarContainer;
|
|
|
|
|
|
|
|
|
|
QList<QAction *> m_repositoryActionList;
|
|
|
|
|
|
|
|
|
|
// Menu Items (file actions)
|
|
|
|
|
Utils::ParameterAction *m_addAction;
|
|
|
|
|
Utils::ParameterAction *m_deleteAction;
|
|
|
|
|
Utils::ParameterAction *m_annotateFile;
|
|
|
|
|
Utils::ParameterAction *m_diffFile;
|
|
|
|
|
Utils::ParameterAction *m_logFile;
|
|
|
|
|
Utils::ParameterAction *m_renameFile;
|
|
|
|
|
Utils::ParameterAction *m_revertFile;
|
|
|
|
|
Utils::ParameterAction *m_statusFile;
|
|
|
|
|
|
|
|
|
|
// Submit editor actions
|
|
|
|
|
QAction *m_editorCommit;
|
|
|
|
|
QAction *m_editorDiff;
|
|
|
|
|
QAction *m_editorUndo;
|
|
|
|
|
QAction *m_editorRedo;
|
|
|
|
|
QAction *m_menuAction;
|
|
|
|
|
|
|
|
|
|
QString m_submitRepository;
|
2012-09-26 15:18:44 +02:00
|
|
|
bool m_submitActionTriggered;
|
2011-02-28 13:40:06 +01:00
|
|
|
};
|
|
|
|
|
|
2011-11-10 16:06:19 +01:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Bazaar
|
2011-02-28 13:40:06 +01:00
|
|
|
|
|
|
|
|
#endif // BAZAARPLUGIN_H
|