annotate mainwindow.h @ 244:8fd71f570884

* Update copyright dates
author Chris Cannam
date Mon, 10 Jan 2011 15:38:28 +0000
parents 4e98950f72e8
children 011312e59e44
rev   line source
Chris@57 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@57 2
Chris@57 3 /*
Chris@57 4 EasyMercurial
Chris@57 5
Chris@98 6 Based on hgExplorer by Jari Korhonen
Chris@57 7 Copyright (c) 2010 Jari Korhonen
Chris@244 8 Copyright (c) 2011 Chris Cannam
Chris@244 9 Copyright (c) 2011 Queen Mary, University of London
Chris@57 10
Chris@57 11 This program is free software; you can redistribute it and/or
Chris@57 12 modify it under the terms of the GNU General Public License as
Chris@57 13 published by the Free Software Foundation; either version 2 of the
Chris@57 14 License, or (at your option) any later version. See the file
Chris@57 15 COPYING included with this distribution for more information.
Chris@57 16 */
jtkorhonen@0 17
jtkorhonen@0 18 #ifndef MAINWINDOW_H
jtkorhonen@0 19 #define MAINWINDOW_H
jtkorhonen@0 20
Chris@96 21 #include "hgtabwidget.h"
jtkorhonen@0 22 #include "hgrunner.h"
jtkorhonen@0 23 #include "common.h"
Chris@106 24 #include "changeset.h"
Chris@109 25 #include "hgaction.h"
jtkorhonen@0 26
Chris@50 27 #include <QMainWindow>
Chris@50 28 #include <QListWidget>
Chris@90 29 #include <QFileSystemWatcher>
Chris@50 30
jtkorhonen@0 31 QT_BEGIN_NAMESPACE
jtkorhonen@0 32 class QAction;
jtkorhonen@0 33 class QMenu;
Chris@238 34 class QTimer;
jtkorhonen@0 35 QT_END_NAMESPACE
jtkorhonen@0 36
jtkorhonen@0 37 class MainWindow : public QMainWindow
jtkorhonen@0 38 {
jtkorhonen@0 39 Q_OBJECT
jtkorhonen@0 40
jtkorhonen@0 41 public:
Chris@172 42 MainWindow(QString myDirPath);
Chris@98 43 HgTabWidget *hgTabs;
jtkorhonen@0 44 void writeSettings();
jtkorhonen@0 45
jtkorhonen@0 46 //Paths to remote repo & workfolder
jtkorhonen@0 47 //Local repo is directory "./hg/" under work folder
jtkorhonen@0 48 QString remoteRepoPath;
jtkorhonen@0 49 QString workFolderPath;
Chris@106 50 QString currentBranch;
Chris@106 51 Changesets currentHeads;
Chris@108 52 Changesets currentParents;
Chris@133 53 int commitsSincePush;
Chris@173 54 bool stateUnknown;
Chris@175 55 bool hgIsOK;
Chris@120 56 bool needNewLog;
jtkorhonen@0 57
jtkorhonen@0 58 protected:
jtkorhonen@0 59 void closeEvent(QCloseEvent *event);
jtkorhonen@0 60
jtkorhonen@0 61 public slots:
Chris@145 62 void open(QString local);
Chris@120 63 void hgRefresh();
Chris@238 64 void commandStarting(HgAction);
Chris@142 65 void commandCompleted(HgAction action, QString stdOut);
Chris@142 66 void commandFailed(HgAction action, QString stdErr);
Chris@95 67 void enableDisableActions();
jtkorhonen@0 68
jtkorhonen@0 69 private slots:
jtkorhonen@0 70 void about();
Chris@64 71 void settings();
Chris@69 72 void open();
Chris@182 73 void changeRemoteRepo();
Chris@64 74 void startupDialog();
Chris@94 75 void clearSelections();
Chris@199 76 void showAllChanged(bool);
Chris@64 77
Chris@175 78 void hgTest();
Chris@200 79 void hgTestExtension();
Chris@120 80 void hgQueryPaths();
Chris@120 81 void hgStat();
jtkorhonen@0 82 void hgRemove();
jtkorhonen@0 83 void hgAdd();
jtkorhonen@0 84 void hgCommit();
Chris@168 85 void hgShowSummary();
jtkorhonen@0 86 void hgFolderDiff();
Chris@148 87 void hgDiffToCurrent(QString);
Chris@148 88 void hgDiffToParent(QString, QString);
jtkorhonen@0 89 void hgUpdate();
jtkorhonen@0 90 void hgRevert();
jtkorhonen@0 91 void hgMerge();
Chris@163 92 void hgMarkResolved(QStringList);
jtkorhonen@33 93 void hgRetryMerge();
jtkorhonen@0 94 void hgCloneFromRemote();
jtkorhonen@0 95 void hgInit();
jtkorhonen@0 96 void hgIncoming();
jtkorhonen@0 97 void hgPush();
jtkorhonen@0 98 void hgPull();
Chris@148 99 void hgUpdateToRev(QString);
Chris@148 100 void hgMergeFrom(QString);
jtkorhonen@0 101 void hgAnnotate();
jtkorhonen@0 102 void hgResolveList();
Chris@164 103 void hgTag(QString);
jtkorhonen@11 104 void hgServe();
jtkorhonen@34 105 void hgIgnore();
jtkorhonen@0 106
Chris@90 107 void fsDirectoryChanged(QString);
Chris@90 108 void fsFileChanged(QString);
Chris@238 109 void checkFilesystem();
Chris@238 110 void actuallyRestoreFileSystemWatcher();
Chris@90 111
jtkorhonen@0 112 private:
Chris@109 113 void hgQueryBranch();
Chris@109 114 void hgQueryHeads();
Chris@109 115 void hgQueryParents();
jtkorhonen@0 116 void hgLog();
Chris@150 117 void hgLogIncremental(QStringList prune);
jtkorhonen@0 118 void createActions();
jtkorhonen@0 119 void connectActions();
Chris@141 120 void connectTabsSignals();
jtkorhonen@0 121 void createMenus();
jtkorhonen@0 122 void createToolBars();
Chris@230 123 void updateToolBarStyle();
jtkorhonen@0 124 void createStatusBar();
jtkorhonen@0 125 void readSettings();
jtkorhonen@0 126 void splitChangeSets(QStringList *list, QString hgLogOutput);
Chris@174 127 void reportNewRemoteHeads(QString);
jtkorhonen@2 128 void presentLongStdoutToUser(QString stdo);
Chris@95 129
Chris@182 130 QStringList listAllUpIpV4Addresses();
jtkorhonen@34 131 QString filterTag(QString tag);
jtkorhonen@0 132
Chris@64 133 QString getUserInfo() const;
Chris@64 134
Chris@79 135 bool openLocal(QString);
Chris@79 136 bool openRemote(QString, QString);
Chris@79 137 bool openInit(QString);
Chris@79 138
Chris@79 139 bool complainAboutFilePath(QString);
Chris@79 140 bool complainAboutUnknownFolder(QString);
Chris@84 141 bool complainAboutInitInRepo(QString);
Chris@84 142 bool complainAboutInitFile(QString);
Chris@84 143 bool complainAboutCloneToExisting(QString);
Chris@84 144 bool complainAboutCloneToFile(QString);
Chris@237 145 QString complainAboutCloneToExistingFolder(QString local, QString remote); // returns new location, or empty string for cancel
Chris@84 146
Chris@79 147 bool askToInitExisting(QString);
Chris@79 148 bool askToInitNew(QString);
Chris@79 149 bool askToOpenParentRepo(QString, QString);
Chris@84 150 bool askToOpenInsteadOfInit(QString);
Chris@79 151
Chris@120 152 void showIncoming(QString);
Chris@120 153 void showPullResult(QString);
Chris@120 154 void showPushResult(QString);
Chris@125 155 int extractChangeCount(QString);
Chris@125 156 QString format3(QString, QString, QString);
Chris@120 157
Chris@120 158 void clearState();
Chris@120 159
Chris@90 160 void updateFileSystemWatcher();
Chris@238 161 void suspendFileSystemWatcher();
Chris@238 162 void restoreFileSystemWatcher();
Chris@90 163
Chris@64 164 bool firstStart;
Chris@64 165
Chris@199 166 bool showAllFiles;
Chris@199 167
jtkorhonen@0 168 //Actions enabled flags
jtkorhonen@0 169 bool remoteRepoActionsEnabled;
jtkorhonen@0 170 bool localRepoActionsEnabled;
jtkorhonen@0 171
Chris@172 172 QString m_myDirPath;
Chris@172 173
jtkorhonen@0 174 //File menu actions
Chris@69 175 QAction *openAct;
Chris@182 176 QAction *changeRemoteRepoAct;
jtkorhonen@0 177 QAction *settingsAct;
jtkorhonen@0 178 QAction *exitAct;
jtkorhonen@0 179
jtkorhonen@33 180 //Repo actions
jtkorhonen@0 181 QAction *hgIncomingAct;
jtkorhonen@0 182 QAction *hgPushAct;
jtkorhonen@0 183 QAction *hgPullAct;
Chris@120 184 QAction *hgRefreshAct;
jtkorhonen@0 185 QAction *hgFolderDiffAct;
jtkorhonen@0 186 QAction *hgChgSetDiffAct;
jtkorhonen@0 187 QAction *hgRevertAct;
jtkorhonen@0 188 QAction *hgAddAct;
jtkorhonen@0 189 QAction *hgRemoveAct;
jtkorhonen@0 190 QAction *hgUpdateAct;
jtkorhonen@0 191 QAction *hgCommitAct;
jtkorhonen@0 192 QAction *hgMergeAct;
jtkorhonen@0 193 QAction *hgUpdateToRevAct;
jtkorhonen@0 194 QAction *hgAnnotateAct;
jtkorhonen@34 195 QAction *hgIgnoreAct;
jtkorhonen@11 196 QAction *hgServeAct;
jtkorhonen@0 197
jtkorhonen@0 198 //Menus
jtkorhonen@0 199 QMenu *fileMenu;
jtkorhonen@0 200 QMenu *advancedMenu;
jtkorhonen@0 201 QMenu *helpMenu;
jtkorhonen@0 202
jtkorhonen@0 203 //Help menu actions
jtkorhonen@0 204 QAction *aboutAct;
jtkorhonen@0 205
jtkorhonen@0 206 QToolBar *fileToolBar;
jtkorhonen@0 207 QToolBar *repoToolBar;
jtkorhonen@0 208 QToolBar *workFolderToolBar;
jtkorhonen@0 209
Chris@109 210 HgRunner *runner;
jtkorhonen@0 211
Chris@163 212 bool shouldHgStat;
Chris@163 213
Chris@239 214 QString getDiffBinaryName();
Chris@239 215 QString getMergeBinaryName();
Chris@239 216 QString getEditorBinaryName();
Chris@112 217
Chris@90 218 QFileSystemWatcher *fsWatcher;
Chris@238 219 QTimer *m_fsWatcherGeneralTimer;
Chris@238 220 QTimer *m_fsWatcherRestoreTimer;
Chris@241 221 bool m_fsWatcherSuspended;
Chris@90 222
Chris@163 223 QString lastStatOutput;
Chris@163 224 QStringList lastRevertedFiles;
Chris@163 225
Chris@112 226 bool justMerged;
Chris@163 227 QString mergeTargetRevision;
Chris@157 228 QString mergeCommitComment;
jtkorhonen@0 229 };
jtkorhonen@0 230
jtkorhonen@0 231 #endif