annotate src/mainwindow.h @ 484:896b7903e8f2

Make "Show all files" persistent (fixing #203), and rationalise some config group names (noting that "General" is actually the default group "" as it appears in the config file, not the name of a group called "General": that appears as "%General")
author Chris Cannam
date Wed, 17 Aug 2011 16:09:04 +0100
parents 2d57b81671de
children 1d90cd7a1c5f
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"
Chris@472 26 #include "settingsdialog.h"
jtkorhonen@0 27
Chris@50 28 #include <QMainWindow>
Chris@50 29 #include <QListWidget>
Chris@90 30 #include <QFileSystemWatcher>
Chris@50 31
jtkorhonen@0 32 QT_BEGIN_NAMESPACE
jtkorhonen@0 33 class QAction;
jtkorhonen@0 34 class QMenu;
Chris@238 35 class QTimer;
jtkorhonen@0 36 QT_END_NAMESPACE
jtkorhonen@0 37
Chris@287 38 class WorkStatusWidget;
Chris@287 39
jtkorhonen@0 40 class MainWindow : public QMainWindow
jtkorhonen@0 41 {
jtkorhonen@0 42 Q_OBJECT
jtkorhonen@0 43
jtkorhonen@0 44 public:
Chris@172 45 MainWindow(QString myDirPath);
jtkorhonen@0 46
jtkorhonen@0 47 protected:
jtkorhonen@0 48 void closeEvent(QCloseEvent *event);
jtkorhonen@0 49
jtkorhonen@0 50 public slots:
Chris@145 51 void open(QString local);
Chris@120 52 void hgRefresh();
Chris@238 53 void commandStarting(HgAction);
Chris@142 54 void commandCompleted(HgAction action, QString stdOut);
Chris@142 55 void commandFailed(HgAction action, QString stdErr);
Chris@95 56 void enableDisableActions();
jtkorhonen@0 57
jtkorhonen@0 58 private slots:
jtkorhonen@0 59 void about();
Chris@64 60 void settings();
Chris@472 61 void settings(SettingsDialog::Tab);
Chris@69 62 void open();
Chris@359 63 void recentMenuActivated();
Chris@182 64 void changeRemoteRepo();
Chris@363 65 void changeRemoteRepo(bool initial);
Chris@64 66 void startupDialog();
Chris@94 67 void clearSelections();
Chris@484 68 void showAllChanged();
Chris@64 69
Chris@175 70 void hgTest();
Chris@200 71 void hgTestExtension();
Chris@120 72 void hgQueryPaths();
Chris@120 73 void hgStat();
jtkorhonen@0 74 void hgRemove();
jtkorhonen@0 75 void hgAdd();
jtkorhonen@0 76 void hgCommit();
Chris@168 77 void hgShowSummary();
Chris@289 78 void hgShowSummaryFor(Changeset *);
jtkorhonen@0 79 void hgFolderDiff();
Chris@148 80 void hgDiffToCurrent(QString);
Chris@148 81 void hgDiffToParent(QString, QString);
jtkorhonen@0 82 void hgUpdate();
jtkorhonen@0 83 void hgRevert();
jtkorhonen@0 84 void hgMerge();
Chris@326 85 void hgRedoMerge();
jtkorhonen@0 86 void hgCloneFromRemote();
jtkorhonen@0 87 void hgInit();
jtkorhonen@0 88 void hgIncoming();
jtkorhonen@0 89 void hgPush();
jtkorhonen@0 90 void hgPull();
Chris@148 91 void hgUpdateToRev(QString);
Chris@148 92 void hgMergeFrom(QString);
jtkorhonen@0 93 void hgResolveList();
Chris@164 94 void hgTag(QString);
Chris@311 95 void hgNewBranch();
Chris@311 96 void hgNoBranch();
jtkorhonen@11 97 void hgServe();
Chris@425 98 void hgIgnore();
Chris@413 99 void hgEditIgnore();
jtkorhonen@0 100
Chris@326 101 void hgAnnotateFiles(QStringList);
Chris@326 102 void hgDiffFiles(QStringList);
Chris@326 103 void hgCommitFiles(QStringList);
Chris@326 104 void hgRevertFiles(QStringList);
Chris@361 105 void hgRenameFiles(QStringList);
Chris@361 106 void hgCopyFiles(QStringList);
Chris@326 107 void hgAddFiles(QStringList);
Chris@326 108 void hgRemoveFiles(QStringList);
Chris@326 109 void hgRedoFileMerges(QStringList);
Chris@326 110 void hgMarkFilesResolved(QStringList);
Chris@326 111 void hgIgnoreFiles(QStringList);
Chris@326 112 void hgUnIgnoreFiles(QStringList);
Chris@326 113
Chris@90 114 void fsDirectoryChanged(QString);
Chris@90 115 void fsFileChanged(QString);
Chris@238 116 void checkFilesystem();
Chris@238 117 void actuallyRestoreFileSystemWatcher();
Chris@90 118
jtkorhonen@0 119 private:
Chris@109 120 void hgQueryBranch();
Chris@109 121 void hgQueryHeads();
Chris@109 122 void hgQueryParents();
jtkorhonen@0 123 void hgLog();
Chris@150 124 void hgLogIncremental(QStringList prune);
Chris@359 125
Chris@417 126 void initHgIgnore();
Chris@417 127
Chris@359 128 void updateRecentMenu();
jtkorhonen@0 129 void createActions();
jtkorhonen@0 130 void connectActions();
Chris@141 131 void connectTabsSignals();
jtkorhonen@0 132 void createMenus();
jtkorhonen@0 133 void createToolBars();
Chris@230 134 void updateToolBarStyle();
jtkorhonen@0 135 void createStatusBar();
jtkorhonen@0 136 void readSettings();
jtkorhonen@0 137 void splitChangeSets(QStringList *list, QString hgLogOutput);
Chris@174 138 void reportNewRemoteHeads(QString);
Chris@353 139 void reportAuthFailed(QString);
Chris@284 140 void writeSettings();
Chris@95 141
Chris@182 142 QStringList listAllUpIpV4Addresses();
jtkorhonen@34 143 QString filterTag(QString tag);
jtkorhonen@0 144
Chris@64 145 QString getUserInfo() const;
Chris@64 146
Chris@79 147 bool openLocal(QString);
Chris@79 148 bool openRemote(QString, QString);
Chris@79 149 bool openInit(QString);
Chris@79 150
Chris@79 151 bool complainAboutFilePath(QString);
Chris@79 152 bool complainAboutUnknownFolder(QString);
Chris@84 153 bool complainAboutInitInRepo(QString);
Chris@84 154 bool complainAboutInitFile(QString);
Chris@84 155 bool complainAboutCloneToExisting(QString);
Chris@84 156 bool complainAboutCloneToFile(QString);
Chris@237 157 QString complainAboutCloneToExistingFolder(QString local, QString remote); // returns new location, or empty string for cancel
Chris@84 158
Chris@248 159 bool askAboutUnknownFolder(QString);
Chris@79 160 bool askToInitExisting(QString);
Chris@79 161 bool askToInitNew(QString);
Chris@79 162 bool askToOpenParentRepo(QString, QString);
Chris@84 163 bool askToOpenInsteadOfInit(QString);
Chris@79 164
Chris@120 165 void showIncoming(QString);
Chris@120 166 void showPullResult(QString);
Chris@120 167 void showPushResult(QString);
Chris@125 168 int extractChangeCount(QString);
Chris@275 169 QString format1(QString);
Chris@125 170 QString format3(QString, QString, QString);
Chris@120 171
Chris@120 172 void clearState();
Chris@120 173
Chris@90 174 void updateFileSystemWatcher();
Chris@238 175 void suspendFileSystemWatcher();
Chris@238 176 void restoreFileSystemWatcher();
Chris@90 177
Chris@287 178 void updateWorkFolderAndRepoNames();
Chris@287 179
Chris@287 180 WorkStatusWidget *m_workStatus;
Chris@284 181 HgTabWidget *m_hgTabs;
Chris@64 182
Chris@284 183 QString m_remoteRepoPath;
Chris@284 184 QString m_workFolderPath;
Chris@284 185 QString m_currentBranch;
Chris@284 186 Changesets m_currentHeads;
Chris@284 187 Changesets m_currentParents;
Chris@284 188 int m_commitsSincePush;
Chris@284 189 bool m_stateUnknown;
Chris@284 190 bool m_hgIsOK;
Chris@284 191 bool m_needNewLog;
Chris@284 192
Chris@284 193 bool m_firstStart;
Chris@284 194
Chris@284 195 bool m_showAllFiles;
Chris@199 196
jtkorhonen@0 197 //Actions enabled flags
Chris@284 198 bool m_remoteRepoActionsEnabled;
Chris@284 199 bool m_localRepoActionsEnabled;
jtkorhonen@0 200
Chris@172 201 QString m_myDirPath;
Chris@172 202
Chris@284 203 // File menu actions
Chris@284 204 QAction *m_openAct;
Chris@284 205 QAction *m_changeRemoteRepoAct;
Chris@284 206 QAction *m_settingsAct;
Chris@284 207 QAction *m_exitAct;
jtkorhonen@0 208
Chris@284 209 // Repo actions
Chris@284 210 QAction *m_hgIncomingAct;
Chris@284 211 QAction *m_hgPushAct;
Chris@284 212 QAction *m_hgPullAct;
Chris@284 213 QAction *m_hgRefreshAct;
Chris@284 214 QAction *m_hgFolderDiffAct;
Chris@284 215 QAction *m_hgChgSetDiffAct;
Chris@284 216 QAction *m_hgRevertAct;
Chris@284 217 QAction *m_hgAddAct;
Chris@284 218 QAction *m_hgRemoveAct;
Chris@413 219 QAction *m_hgIgnoreAct;
Chris@284 220 QAction *m_hgUpdateAct;
Chris@284 221 QAction *m_hgCommitAct;
Chris@284 222 QAction *m_hgMergeAct;
Chris@284 223 QAction *m_hgUpdateToRevAct;
Chris@284 224 QAction *m_hgAnnotateAct;
Chris@413 225 QAction *m_hgEditIgnoreAct;
Chris@284 226 QAction *m_hgServeAct;
jtkorhonen@0 227
Chris@284 228 // Menus
Chris@284 229 QMenu *m_fileMenu;
Chris@359 230 QMenu *m_recentMenu;
Chris@284 231 QMenu *m_helpMenu;
jtkorhonen@0 232
Chris@284 233 // Help menu actions
Chris@284 234 QAction *m_aboutAct;
jtkorhonen@0 235
Chris@284 236 QToolBar *m_fileToolBar;
Chris@284 237 QToolBar *m_repoToolBar;
Chris@284 238 QToolBar *m_workFolderToolBar;
jtkorhonen@0 239
Chris@284 240 HgRunner *m_runner;
jtkorhonen@0 241
Chris@284 242 bool m_shouldHgStat;
Chris@163 243
Chris@239 244 QString getDiffBinaryName();
Chris@239 245 QString getMergeBinaryName();
Chris@239 246 QString getEditorBinaryName();
Chris@112 247
Chris@284 248 QFileSystemWatcher *m_fsWatcher;
Chris@238 249 QTimer *m_fsWatcherGeneralTimer;
Chris@238 250 QTimer *m_fsWatcherRestoreTimer;
Chris@241 251 bool m_fsWatcherSuspended;
Chris@90 252
Chris@284 253 QString m_lastStatOutput;
Chris@284 254 QStringList m_lastRevertedFiles;
Chris@163 255
Chris@284 256 bool m_justMerged;
Chris@284 257 QString m_mergeTargetRevision;
Chris@284 258 QString m_mergeCommitComment;
jtkorhonen@0 259 };
jtkorhonen@0 260
jtkorhonen@0 261 #endif