# HG changeset patch # User Jari Korhonen # Date 1272111132 -10800 # Node ID c19a4f858aabda58c2c0416e9c42d51d936ed5ac # Parent a9098eba2ee53e961c387e713ea2d73c90a4833c Made annotate/resolvelist/resolvemark enable/disable logic better. diff -r a9098eba2ee5 -r c19a4f858aab common.h --- 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 #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" diff -r a9098eba2ee5 -r c19a4f858aab mainwindow.cpp --- 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 diff -r a9098eba2ee5 -r c19a4f858aab mainwindow.h --- 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);