summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCatalin Badea <catalin.badea392@gmail.com>2012-05-24 16:29:25 (GMT)
committerCatalin Badea <catalin.badea392@gmail.com>2012-06-19 20:21:53 (GMT)
commit250ba9152e6b09e1654e18040cffa0d1c31434ec (patch)
tree8ad0a61f60705a4ea59bb8d75bf83fc0d545986f /Swift/QtUI
parent6080dd4915801b45598268c805b62aa6c723a3a3 (diff)
downloadswift-contrib-250ba9152e6b09e1654e18040cffa0d1c31434ec.zip
swift-contrib-250ba9152e6b09e1654e18040cffa0d1c31434ec.tar.bz2
Added History window based code: controller, events, interface and menu entry.
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtHistoryWindow.cpp65
-rw-r--r--Swift/QtUI/QtHistoryWindow.h31
-rw-r--r--Swift/QtUI/QtMainWindow.cpp8
-rw-r--r--Swift/QtUI/QtMainWindow.h1
-rw-r--r--Swift/QtUI/QtUIFactory.cpp11
-rw-r--r--Swift/QtUI/QtUIFactory.h1
-rw-r--r--Swift/QtUI/SConscript1
7 files changed, 118 insertions, 0 deletions
diff --git a/Swift/QtUI/QtHistoryWindow.cpp b/Swift/QtUI/QtHistoryWindow.cpp
new file mode 100644
index 0000000..a54fa03
--- /dev/null
+++ b/Swift/QtUI/QtHistoryWindow.cpp
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2012 Catalin Badea
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include "QtHistoryWindow.h"
+#include "QtTabbable.h"
+
+#include <QCloseEvent>
+#include <QTextEdit>
+#include <QVBoxLayout>
+#include <QPushButton>
+#include <QScrollBar>
+#include <QCheckBox>
+
+#include "QtSwiftUtil.h"
+#include <string>
+
+namespace Swift {
+
+QtHistoryWindow::QtHistoryWindow() {
+ QVBoxLayout* layout = new QVBoxLayout(this);
+ layout->setSpacing(0);
+ layout->setContentsMargins(0,0,0,0);
+
+ QWidget* bottom = new QWidget(this);
+ layout->addWidget(bottom);
+ bottom->setAutoFillBackground(true);
+
+ QHBoxLayout* buttonLayout = new QHBoxLayout(bottom);
+ buttonLayout->setContentsMargins(10,0,20,0);
+ buttonLayout->setSpacing(0);
+
+ buttonLayout->addStretch();
+
+ setWindowTitle(tr("History"));
+ emit titleUpdated();
+}
+
+QtHistoryWindow::~QtHistoryWindow() {
+ // do nothing
+}
+
+void QtHistoryWindow::show() {
+ QWidget::show();
+ emit windowOpening();
+}
+
+void QtHistoryWindow::activate() {
+ emit wantsToActivate();
+}
+
+void QtHistoryWindow::showEvent(QShowEvent* event) {
+ emit windowOpening();
+ emit titleUpdated();
+ QWidget::showEvent(event);
+}
+
+void QtHistoryWindow::closeEvent(QCloseEvent* event) {
+ emit windowClosing();
+ event->accept();
+}
+
+}
diff --git a/Swift/QtUI/QtHistoryWindow.h b/Swift/QtUI/QtHistoryWindow.h
new file mode 100644
index 0000000..f2e5cc0
--- /dev/null
+++ b/Swift/QtUI/QtHistoryWindow.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2012 Catalin Badea
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include "Swift/Controllers/UIInterfaces/HistoryWindow.h"
+#include "QtTabbable.h"
+
+class QTextEdit;
+class QCheckBox;
+class QColor;
+
+namespace Swift {
+ class QtHistoryWindow : public QtTabbable, public HistoryWindow {
+ Q_OBJECT
+
+ public:
+ QtHistoryWindow();
+ ~QtHistoryWindow();
+
+ void show();
+ void activate();
+
+ private:
+ virtual void closeEvent(QCloseEvent* event);
+ virtual void showEvent(QShowEvent* event);
+ };
+}
diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp
index d312546..7ec0c93 100644
--- a/Swift/QtUI/QtMainWindow.cpp
+++ b/Swift/QtUI/QtMainWindow.cpp
@@ -27,6 +27,7 @@
#include <Swift/QtUI/QtLoginWindow.h>
#include <Roster/QtRosterWidget.h>
#include <Swift/Controllers/UIEvents/RequestJoinMUCUIEvent.h>
+#include <Swift/Controllers/UIEvents/RequestHistoryUIEvent.h>
#include <Swift/Controllers/UIEvents/RequestAddUserDialogUIEvent.h>
#include <Swift/Controllers/UIEvents/RequestChatWithUserDialogUIEvent.h>
#include <Swift/Controllers/UIEvents/RequestProfileEditorUIEvent.h>
@@ -122,6 +123,9 @@ QtMainWindow::QtMainWindow(SettingsProvider* settings, UIEventStream* uiEventStr
QAction* joinMUCAction = new QAction(tr("Enter &Room…"), this);
connect(joinMUCAction, SIGNAL(triggered()), SLOT(handleJoinMUCAction()));
actionsMenu->addAction(joinMUCAction);
+ QAction* viewLogsAction = new QAction(tr("&View History…"), this);
+ connect(viewLogsAction, SIGNAL(triggered()), SLOT(handleViewLogsAction()));
+ actionsMenu->addAction(viewLogsAction);
addUserAction_ = new QAction(tr("&Add Contact…"), this);
connect(addUserAction_, SIGNAL(triggered(bool)), this, SLOT(handleAddUserActionTriggered(bool)));
actionsMenu->addAction(addUserAction_);
@@ -235,6 +239,10 @@ void QtMainWindow::handleJoinMUCAction() {
uiEventStream_->send(boost::make_shared<RequestJoinMUCUIEvent>());
}
+void QtMainWindow::handleViewLogsAction() {
+ uiEventStream_->send(boost::make_shared<RequestHistoryUIEvent>());
+}
+
void QtMainWindow::handleStatusChanged(StatusShow::Type showType, const QString &statusMessage) {
onChangeStatusRequest(showType, Q2PSTRING(statusMessage));
}
diff --git a/Swift/QtUI/QtMainWindow.h b/Swift/QtUI/QtMainWindow.h
index 251c346..26d25e1 100644
--- a/Swift/QtUI/QtMainWindow.h
+++ b/Swift/QtUI/QtMainWindow.h
@@ -58,6 +58,7 @@ namespace Swift {
void handleShowOfflineToggled(bool);
void handleShowEmoticonsToggled(bool);
void handleJoinMUCAction();
+ void handleViewLogsAction();
void handleSignOutAction();
void handleEditProfileAction();
void handleAddUserActionTriggered(bool checked);
diff --git a/Swift/QtUI/QtUIFactory.cpp b/Swift/QtUI/QtUIFactory.cpp
index 78de7aa..e58bbbe 100644
--- a/Swift/QtUI/QtUIFactory.cpp
+++ b/Swift/QtUI/QtUIFactory.cpp
@@ -9,6 +9,7 @@
#include <QSplitter>
#include "QtXMLConsoleWidget.h"
+#include "QtHistoryWindow.h"
#include "QtChatTabs.h"
#include "QtMainWindow.h"
#include "QtLoginWindow.h"
@@ -44,6 +45,16 @@ XMLConsoleWidget* QtUIFactory::createXMLConsoleWidget() {
return widget;
}
+HistoryWindow* QtUIFactory::createHistoryWindow() {
+ QtHistoryWindow* window = new QtHistoryWindow();
+ tabs->addTab(window);
+ if (!tabs->isVisible()) {
+ tabs->show();
+ }
+ window->show();
+ return window;
+}
+
FileTransferListWidget* QtUIFactory::createFileTransferListWidget() {
QtFileTransferListWidget* widget = new QtFileTransferListWidget();
tabs->addTab(widget);
diff --git a/Swift/QtUI/QtUIFactory.h b/Swift/QtUI/QtUIFactory.h
index edb89ad..0fa95b8 100644
--- a/Swift/QtUI/QtUIFactory.h
+++ b/Swift/QtUI/QtUIFactory.h
@@ -31,6 +31,7 @@ namespace Swift {
QtUIFactory(SettingsProviderHierachy* settings, QtSettingsProvider* qtOnlySettings, QtChatTabs* tabs, QSplitter* netbookSplitter, QtSystemTray* systemTray, QtChatWindowFactory* chatWindowFactory, TimerFactory* timerFactory, bool startMinimized, bool emoticonsExist);
virtual XMLConsoleWidget* createXMLConsoleWidget();
+ virtual HistoryWindow* createHistoryWindow();
virtual MainWindow* createMainWindow(UIEventStream* eventStream);
virtual LoginWindow* createLoginWindow(UIEventStream* eventStream);
virtual EventWindow* createEventWindow();
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript
index ef05a12..2da5535 100644
--- a/Swift/QtUI/SConscript
+++ b/Swift/QtUI/SConscript
@@ -93,6 +93,7 @@ sources = [
"QtTabWidget.cpp",
"QtTextEdit.cpp",
"QtXMLConsoleWidget.cpp",
+ "QtHistoryWindow.cpp",
"QtFileTransferListWidget.cpp",
"QtFileTransferListItemModel.cpp",
"QtAdHocCommandWindow.cpp",