Logo Search packages:      
Sourcecode: qgit version File versions


      Author: Marco Costalba (C) 2005-2006

      Copyright: See COPYING file that comes with this distribution

#ifndef MAINIMPL_H
#define MAINIMPL_H

#include <qguardedptr.h>
#include <qregexp.h>
#include <qprocess.h>
#include <qptrvector.h>
#include <qtimer.h>
#include "exceptionmanager.h"
#include "common.h"
#include "mainbase.h"

class QListViewItem;
class QListBoxItem;
class QPopupMenu;
class QCustomEvent;
class QAccel;
class QTextEdit;
class Git;
class Domain;
class ListViewItem;
class RevsView;
class FileView;
class FileHistory;

class MainImpl : public MainBase {
      MainImpl(const QString& curDir = "", QWidget* parent = 0);
      QString curWorkDir() const { return curDir; }

      void highlightPatch(const QString&, bool);
      void updateRevDesc();
      void closeAllWindows();
      void closeAllTabs();
      void tabClosed(int tabPos);
      void repaintListViews(const QFont&);
      void closeTabButtonEnabled(bool);

public slots:
      void tabWdg_currentChanged(QWidget*);
      void on_newRevsAdded(const FileHistory*, const QValueVector<QString>&);

      virtual void customEvent(QCustomEvent* e);

protected slots:
      void initWithEventLoopActive();
      void refreshRepo(bool setCurRevAfterLoad = true);
      void on_listViewLog_doubleClicked(QListViewItem*);
      void on_fileList_doubleClicked(QListBoxItem*);
      void on_treeView_doubleClicked(QListViewItem*);
      void on_histListView_doubleClicked(QListViewItem* item);
      void on_customActionListChanged(const QStringList& list);
      void on_openRecent_activated(int id);
      void on_customAction_activated(int id);
      void on_customAction_exited(const QString& name);
      void on_goRef_activated(int id);
      void on_changesCommitted(bool);
      void lineEditSHA_returnPressed();
      void lineEditFilter_returnPressed();
      void pushButtonCloseTab_clicked();
      void toolButtonFilter_toggled(bool);
      void toolButtonBold_toggled(bool);
      void accelActivated(int);
      void ActBack_activated();
      void ActForward_activated();
      void ActFind_activated();
      void ActFindNext_activated();
      void ActViewRev_activated();
      void ActViewFile_activated();
      void ActViewFileNewTab_activated();
      void ActViewDiff_activated();
      void ActViewDiffNewTab_activated();
      void ActExternalDiff_activated();
      void ActSplitView_activated();
      void ActOpenRepo_activated();
      void ActOpenRepoNewWindow_activated();
      void ActRefresh_activated();
      void ActSaveFile_activated();
      void ActMailFormatPatch_activated();
      void ActMailApplyPatch_activated();
      void ActSettings_activated();
      void ActCommit_activated();
      void ActTag_activated();
      void ActTagDelete_activated();
      void ActPush_activated();
      void ActPop_activated();
      void ActClose_activated();
      void ActExit_activated();
      void ActCustomActionSetup_activated();
      void ActCheckWorkDir_toggled(bool);
      void ActShowTree_toggled(bool);
      void ActFilterTree_toggled(bool);
      void ActAbout_activated();
      void ActHelp_activated();
      void closeEvent(QCloseEvent* ce);

      friend class FileView;
      friend class RevsView;
      friend class PatchView;
      friend class setRepoDelayed;

      virtual bool eventFilter(QObject* obj, QEvent* ev);
      void updateGlobalActions(bool b);
      void updateContextActions(SCRef newRevSha, SCRef newFileName, bool isDir, bool found);
      void setupAccelerator(QAccel* accel);
      int currentTabType(Domain** t);
      void filterList(bool isOn, bool onlyHighlight);
      bool passFilter(ListViewItem* i, SCRef f, int cn, const QMap<QString,bool>& sm);
      void setRepository(SCRef wd, bool r, bool ks, QStringList* fl = NULL);
      void diffViewerUpdate(QListViewItem* item, bool newDiff);
      void getExternalDiffArgs(QStringList* args);
      void lineEditSHASetText(SCRef text);
      void updateCommitMenu(bool isStGITStack);
      void updateRecentRepoMenu(SCRef newEntry = "");
      void doUpdateRecentRepoMenu(SCRef newEntry);
      void doUpdateCustomActionMenu(const QStringList& list);
      void ActCommit_setEnabled(bool b);
      void doContexPopup(SCRef sha);
      void doFileContexPopup(SCRef fileName, int type);
      void adjustFontSize(int delta);
      void scrollTextEdit(int delta);
      void scrollListView(int delta);
      void goMatch(int delta);
      bool askApplyPatchParameters(bool* commit, bool* fold);
      QTextEdit* getCurrentTextEdit();
      template<class X> QPtrList<X>* getTabs(int tabPos = -1);
      template<class X> X* firstTab(int startPos = -1);
      void openFileTab(FileView* fv = NULL);


      Git* git;
      RevsView* rv;

      // curDir is the repository working dir, could be different from qgit running
      // directory QDir::current(). Note that qgit could be run from subdirectory
      // so only after git->isArchive() that updates curDir to point to working dir
      // we are sure is correct.
      QString curDir;
      QRegExp shortLogRE;
      QRegExp longLogRE;
      QGuardedPtr<QPopupMenu> contextMenu;
      QGuardedPtr<QPopupMenu> contextSubMenu;
      QString startUpDir;
      QString textToFind;
      QFont listViewFont;
      bool setRepositoryBusy;
      int recentRepoMenuPos;

class ExternalDiffProc : public QProcess {
      ExternalDiffProc(const QStringList& args, QObject* p) : QProcess(args, p) {

            connect(this, SIGNAL(processExited()), this, SLOT(on_processExited()));
      ~ExternalDiffProc() {

private slots:
      void on_processExited() { deleteLater(); }

      void removeFiles() {

            if (!arguments().empty()) {
                  QDir d; // remove temporary files to diff on

class setRepoDelayed : public QObject {
      setRepoDelayed(MainImpl* mi, SCRef nd, bool r, bool ks, QStringList* fl) :
      QObject(mi), m(mi), newDir(nd), refresh(r), keepSelection(ks), filterList(fl) {

            QTimer::singleShot(100, this, SLOT(on_timeout()));
private slots:
      void on_timeout() {

            m->setRepository(newDir, refresh, keepSelection, filterList);
      MainImpl* m;
      const QString newDir;
      bool refresh, keepSelection;
      QStringList* filterList;


Generated by  Doxygen 1.6.0   Back to index