Chris@57: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@57: Chris@57: /* Chris@57: EasyMercurial Chris@57: Chris@57: Based on HgExplorer by Jari Korhonen Chris@57: Copyright (c) 2010 Jari Korhonen Chris@57: Copyright (c) 2010 Chris Cannam Chris@57: Copyright (c) 2010 Queen Mary, University of London Chris@57: Chris@57: This program is free software; you can redistribute it and/or Chris@57: modify it under the terms of the GNU General Public License as Chris@57: published by the Free Software Foundation; either version 2 of the Chris@57: License, or (at your option) any later version. See the file Chris@57: COPYING included with this distribution for more information. Chris@57: */ jtkorhonen@0: jtkorhonen@0: #ifndef MAINWINDOW_H jtkorhonen@0: #define MAINWINDOW_H jtkorhonen@0: jtkorhonen@0: #include "hgexpwidget.h" jtkorhonen@0: #include "hgrunner.h" jtkorhonen@0: #include "common.h" jtkorhonen@0: Chris@50: #include Chris@50: #include Chris@50: jtkorhonen@0: QT_BEGIN_NAMESPACE jtkorhonen@0: class QAction; jtkorhonen@0: class QMenu; jtkorhonen@0: QT_END_NAMESPACE jtkorhonen@0: jtkorhonen@0: enum HGACTIONS jtkorhonen@0: { jtkorhonen@0: ACT_NONE, Chris@74: ACT_PATHS, jtkorhonen@0: ACT_STAT, jtkorhonen@0: ACT_HEADS, jtkorhonen@0: ACT_PARENTS, jtkorhonen@0: ACT_LOG, jtkorhonen@0: ACT_REMOVE, jtkorhonen@0: ACT_ADD, jtkorhonen@0: ACT_INCOMING, jtkorhonen@0: ACT_PUSH, jtkorhonen@0: ACT_PULL, jtkorhonen@0: ACT_CLONEFROMREMOTE, jtkorhonen@0: ACT_INIT, jtkorhonen@0: ACT_COMMIT, jtkorhonen@0: ACT_ANNOTATE, jtkorhonen@0: ACT_FILEDIFF, jtkorhonen@0: ACT_FOLDERDIFF, jtkorhonen@0: ACT_CHGSETDIFF, jtkorhonen@0: ACT_UPDATE, jtkorhonen@0: ACT_REVERT, jtkorhonen@0: ACT_MERGE, jtkorhonen@0: ACT_RESOLVE_LIST, jtkorhonen@11: ACT_SERVE, jtkorhonen@33: ACT_RESOLVE_MARK, jtkorhonen@33: ACT_RETRY_MERGE, jtkorhonen@34: ACT_TAG, jtkorhonen@36: ACT_HG_IGNORE, jtkorhonen@0: }; jtkorhonen@0: jtkorhonen@0: jtkorhonen@0: class MainWindow : public QMainWindow jtkorhonen@0: { jtkorhonen@0: Q_OBJECT jtkorhonen@0: jtkorhonen@0: public: jtkorhonen@0: MainWindow(); jtkorhonen@0: HgExpWidget *hgExp; jtkorhonen@0: void writeSettings(); jtkorhonen@0: void enableDisableActions(); jtkorhonen@0: jtkorhonen@0: //Paths to remote repo & workfolder jtkorhonen@0: //Local repo is directory "./hg/" under work folder jtkorhonen@0: QString remoteRepoPath; jtkorhonen@0: QString workFolderPath; jtkorhonen@0: jtkorhonen@0: protected: jtkorhonen@0: void closeEvent(QCloseEvent *event); jtkorhonen@0: jtkorhonen@0: public slots: Chris@74: void hgPaths(); jtkorhonen@0: void hgStat(); jtkorhonen@0: void tabChanged(int currTab); Chris@62: void commandCompleted(); Chris@62: void commandFailed(); jtkorhonen@0: jtkorhonen@0: private slots: jtkorhonen@0: void about(); Chris@64: void settings(); Chris@69: void open(); Chris@64: void startupDialog(); Chris@64: jtkorhonen@0: void hgRemove(); jtkorhonen@0: void hgAdd(); jtkorhonen@0: void hgCommit(); jtkorhonen@0: void hgFileDiff(); jtkorhonen@0: void hgFolderDiff(); jtkorhonen@0: void hgChgSetDiff(); jtkorhonen@0: void hgUpdate(); jtkorhonen@0: void hgRevert(); jtkorhonen@0: void hgMerge(); jtkorhonen@33: void hgRetryMerge(); jtkorhonen@0: void hgCloneFromRemote(); jtkorhonen@0: void hgInit(); jtkorhonen@0: void hgIncoming(); jtkorhonen@0: void hgPush(); jtkorhonen@0: void hgPull(); jtkorhonen@0: void hgUpdateToRev(); jtkorhonen@0: void hgAnnotate(); jtkorhonen@0: void hgResolveList(); jtkorhonen@0: void hgResolveMark(); jtkorhonen@34: void hgTag(); jtkorhonen@11: void hgServe(); jtkorhonen@34: void hgIgnore(); jtkorhonen@0: jtkorhonen@0: private: jtkorhonen@0: void hgHeads(); jtkorhonen@0: void hgParents(); jtkorhonen@0: void hgLog(); jtkorhonen@0: void createActions(); jtkorhonen@0: void connectActions(); jtkorhonen@0: void createMenus(); jtkorhonen@0: void createToolBars(); jtkorhonen@0: void createStatusBar(); jtkorhonen@0: void readSettings(); jtkorhonen@0: void splitChangeSets(QStringList *list, QString hgLogOutput); jtkorhonen@34: int getCommentOrTag(QString& commentOrTag, QString question, QString dlgTitle); jtkorhonen@2: void presentLongStdoutToUser(QString stdo); jtkorhonen@17: void countModifications(QListWidget *workList, int& added, int& modified, int& removed, int& notTracked, jtkorhonen@17: int& selected, jtkorhonen@17: int& selectedAdded, int& selectedModified, int& selectedRemoved, int& selectedNotTracked); jtkorhonen@0: bool isSelectedModified(QListWidget *workList); jtkorhonen@17: bool areAllSelectedUntracked(QListWidget *workList); jtkorhonen@6: bool isSelectedDeletable(QListWidget *workList); jtkorhonen@17: bool areAllSelectedCommitable(QListWidget *workList); jtkorhonen@28: QString listAllUpIpV4Addresses(); jtkorhonen@34: QString filterTag(QString tag); jtkorhonen@0: Chris@64: QString getUserInfo() const; Chris@64: Chris@79: bool openLocal(QString); Chris@79: bool openRemote(QString, QString); Chris@79: bool openInit(QString); Chris@79: Chris@79: bool complainAboutFilePath(QString); Chris@79: bool complainAboutUnknownFolder(QString); Chris@79: bool askToInitExisting(QString); Chris@79: bool askToInitNew(QString); Chris@79: bool askToOpenParentRepo(QString, QString); Chris@79: Chris@64: bool firstStart; Chris@64: jtkorhonen@0: //Actions enabled flags jtkorhonen@0: bool remoteRepoActionsEnabled; jtkorhonen@0: bool localRepoActionsEnabled; jtkorhonen@0: jtkorhonen@0: //File menu actions jtkorhonen@0: QAction *hgInitAct; jtkorhonen@0: QAction *hgCloneFromRemoteAct; Chris@69: QAction *openAct; jtkorhonen@0: QAction *settingsAct; jtkorhonen@0: QAction *exitAct; jtkorhonen@0: jtkorhonen@33: //Repo actions jtkorhonen@0: QAction *hgIncomingAct; jtkorhonen@0: QAction *hgPushAct; jtkorhonen@0: QAction *hgPullAct; jtkorhonen@0: QAction *hgStatAct; jtkorhonen@0: QAction *hgFileDiffAct; jtkorhonen@0: QAction *hgFolderDiffAct; jtkorhonen@0: QAction *hgChgSetDiffAct; jtkorhonen@0: QAction *hgRevertAct; jtkorhonen@0: QAction *hgAddAct; jtkorhonen@0: QAction *hgRemoveAct; jtkorhonen@0: QAction *hgUpdateAct; jtkorhonen@0: QAction *hgCommitAct; jtkorhonen@0: QAction *hgMergeAct; jtkorhonen@33: QAction *hgRetryMergeAct; jtkorhonen@0: QAction *hgUpdateToRevAct; jtkorhonen@0: QAction *hgAnnotateAct; jtkorhonen@0: QAction *hgResolveListAct; jtkorhonen@0: QAction *hgResolveMarkAct; jtkorhonen@34: QAction *hgTagAct; jtkorhonen@34: QAction *hgIgnoreAct; jtkorhonen@11: QAction *hgServeAct; jtkorhonen@0: jtkorhonen@0: //Menus jtkorhonen@0: QMenu *fileMenu; jtkorhonen@0: QMenu *advancedMenu; jtkorhonen@0: QMenu *helpMenu; jtkorhonen@0: jtkorhonen@0: //Help menu actions jtkorhonen@0: QAction *aboutAct; jtkorhonen@0: QAction *aboutQtAct; jtkorhonen@0: jtkorhonen@0: QToolBar *fileToolBar; jtkorhonen@0: QToolBar *repoToolBar; jtkorhonen@0: QToolBar *workFolderToolBar; jtkorhonen@0: jtkorhonen@0: HGACTIONS runningAction; jtkorhonen@0: HgRunner *runner; jtkorhonen@0: jtkorhonen@33: int tabPage; jtkorhonen@0: unsigned char initialFileTypesBits; jtkorhonen@33: bool justMerged; jtkorhonen@0: }; jtkorhonen@0: jtkorhonen@0: #endif