view mainwindow.h @ 33:ff8d64625aa3

Added retry_merge. Fixed bug in "after merge" commit.
author Jari Korhonen <jtkorhonen@gmail.com>
date Sat, 19 Jun 2010 00:23:09 +0300
parents 45bfb8dc1faf
children 43e3b271d293
line wrap: on
line source
/****************************************************************************
** Copyright (C) Jari Korhonen, 2010 (under lgpl)
****************************************************************************/

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

#include "hgexpwidget.h"
#include "hgrunner.h"
#include "common.h"

QT_BEGIN_NAMESPACE
class QAction;
class QMenu;
QT_END_NAMESPACE

enum HGACTIONS
{
    ACT_NONE,
    ACT_STAT,
    ACT_HEADS,
    ACT_PARENTS,
    ACT_LOG,
    ACT_REMOVE,
    ACT_ADD,
    ACT_INCOMING,
    ACT_PUSH,
    ACT_PULL,
    ACT_CLONEFROMREMOTE,
    ACT_INIT,
    ACT_COMMIT,
    ACT_ANNOTATE,
    ACT_FILEDIFF,
    ACT_FOLDERDIFF,
    ACT_CHGSETDIFF,
    ACT_UPDATE,
    ACT_REVERT,
    ACT_MERGE,
    ACT_RESOLVE_LIST,
    ACT_SERVE,
    ACT_RESOLVE_MARK,
    ACT_RETRY_MERGE,
};


class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow();
    HgExpWidget *hgExp;
    void writeSettings();
    void enableDisableActions();

    //Paths to remote repo & workfolder
    //Local repo is directory "./hg/" under work folder
    QString remoteRepoPath;
    QString workFolderPath;

    QString remoteRepoMruList[NUM_PATHS_IN_MRU_LIST];
    QString workFolderMruList[NUM_PATHS_IN_MRU_LIST];

    //User info for commits
    QString userInfo;
    bool        firstStart;

protected:
    void closeEvent(QCloseEvent *event);
    void timerEvent(QTimerEvent *event);

public slots:
    void hgStat();
    void tabChanged(int currTab);

private slots:
    void about();
    void hgRemove();
    void hgAdd();
    void hgCommit();
    void hgFileDiff();
    void hgFolderDiff();
    void hgChgSetDiff();
    void hgUpdate();
    void hgRevert();
    void hgMerge();
    void hgRetryMerge();
    void settings();
    void hgCloneFromRemote();
    void hgInit();
    void hgIncoming();
    void hgPush();
    void hgPull();
    void hgUpdateToRev();
    void hgAnnotate();
    void hgResolveList();
    void hgResolveMark();
    void hgServe();

private:
    void hgHeads();
    void hgParents();
    void hgLog();
    void createActions();
    void connectActions();
    void createMenus();
    void createToolBars();
    void createStatusBar();
    void readSettings();
    void splitChangeSets(QStringList *list, QString hgLogOutput);
    int getCommitComment(QString& comment);
    void presentLongStdoutToUser(QString stdo);
    void countModifications(QListWidget *workList, int& added, int& modified, int& removed, int& notTracked,
        int& selected,
        int& selectedAdded, int& selectedModified, int& selectedRemoved, int& selectedNotTracked);
    bool isSelectedModified(QListWidget *workList);
    bool areAllSelectedUntracked(QListWidget *workList);
    bool isSelectedDeletable(QListWidget *workList);
    bool areAllSelectedCommitable(QListWidget *workList);
    QString listAllUpIpV4Addresses();


    //Actions enabled flags
    bool remoteRepoActionsEnabled;
    bool localRepoActionsEnabled;

    //File menu actions
    QAction *hgInitAct;
    QAction *hgCloneFromRemoteAct;
    QAction *settingsAct;
    QAction *exitAct;

    //Repo actions
    QAction *hgIncomingAct;
    QAction *hgPushAct;
    QAction *hgPullAct;
    QAction *hgStatAct;
    QAction *hgFileDiffAct;
    QAction *hgFolderDiffAct;
    QAction *hgChgSetDiffAct;
    QAction *hgRevertAct;
    QAction *hgAddAct;
    QAction *hgRemoveAct;
    QAction *hgUpdateAct;
    QAction *hgCommitAct;
    QAction *hgMergeAct;
    QAction *hgRetryMergeAct;
    QAction *hgUpdateToRevAct;
    QAction *hgAnnotateAct;
    QAction *hgResolveListAct;
    QAction *hgResolveMarkAct;
    QAction *hgServeAct;

    //Menus
    QMenu   *fileMenu;
    QMenu   *advancedMenu;
    QMenu   *helpMenu;

    //Help menu actions
    QAction *aboutAct;
    QAction *aboutQtAct;

    QToolBar *fileToolBar;
    QToolBar *repoToolBar;
    QToolBar *workFolderToolBar;

    int         timerId;
    HGACTIONS   runningAction;
    HgRunner    *runner;

    int             tabPage;
    unsigned char   initialFileTypesBits;
    bool            justMerged;
};

#endif