diff options
author | Kevin Smith <git@kismith.co.uk> | 2011-10-04 10:02:23 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2011-10-04 10:03:16 (GMT) |
commit | 1f4be30a480818458fd841809585681597be831e (patch) | |
tree | 2480d96dce7e3e6df88cebbc3c9d82f922b4476b /Swift/QtUI | |
parent | dc3ddc0d08cc48681e5d16866ef4fcc10819b2a1 (diff) | |
download | swift-contrib-1f4be30a480818458fd841809585681597be831e.zip swift-contrib-1f4be30a480818458fd841809585681597be831e.tar.bz2 |
Allow both instant and reserved rooms.
Resolves: #1006
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 @@ -734,6 +734,7 @@ void QtChatWindow::showRoomConfigurationForm(Form::ref form) { } 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) { 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 @@ -24,6 +24,7 @@ QtJoinMUCWindow::QtJoinMUCWindow(UIEventStream* uiEventStream) : uiEventStream(u // 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() { @@ -38,7 +39,7 @@ void QtJoinMUCWindow::handleJoin() { 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(); } 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 @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>410</width> - <height>169</height> + <height>212</height> </rect> </property> <property name="sizePolicy"> @@ -56,6 +56,13 @@ </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> 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 @@ -8,10 +8,11 @@ #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); @@ -43,12 +44,19 @@ 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 @@ -14,6 +14,7 @@ #include <Swiften/Elements/Form.h> class QBoxLayout; +class QCloseEvent; namespace Swift { class QtFormWidget; @@ -23,12 +24,16 @@ namespace Swift { 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 @@ -151,7 +151,7 @@ QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMa // 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_, 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 @@ -30,7 +30,7 @@ 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); } 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 @@ -26,7 +26,7 @@ namespace Swift { 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); @@ -57,5 +57,6 @@ namespace Swift { std::vector<QPointer<QtChatWindow> > chatWindows; bool startMinimized; int chatFontSize; + bool eagleMode; }; } |