Mercurial > hg > easyhg
changeset 2:c19a4f858aab
Made annotate/resolvelist/resolvemark enable/disable logic better.
author | Jari Korhonen <jtkorhonen@gmail.com> |
---|---|
date | Sat, 24 Apr 2010 15:12:12 +0300 |
parents | a9098eba2ee5 |
children | e7233f757372 |
files | common.h mainwindow.cpp mainwindow.h |
diffstat | 3 files changed, 56 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/common.h Thu Apr 22 03:15:35 2010 +0300 +++ b/common.h Sat Apr 24 15:12:12 2010 +0300 @@ -6,7 +6,7 @@ #include <QtCore> #define APPNAME "HgExplorer" -#define APPVERSION "0.3.6" +#define APPVERSION "0.3.7" #define MY_ICON_SIZE 32 #define REPOMENU_TITLE "Repository actions" #define WORKFOLDERMENU_TITLE "Workfolder actions"
--- a/mainwindow.cpp Thu Apr 22 03:15:35 2010 +0300 +++ b/mainwindow.cpp Sat Apr 24 15:12:12 2010 +0300 @@ -513,23 +513,47 @@ hgStat(); } -void MainWindow::presentLongStdoutToUser(QString stdo, int w, int h) +#define STDOUT_NEEDS_BIG_WINDOW 512 +#define SMALL_WND_W 500 +#define SMALL_WND_H 300 + +#define BIG_WND_W 1024 +#define BIG_WND_H 768 + + +void MainWindow::presentLongStdoutToUser(QString stdo) { - QDialog dlg; - dlg.setMinimumWidth(w); - dlg.setMinimumHeight(h); + if (!stdo.isEmpty()) + { + QDialog dlg; - QVBoxLayout *box = new QVBoxLayout; - QListWidget *list = new QListWidget; - list-> addItems(stdo.split("\n")); - QPushButton *btn = new QPushButton(tr("Ok")); - connect(btn, SIGNAL(clicked()), &dlg, SLOT(accept())); + if (stdo.length() > STDOUT_NEEDS_BIG_WINDOW) + { + dlg.setMinimumWidth(BIG_WND_W); + dlg.setMinimumHeight(BIG_WND_H); + } + else + { + dlg.setMinimumWidth(SMALL_WND_W); + dlg.setMinimumHeight(SMALL_WND_H); + } - box -> addWidget(list); - box -> addWidget(btn); - dlg.setLayout(box); + QVBoxLayout *box = new QVBoxLayout; + QListWidget *list = new QListWidget; + list-> addItems(stdo.split("\n")); + QPushButton *btn = new QPushButton(tr("Ok")); + connect(btn, SIGNAL(clicked()), &dlg, SLOT(accept())); - dlg.exec(); + box -> addWidget(list); + box -> addWidget(btn); + dlg.setLayout(box); + + dlg.exec(); + } + else + { + QMessageBox::information(this, tr("HgExplorer"), tr("Mercurial command did not return any output.")); + } } @@ -644,7 +668,7 @@ case ACT_ANNOTATE: case ACT_RESOLVE_LIST: case ACT_RESOLVE_MARK: - presentLongStdoutToUser(runner -> getStdOut(), 1024, 768); + presentLongStdoutToUser(runner -> getStdOut()); shouldHgStat = true; break; @@ -840,6 +864,9 @@ hgUpdateAct -> setEnabled(localRepoActionsEnabled); hgCommitAct -> setEnabled(localRepoActionsEnabled); hgMergeAct -> setEnabled(localRepoActionsEnabled); + hgResolveListAct -> setEnabled(localRepoActionsEnabled); + hgResolveMarkAct -> setEnabled(localRepoActionsEnabled); + hgAnnotateAct -> setEnabled(localRepoActionsEnabled); hgExp -> enableDisableOtherTabs(); @@ -881,11 +908,24 @@ hgRemoveAct -> setEnabled(false); } + hgResolveListAct -> setEnabled(true); + if (hgExp -> localRepoHeadsList->count() == 1) { hgMergeAct -> setEnabled(false); } + QString currentFile = hgExp -> getCurrentFileListLine(); + if (!currentFile.isEmpty()) + { + hgAnnotateAct -> setEnabled(true); + hgResolveMarkAct -> setEnabled(true); + } + else + { + hgAnnotateAct -> setEnabled(false); + hgResolveMarkAct -> setEnabled(false); + } } } else
--- a/mainwindow.h Thu Apr 22 03:15:35 2010 +0300 +++ b/mainwindow.h Sat Apr 24 15:12:12 2010 +0300 @@ -142,7 +142,7 @@ void readSettings(); void splitChangeSets(QStringList *list, QString hgLogOutput); int getCommitComment(QString& comment); - void presentLongStdoutToUser(QString stdo, int w, int h); + void presentLongStdoutToUser(QString stdo); void countAMRModifications(QListWidget *workList, int& a, int& m, int& r); bool isSelectedModified(QListWidget *workList); bool isSelectedUntracked(QListWidget *workList);