diff options
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtChatWindow.cpp | 1 | ||||
-rw-r--r-- | Swift/QtUI/QtJoinMUCWindow.cpp | 3 | ||||
-rw-r--r-- | Swift/QtUI/QtJoinMUCWindow.ui | 9 | ||||
-rw-r--r-- | Swift/QtUI/QtMUCConfigurationWindow.cpp | 10 | ||||
-rw-r--r-- | Swift/QtUI/QtMUCConfigurationWindow.h | 5 | ||||
-rw-r--r-- | Swift/QtUI/QtSwift.cpp | 2 | ||||
-rw-r--r-- | Swift/QtUI/QtUIFactory.cpp | 2 | ||||
-rw-r--r-- | Swift/QtUI/QtUIFactory.h | 3 |
8 files changed, 29 insertions, 6 deletions
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index df78767..10daa68 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -728,18 +728,19 @@ void QtChatWindow::handleActionButtonClicked() { } } void QtChatWindow::showRoomConfigurationForm(Form::ref form) { if (mucConfigurationWindow) { delete mucConfigurationWindow.data(); } mucConfigurationWindow = new QtMUCConfigurationWindow(form); mucConfigurationWindow->onFormComplete.connect(boost::bind(boost::ref(onConfigureRequest), _1)); + mucConfigurationWindow->onFormCancelled.connect(boost::bind(boost::ref(onConfigurationFormCancelled))); } void QtChatWindow::addMUCInvitation(const JID& jid, const std::string& reason, const std::string& password) { bool accepted = false; QMessageBox msgBox; msgBox.setText(QString("You have been invited to the room %1 by %2.").arg(P2QSTRING(jid.toString())).arg(contact_)); QString reasonString; if (!reason.empty()) { reasonString = QString("\"%1\"").arg(P2QSTRING(reason)); diff --git a/Swift/QtUI/QtJoinMUCWindow.cpp b/Swift/QtUI/QtJoinMUCWindow.cpp index a44cdaf..fec3c4d 100644 --- a/Swift/QtUI/QtJoinMUCWindow.cpp +++ b/Swift/QtUI/QtJoinMUCWindow.cpp @@ -18,33 +18,34 @@ QtJoinMUCWindow::QtJoinMUCWindow(UIEventStream* uiEventStream) : uiEventStream(u ui.room->setPlaceholderText(tr("someroom@rooms.example.com")); #endif connect(ui.room, SIGNAL(returnPressed()), this, SLOT(handleJoin())); connect(ui.searchButton, SIGNAL(clicked()), this, SLOT(handleSearch())); connect(ui.joinButton, SIGNAL(clicked()), this, SLOT(handleJoin())); // FIXME: Temporarily set focus on the nickName field first, so that the // placeholder for the room is visible. This is just because Qt hides // the placeholder when a widget is focused for some reason. ui.nickName->setFocus(); + ui.instantRoom->setChecked(true); } void QtJoinMUCWindow::handleJoin() { if (ui.room->text().isEmpty()) { // TODO: Error return; } if (ui.nickName->text().isEmpty()) { // TODO: Error return; } lastSetNick = Q2PSTRING(ui.nickName->text()); JID room(Q2PSTRING(ui.room->text())); - uiEventStream->send(boost::make_shared<JoinMUCUIEvent>(room, lastSetNick, ui.joinAutomatically->isChecked())); + uiEventStream->send(boost::make_shared<JoinMUCUIEvent>(room, lastSetNick, ui.joinAutomatically->isChecked(), !ui.instantRoom->isChecked())); hide(); } void QtJoinMUCWindow::handleSearch() { onSearchMUC(); } void QtJoinMUCWindow::setNick(const std::string& nick) { ui.nickName->setText(P2QSTRING(nick)); diff --git a/Swift/QtUI/QtJoinMUCWindow.ui b/Swift/QtUI/QtJoinMUCWindow.ui index 493fb26..74fe513 100644 --- a/Swift/QtUI/QtJoinMUCWindow.ui +++ b/Swift/QtUI/QtJoinMUCWindow.ui @@ -1,19 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>QtJoinMUCWindow</class> <widget class="QWidget" name="QtJoinMUCWindow"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>410</width> - <height>169</height> + <height>212</height> </rect> </property> <property name="sizePolicy"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="windowTitle"> @@ -50,18 +50,25 @@ <widget class="QLineEdit" name="room"> <property name="text"> <string/> </property> </widget> </item> </layout> </item> <item> + <widget class="QCheckBox" name="instantRoom"> + <property name="text"> + <string>Automatically configure newly created rooms</string> + </property> + </widget> + </item> + <item> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>20</width> <height>36</height> </size> diff --git a/Swift/QtUI/QtMUCConfigurationWindow.cpp b/Swift/QtUI/QtMUCConfigurationWindow.cpp index a8dec2a..6fdfd43 100644 --- a/Swift/QtUI/QtMUCConfigurationWindow.cpp +++ b/Swift/QtUI/QtMUCConfigurationWindow.cpp @@ -2,22 +2,23 @@ * Copyright (c) 2011 Kevin Smith * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #include <Swift/QtUI/QtMUCConfigurationWindow.h> #include <boost/bind.hpp> #include <QBoxLayout> +#include <QCloseEvent> #include <Swift/QtUI/QtFormWidget.h> namespace Swift { -QtMUCConfigurationWindow::QtMUCConfigurationWindow(Form::ref form) { +QtMUCConfigurationWindow::QtMUCConfigurationWindow(Form::ref form) : closed_(false) { setAttribute(Qt::WA_DeleteOnClose); QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom, this); layout->setContentsMargins(0,0,0,0); layout->setSpacing(2); //QLabel* label = new QLabel(this); //label->setText(tr("Room configuration")); //layout->addWidget(label); @@ -37,20 +38,27 @@ QtMUCConfigurationWindow::QtMUCConfigurationWindow(Form::ref form) { buttonsLayout->addWidget(okButton_); connect(okButton_, SIGNAL(clicked()), this, SLOT(handleOKClicked())); show(); } QtMUCConfigurationWindow::~QtMUCConfigurationWindow() { } +void QtMUCConfigurationWindow::closeEvent(QCloseEvent* event) { + if (!closed_) { + onFormCancelled(); + } +} + void QtMUCConfigurationWindow::handleCancelClicked() { close(); } void QtMUCConfigurationWindow::handleOKClicked() { onFormComplete(formWidget_->getCompletedForm()); + closed_ = true; close(); } } diff --git a/Swift/QtUI/QtMUCConfigurationWindow.h b/Swift/QtUI/QtMUCConfigurationWindow.h index 2be126b..f6a22be 100644 --- a/Swift/QtUI/QtMUCConfigurationWindow.h +++ b/Swift/QtUI/QtMUCConfigurationWindow.h @@ -8,27 +8,32 @@ #include <QWidget> #include <QPushButton> #include <QLabel> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Elements/Form.h> class QBoxLayout; +class QCloseEvent; namespace Swift { class QtFormWidget; class QtMUCConfigurationWindow : public QWidget { Q_OBJECT public: QtMUCConfigurationWindow(Form::ref form); virtual ~QtMUCConfigurationWindow(); boost::signal<void (Form::ref)> onFormComplete; + boost::signal<void ()> onFormCancelled; private slots: void handleCancelClicked(); void handleOKClicked(); + protected: + virtual void closeEvent(QCloseEvent* event); private: QtFormWidget* formWidget_; QPushButton* okButton_; QPushButton* cancelButton_; + bool closed_; }; } diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp index 57f4175..3f65b14 100644 --- a/Swift/QtUI/QtSwift.cpp +++ b/Swift/QtUI/QtSwift.cpp @@ -145,19 +145,19 @@ QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMa if (splitter_) { splitter_->show(); } for (int i = 0; i < numberOfAccounts; i++) { if (i > 0) { // Don't add the first tray (see note above) systemTrays_.push_back(new QtSystemTray()); } - QtUIFactory* uiFactory = new QtUIFactory(settings_, tabs_, splitter_, systemTrays_[i], chatWindowFactory_, startMinimized); + QtUIFactory* uiFactory = new QtUIFactory(settings_, tabs_, splitter_, systemTrays_[i], chatWindowFactory_, startMinimized, eagleMode); uiFactories_.push_back(uiFactory); MainController* mainController = new MainController( &clientMainThreadCaller_, &networkFactories_, uiFactory, settings_, systemTrays_[i], soundPlayer_, storagesFactory_, diff --git a/Swift/QtUI/QtUIFactory.cpp b/Swift/QtUI/QtUIFactory.cpp index 9de700c..faeebdc 100644 --- a/Swift/QtUI/QtUIFactory.cpp +++ b/Swift/QtUI/QtUIFactory.cpp @@ -24,19 +24,19 @@ #include "QtProfileWindow.h" #include "QtContactEditWindow.h" #include "QtAdHocCommandWindow.h" #include "QtFileTransferListWidget.h" #define CHATWINDOW_FONT_SIZE "chatWindowFontSize" namespace Swift { -QtUIFactory::QtUIFactory(QtSettingsProvider* settings, QtChatTabs* tabs, QSplitter* netbookSplitter, QtSystemTray* systemTray, QtChatWindowFactory* chatWindowFactory, bool startMinimized) : settings(settings), tabs(tabs), netbookSplitter(netbookSplitter), systemTray(systemTray), chatWindowFactory(chatWindowFactory), lastMainWindow(NULL), loginWindow(NULL), startMinimized(startMinimized) { +QtUIFactory::QtUIFactory(QtSettingsProvider* settings, QtChatTabs* tabs, QSplitter* netbookSplitter, QtSystemTray* systemTray, QtChatWindowFactory* chatWindowFactory, bool startMinimized, bool eagleMode) : settings(settings), tabs(tabs), netbookSplitter(netbookSplitter), systemTray(systemTray), chatWindowFactory(chatWindowFactory), lastMainWindow(NULL), loginWindow(NULL), startMinimized(startMinimized), eagleMode(eagleMode) { chatFontSize = settings->getIntSetting(CHATWINDOW_FONT_SIZE, 0); } XMLConsoleWidget* QtUIFactory::createXMLConsoleWidget() { QtXMLConsoleWidget* widget = new QtXMLConsoleWidget(); tabs->addTab(widget); if (!tabs->isVisible()) { tabs->show(); } diff --git a/Swift/QtUI/QtUIFactory.h b/Swift/QtUI/QtUIFactory.h index 8fc5395..319613d 100644 --- a/Swift/QtUI/QtUIFactory.h +++ b/Swift/QtUI/QtUIFactory.h @@ -20,19 +20,19 @@ namespace Swift { class QtLoginWindow; class QtMainWindow; class QtChatTheme; class QtChatWindowFactory; class QtChatWindow; class QtUIFactory : public QObject, public UIFactory { Q_OBJECT public: - QtUIFactory(QtSettingsProvider* settings, QtChatTabs* tabs, QSplitter* netbookSplitter, QtSystemTray* systemTray, QtChatWindowFactory* chatWindowFactory, bool startMinimized); + QtUIFactory(QtSettingsProvider* settings, QtChatTabs* tabs, QSplitter* netbookSplitter, QtSystemTray* systemTray, QtChatWindowFactory* chatWindowFactory, bool startMinimized, bool eagleMode); virtual XMLConsoleWidget* createXMLConsoleWidget(); virtual MainWindow* createMainWindow(UIEventStream* eventStream); virtual LoginWindow* createLoginWindow(UIEventStream* eventStream); virtual EventWindow* createEventWindow(); virtual ChatListWindow* createChatListWindow(UIEventStream*); virtual MUCSearchWindow* createMUCSearchWindow(); virtual ChatWindow* createChatWindow(const JID &contact, UIEventStream* eventStream); virtual UserSearchWindow* createUserSearchWindow(UserSearchWindow::Type type, UIEventStream* eventStream, const std::set<std::string>& groups); @@ -51,11 +51,12 @@ namespace Swift { QtChatTabs* tabs; QSplitter* netbookSplitter; QtSystemTray* systemTray; QtChatWindowFactory* chatWindowFactory; QtMainWindow* lastMainWindow; QtLoginWindow* loginWindow; std::vector<QPointer<QtChatWindow> > chatWindows; bool startMinimized; int chatFontSize; + bool eagleMode; }; } |