jtkorhonen@0: /**************************************************************************** jtkorhonen@0: ** jtkorhonen@0: ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). jtkorhonen@0: ** All rights reserved. jtkorhonen@0: ** Contact: Nokia Corporation (qt-info@nokia.com) jtkorhonen@0: ** jtkorhonen@0: ** This file is part of the examples of the Qt Toolkit. jtkorhonen@0: ** jtkorhonen@0: ** $QT_BEGIN_LICENSE:LGPL$ jtkorhonen@0: ** Commercial Usage jtkorhonen@0: ** Licensees holding valid Qt Commercial licenses may use this file in jtkorhonen@0: ** accordance with the Qt Commercial License Agreement provided with the jtkorhonen@0: ** Software or, alternatively, in accordance with the terms contained in jtkorhonen@0: ** a written agreement between you and Nokia. jtkorhonen@0: ** jtkorhonen@0: ** GNU Lesser General Public License Usage jtkorhonen@0: ** Alternatively, this file may be used under the terms of the GNU Lesser jtkorhonen@0: ** General Public License version 2.1 as published by the Free Software jtkorhonen@0: ** Foundation and appearing in the file LICENSE.LGPL included in the jtkorhonen@0: ** packaging of this file. Please review the following information to jtkorhonen@0: ** ensure the GNU Lesser General Public License version 2.1 requirements jtkorhonen@0: ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. jtkorhonen@0: ** jtkorhonen@0: ** In addition, as a special exception, Nokia gives you certain additional jtkorhonen@0: ** rights. These rights are described in the Nokia Qt LGPL Exception jtkorhonen@0: ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. jtkorhonen@0: ** jtkorhonen@0: ** GNU General Public License Usage jtkorhonen@0: ** Alternatively, this file may be used under the terms of the GNU jtkorhonen@0: ** General Public License version 3.0 as published by the Free Software jtkorhonen@0: ** Foundation and appearing in the file LICENSE.GPL included in the jtkorhonen@0: ** packaging of this file. Please review the following information to jtkorhonen@0: ** ensure the GNU General Public License version 3.0 requirements will be jtkorhonen@0: ** met: http://www.gnu.org/copyleft/gpl.html. jtkorhonen@0: ** jtkorhonen@0: ** If you have questions regarding the use of this file, please contact jtkorhonen@0: ** Nokia at qt-info@nokia.com. jtkorhonen@0: ** $QT_END_LICENSE$ jtkorhonen@0: ** jtkorhonen@0: ** Copyright (C) Jari Korhonen, 2010 (HgExplorer specific parts, under lgpl) jtkorhonen@0: ****************************************************************************/ jtkorhonen@0: jtkorhonen@0: #ifndef MAINWINDOW_H jtkorhonen@0: #define MAINWINDOW_H jtkorhonen@0: jtkorhonen@0: #include jtkorhonen@0: jtkorhonen@0: #include "hgexpwidget.h" jtkorhonen@0: #include "hgrunner.h" jtkorhonen@0: #include "common.h" jtkorhonen@0: 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, 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@0: ACT_RESOLVE_MARK 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: //User info for commits jtkorhonen@0: QString userInfo; jtkorhonen@0: bool firstStart; jtkorhonen@0: jtkorhonen@0: protected: jtkorhonen@0: void closeEvent(QCloseEvent *event); jtkorhonen@0: void timerEvent(QTimerEvent *event); jtkorhonen@0: jtkorhonen@0: public slots: jtkorhonen@0: void hgStat(); jtkorhonen@0: void tabChanged(int currTab); jtkorhonen@0: jtkorhonen@0: private slots: jtkorhonen@0: void about(); 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@0: void settings(); 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@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@0: int getCommitComment(QString& comment); jtkorhonen@2: void presentLongStdoutToUser(QString stdo); jtkorhonen@5: void countAMRNModifications(QListWidget *workList, int& a, int& m, int& r, int& n); jtkorhonen@0: bool isSelectedModified(QListWidget *workList); jtkorhonen@0: bool isSelectedUntracked(QListWidget *workList); jtkorhonen@6: bool isSelectedDeletable(QListWidget *workList); jtkorhonen@0: jtkorhonen@0: 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; jtkorhonen@0: QAction *settingsAct; jtkorhonen@0: QAction *exitAct; jtkorhonen@0: 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@0: QAction *hgUpdateToRevAct; jtkorhonen@0: QAction *hgAnnotateAct; jtkorhonen@0: QAction *hgResolveListAct; jtkorhonen@0: QAction *hgResolveMarkAct; 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: int timerId; jtkorhonen@0: HGACTIONS runningAction; jtkorhonen@0: HgRunner *runner; jtkorhonen@0: jtkorhonen@0: int tabPage; jtkorhonen@0: unsigned char initialFileTypesBits; jtkorhonen@0: }; jtkorhonen@0: jtkorhonen@0: #endif