# HG changeset patch # User Chris Cannam # Date 1296494590 0 # Node ID 1244dc3107cb041ad47c45d280f4b26c107f03bf # Parent cc95394e2392684217d6c19a12bd9bb56bf081a3 * Some work on separating out the "more information" component from dialog messages. Will need work on layouts diff -r cc95394e2392 -r 1244dc3107cb confirmcommentdialog.cpp --- a/confirmcommentdialog.cpp Tue Jan 25 16:41:40 2011 +0000 +++ b/confirmcommentdialog.cpp Mon Jan 31 17:23:10 2011 +0000 @@ -51,8 +51,10 @@ QDialogButtonBox::Cancel); layout->addWidget(bbox, 2, 0); m_ok = bbox->button(QDialogButtonBox::Ok); + m_ok->setDefault(true); m_ok->setEnabled(initialComment != ""); m_ok->setText(okButtonText); + bbox->button(QDialogButtonBox::Cancel)->setAutoDefault(false); connect(bbox, SIGNAL(accepted()), this, SLOT(accept())); connect(bbox, SIGNAL(rejected()), this, SLOT(reject())); @@ -93,6 +95,7 @@ QPushButton *ok = box.addButton(QMessageBox::Ok); ok->setText(okButtonText); + box.setDefaultButton(QMessageBox::Ok); if (box.exec() == -1) return false; return box.standardButton(box.clickedButton()) == QMessageBox::Ok; } @@ -110,6 +113,7 @@ QPushButton *ok = box.addButton(QMessageBox::Ok); ok->setText(okButtonText); + box.setDefaultButton(QMessageBox::Cancel); if (box.exec() == -1) return false; return box.standardButton(box.clickedButton()) == QMessageBox::Ok; } diff -r cc95394e2392 -r 1244dc3107cb easyhg.pro --- a/easyhg.pro Tue Jan 25 16:41:40 2011 +0000 +++ b/easyhg.pro Mon Jan 31 17:23:10 2011 +0000 @@ -49,7 +49,8 @@ incomingdialog.h \ uncommitteditem.h \ settingsdialog.h \ - clickablelabel.h + clickablelabel.h \ + moreinformationdialog.h SOURCES = main.cpp \ mainwindow.cpp \ hgtabwidget.cpp \ @@ -79,7 +80,8 @@ changesetscene.cpp \ incomingdialog.cpp \ uncommitteditem.cpp \ - settingsdialog.cpp + settingsdialog.cpp \ + moreinformationdialog.cpp macx-* { SOURCES += common_osx.mm diff -r cc95394e2392 -r 1244dc3107cb mainwindow.cpp --- a/mainwindow.cpp Tue Jan 25 16:41:40 2011 +0000 +++ b/mainwindow.cpp Mon Jan 31 17:23:10 2011 +0000 @@ -43,6 +43,7 @@ #include "confirmcommentdialog.h" #include "incomingdialog.h" #include "settingsdialog.h" +#include "moreinformationdialog.h" #include "version.h" @@ -1529,6 +1530,11 @@ } } +QString MainWindow::format1(QString head) +{ + return QString("

%1

").arg(head); +} + QString MainWindow::format3(QString head, QString intro, QString code) { code = xmlEncode(code).replace("\n", "
") @@ -1596,12 +1602,19 @@ } else { report = tr("Pull complete"); } + + runner->hide(); + + MoreInformationDialog::information(this, tr("Pull complete"), + format1(report), output); + +/*!!! report = format3(report, tr("The pull command output was:"), output); - runner->hide(); - - //!!! and something about updating + + //!!! and something about updating? QMessageBox::information(this, "Pull complete", report); +*/ } void MainWindow::reportNewRemoteHeads(QString output) diff -r cc95394e2392 -r 1244dc3107cb mainwindow.h --- a/mainwindow.h Tue Jan 25 16:41:40 2011 +0000 +++ b/mainwindow.h Mon Jan 31 17:23:10 2011 +0000 @@ -154,6 +154,7 @@ void showPullResult(QString); void showPushResult(QString); int extractChangeCount(QString); + QString format1(QString); QString format3(QString, QString, QString); void clearState(); diff -r cc95394e2392 -r 1244dc3107cb moreinformationdialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/moreinformationdialog.cpp Mon Jan 31 17:23:10 2011 +0000 @@ -0,0 +1,64 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ + +/* + EasyMercurial + + Based on hgExplorer by Jari Korhonen + Copyright (c) 2010 Jari Korhonen + Copyright (c) 2011 Chris Cannam + Copyright (c) 2011 Queen Mary, University of London + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. See the file + COPYING included with this distribution for more information. +*/ + +#include "moreinformationdialog.h" + +#include + +void +MoreInformationDialog::critical(QWidget *parent, QString title, + QString text, QString more) +{ + QMessageBox mb(QMessageBox::Critical, + title, + text, + QMessageBox::Ok, + parent, + Qt::Dialog); + mb.setDetailedText(more); + mb.exec(); +} + +void +MoreInformationDialog::information(QWidget *parent, QString title, + QString text, QString more) +{ + QMessageBox mb(QMessageBox::Information, + title, + text, + QMessageBox::Ok, + parent, + Qt::Dialog); + mb.setDefaultButton(QMessageBox::Ok); + mb.setDetailedText(more); + mb.exec(); +} + +void +MoreInformationDialog::warning(QWidget *parent, QString title, + QString text, QString more) +{ + QMessageBox mb(QMessageBox::Warning, + title, + text, + QMessageBox::Ok, + parent, + Qt::Dialog); + mb.setDetailedText(more); + mb.exec(); +} + diff -r cc95394e2392 -r 1244dc3107cb moreinformationdialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/moreinformationdialog.h Mon Jan 31 17:23:10 2011 +0000 @@ -0,0 +1,38 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ + +/* + EasyMercurial + + Based on hgExplorer by Jari Korhonen + Copyright (c) 2010 Jari Korhonen + Copyright (c) 2011 Chris Cannam + Copyright (c) 2011 Queen Mary, University of London + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. See the file + COPYING included with this distribution for more information. +*/ + +#ifndef MORE_INFORMATION_DIALOG_H +#define MORE_INFORMATION_DIALOG_H + +#include + +class QWidget; + +/** + * Provide methods like the QMessageBox static methods, to call up + * dialogs with "More information" buttons in them + */ + +class MoreInformationDialog +{ +public: + static void critical(QWidget *parent, QString title, QString text, QString more); + static void information(QWidget *parent, QString title, QString text, QString more); + static void warning(QWidget *parent, QString title, QString text, QString more); +}; + +#endif