diff options
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtAdHocCommandWindow.cpp | 28 | ||||
-rw-r--r-- | Swift/QtUI/QtAdHocCommandWindow.h | 3 | ||||
-rw-r--r-- | Swift/QtUI/QtUIFactory.cpp | 6 | ||||
-rw-r--r-- | Swift/QtUI/QtUIFactory.h | 4 |
4 files changed, 32 insertions, 9 deletions
diff --git a/Swift/QtUI/QtAdHocCommandWindow.cpp b/Swift/QtUI/QtAdHocCommandWindow.cpp index 5d87031..5f99dba 100644 --- a/Swift/QtUI/QtAdHocCommandWindow.cpp +++ b/Swift/QtUI/QtAdHocCommandWindow.cpp @@ -1,16 +1,16 @@ /* - * Copyright (c) 2010-2012 Kevin Smith + * Copyright (c) 2010-2014 Kevin Smith * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ -#include <Swift/QtUI/QtAdHocCommandWindow.h> - #include <boost/bind.hpp> #include <QBoxLayout> +#include <Swift/QtUI/QtAdHocCommandWindow.h> #include <Swift/QtUI/QtFormWidget.h> -#include <Swiften/Elements/Command.h> #include <Swift/QtUI/QtSwiftUtil.h> +#include <Swiften/Base/format.h> +#include <Swiften/Elements/Command.h> const int FormLayoutIndex = 1; @@ -29,6 +29,13 @@ QtAdHocCommandWindow::QtAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocComman label_ = new QLabel(this); label_->setTextFormat(Qt::PlainText); layout_->addWidget(label_); + + errorLabel_ = new QLabel(this); + errorLabel_->setText(QString("<b>%1</b>").arg(tr("Unable to complete the command because you have been disconnected"))); + errorLabel_->setVisible(false); + errorLabel_->setFrameStyle(QFrame::Box|QFrame::Sunken); + layout_->addWidget(errorLabel_); + QWidget* buttonsWidget = new QWidget(this); layout_->addWidget(buttonsWidget); @@ -48,6 +55,7 @@ QtAdHocCommandWindow::QtAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocComman nextButton_->setEnabled(false); backButton_->setEnabled(false); completeButton_->setEnabled(false); + actions_[Command::Next] = nextButton_; actions_[Command::Prev] = backButton_; actions_[Command::Complete] = completeButton_; @@ -55,7 +63,19 @@ QtAdHocCommandWindow::QtAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocComman } QtAdHocCommandWindow::~QtAdHocCommandWindow() { +} + +void QtAdHocCommandWindow::setOnline(bool online) { + if (!online) { + nextButton_->setEnabled(false); + backButton_->setEnabled(false); + completeButton_->setEnabled(false); + errorLabel_->setVisible(true); + } +} +void QtAdHocCommandWindow::closeEvent(QCloseEvent*) { + onClosing(); } void QtAdHocCommandWindow::handleCancelClicked() { diff --git a/Swift/QtUI/QtAdHocCommandWindow.h b/Swift/QtUI/QtAdHocCommandWindow.h index d42a77d..0e398af 100644 --- a/Swift/QtUI/QtAdHocCommandWindow.h +++ b/Swift/QtUI/QtAdHocCommandWindow.h @@ -22,7 +22,9 @@ namespace Swift { public: QtAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocCommandSession> command); virtual ~QtAdHocCommandWindow(); + virtual void setOnline(bool online); private: + void closeEvent(QCloseEvent* event); void handleNextStageReceived(Command::ref command); void handleError(ErrorPayload::ref error); void setForm(Form::ref); @@ -38,6 +40,7 @@ namespace Swift { QtFormWidget* formWidget_; Form::ref form_; QLabel* label_; + QLabel* errorLabel_; QPushButton* backButton_; QPushButton* nextButton_; QPushButton* completeButton_; diff --git a/Swift/QtUI/QtUIFactory.cpp b/Swift/QtUI/QtUIFactory.cpp index e5db22d..afd2a9e 100644 --- a/Swift/QtUI/QtUIFactory.cpp +++ b/Swift/QtUI/QtUIFactory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2012 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -172,8 +172,8 @@ BlockListEditorWidget *QtUIFactory::createBlockListEditorWidget() { return new QtBlockListEditorWindow(); } -void QtUIFactory::createAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocCommandSession> command) { - new QtAdHocCommandWindow(command); +AdHocCommandWindow* QtUIFactory::createAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocCommandSession> command) { + return new QtAdHocCommandWindow(command); } } diff --git a/Swift/QtUI/QtUIFactory.h b/Swift/QtUI/QtUIFactory.h index 662c78e..721aa76 100644 --- a/Swift/QtUI/QtUIFactory.h +++ b/Swift/QtUI/QtUIFactory.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2012 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -50,7 +50,7 @@ namespace Swift { virtual WhiteboardWindow* createWhiteboardWindow(boost::shared_ptr<WhiteboardSession> whiteboardSession); virtual HighlightEditorWidget* createHighlightEditorWidget(); virtual BlockListEditorWidget* createBlockListEditorWidget(); - virtual void createAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocCommandSession> command); + virtual AdHocCommandWindow* createAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocCommandSession> command); private slots: void handleLoginWindowGeometryChanged(); |