2 Author: Marco Costalba (C) 2005-2007
4 Copyright: See COPYING file that comes with this distribution
13 #include "exceptionmanager.h"
15 #include "ui_mainview.h"
21 class QListWidgetItem
;
33 class MainImpl
: public QMainWindow
, public Ui_MainBase
{
36 MainImpl(const QString
& curDir
= "", QWidget
* parent
= 0);
37 void updateContextActions(SCRef newRevSha
, SCRef newFileName
, bool isDir
, bool found
);
38 const QString
getRevisionDesc(SCRef sha
);
40 // not buildable with Qt designer, will be created manually
41 QLineEdit
* lineEditSHA
;
42 QLineEdit
* lineEditFilter
;
57 void highlightPatch(const QString
&, bool);
59 void closeAllWindows();
61 void changeFont(const QFont
&);
62 void closeTabButtonEnabled(bool);
63 void typeWriterFontChanged();
64 void flagChanged(uint
);
67 void tabWdg_currentChanged(int);
68 void newRevsAdded(const FileHistory
*, const QVector
<ShaString
>&);
69 void fileNamesLoad(int, int);
70 void revisionsDragged(const QStringList
&);
71 void revisionsDropped(const QStringList
&);
72 void shortCutActivated();
75 virtual bool event(QEvent
* e
);
78 void initWithEventLoopActive();
79 void refreshRepo(bool setCurRevAfterLoad
= true);
80 void listViewLog_doubleClicked(const QModelIndex
&);
81 void fileList_itemDoubleClicked(QListWidgetItem
*);
82 void treeView_doubleClicked(QTreeWidgetItem
*, int);
83 void histListView_doubleClicked(const QModelIndex
&);
84 void customActionListChanged(const QStringList
& list
);
85 void openRecent_triggered(QAction
*);
86 void customAction_triggered(QAction
*);
87 void customAction_exited(const QString
& name
);
88 void goRef_triggered(QAction
*);
89 void changesCommitted(bool);
90 void lineEditSHA_returnPressed();
91 void lineEditFilter_returnPressed();
92 void pushButtonCloseTab_clicked();
93 void ActBack_activated();
94 void ActForward_activated();
95 void ActFind_activated();
96 void ActFindNext_activated();
97 void ActRangeDlg_activated();
98 void ActViewRev_activated();
99 void ActViewFile_activated();
100 void ActViewFileNewTab_activated();
101 void ActViewDiff_activated();
102 void ActViewDiffNewTab_activated();
103 void ActExternalDiff_activated();
104 void ActSplitView_activated();
105 void ActToggleLogsDiff_activated();
106 void ActShowDescHeader_activated();
107 void ActOpenRepo_activated();
108 void ActOpenRepoNewWindow_activated();
109 void ActRefresh_activated();
110 void ActSaveFile_activated();
111 void ActMailFormatPatch_activated();
112 void ActMailApplyPatch_activated();
113 void ActSettings_activated();
114 void ActCommit_activated();
115 void ActAmend_activated();
116 void ActBranch_activated();
117 void ActTag_activated();
118 void ActTagDelete_activated();
119 void ActPush_activated();
120 void ActPop_activated();
121 void ActClose_activated();
122 void ActExit_activated();
123 void ActSearchAndFilter_toggled(bool);
124 void ActSearchAndHighlight_toggled(bool);
125 void ActCustomActionSetup_activated();
126 void ActCheckWorkDir_toggled(bool);
127 void ActShowTree_toggled(bool);
128 void ActFilterTree_toggled(bool);
129 void ActAbout_activated();
130 void ActHelp_activated();
131 void closeEvent(QCloseEvent
* ce
);
134 friend class setRepoDelayed
;
136 virtual bool eventFilter(QObject
* obj
, QEvent
* ev
);
137 void updateGlobalActions(bool b
);
138 void setupShortcuts();
139 int currentTabType(Domain
** t
);
140 void filterList(bool isOn
, bool onlyHighlight
);
141 bool isMatch(SCRef sha
, SCRef f
, int cn
, const QMap
<QString
,bool>& sm
);
142 void highlightAbbrevSha(SCRef abbrevSha
);
143 void setRepository(SCRef wd
, bool = false, bool = false, const QStringList
* = NULL
, bool = false);
144 void getExternalDiffArgs(QStringList
* args
, QStringList
* filenames
);
145 void lineEditSHASetText(SCRef text
);
146 void updateCommitMenu(bool isStGITStack
);
147 void updateRecentRepoMenu(SCRef newEntry
= "");
148 void doUpdateRecentRepoMenu(SCRef newEntry
);
149 void doUpdateCustomActionMenu(const QStringList
& list
);
150 void doBranchOrTag(bool isTag
);
151 void ActCommit_setEnabled(bool b
);
152 void doContexPopup(SCRef sha
);
153 void doFileContexPopup(SCRef fileName
, int type
);
154 void adjustFontSize(int delta
);
155 void scrollTextEdit(int delta
);
156 void goMatch(int delta
);
157 bool askApplyPatchParameters(bool* commit
, bool* fold
);
158 void saveCurrentGeometry();
159 QTextEdit
* getCurrentTextEdit();
160 template<class X
> QList
<X
*>* getTabs(QWidget
* tabPage
= NULL
);
161 template<class X
> X
* firstTab(QWidget
* startPage
= NULL
);
162 void openFileTab(FileView
* fv
= NULL
);
164 EM_DECLARE(exExiting
);
168 QProgressBar
* pbFileNamesLoading
;
170 // curDir is the repository working directory, could be different from qgit running
171 // directory QDir::current(). Note that qgit could be run from subdirectory
172 // so only after git->isArchive() that updates curDir to point to working directory
173 // we are sure is correct.
179 bool setRepositoryBusy
;
182 class ExternalDiffProc
: public QProcess
{
185 ExternalDiffProc(const QStringList
& f
, QObject
* p
)
186 : QProcess(p
), filenames(f
) {
188 connect(this, SIGNAL(finished(int, QProcess::ExitStatus
)),
189 this, SLOT(on_finished(int, QProcess::ExitStatus
)));
191 ~ExternalDiffProc() {
196 QStringList filenames
;
199 void on_finished(int, QProcess::ExitStatus
) { deleteLater(); }
204 if (!filenames
.empty()) {
205 QDir d
; // remove temporary files to diff on
206 d
.remove(filenames
[0]);
207 d
.remove(filenames
[1]);