summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtLoginWindow.cpp2
-rw-r--r--Swift/QtUI/QtMainWindow.cpp9
-rw-r--r--Swift/QtUI/QtMainWindow.h13
-rw-r--r--Swift/QtUI/QtRosterHeader.cpp71
-rw-r--r--Swift/QtUI/QtRosterHeader.h32
-rw-r--r--Swift/QtUI/SConscript1
6 files changed, 117 insertions, 11 deletions
diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp
index a05d3bf..03c6150 100644
--- a/Swift/QtUI/QtLoginWindow.cpp
+++ b/Swift/QtUI/QtLoginWindow.cpp
@@ -22,7 +22,7 @@ QtLoginWindow::QtLoginWindow(const String& defaultJID, const String& defaultPass
QBoxLayout *topLayout = new QBoxLayout(QBoxLayout::TopToBottom, centralWidget);
stack_ = new QStackedWidget(centralWidget);
topLayout->addWidget(stack_);
- topLayout->setMargin(5);
+ topLayout->setMargin(0);
QWidget *wrapperWidget = new QWidget(this);
wrapperWidget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
QBoxLayout *layout = new QBoxLayout(QBoxLayout::TopToBottom, wrapperWidget);
diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp
index fffd478..9fa209b 100644
--- a/Swift/QtUI/QtMainWindow.cpp
+++ b/Swift/QtUI/QtMainWindow.cpp
@@ -4,7 +4,6 @@
#include "QtSwiftUtil.h"
#include "Roster/QtTreeWidgetFactory.h"
#include "Roster/QtTreeWidget.h"
-#include "QtStatusWidget.h"
#include <QBoxLayout>
#include <QComboBox>
@@ -22,9 +21,11 @@ QtMainWindow::QtMainWindow(QtTreeWidgetFactory *treeWidgetFactory) : QWidget() {
QBoxLayout *mainLayout = new QBoxLayout(QBoxLayout::TopToBottom, this);
mainLayout->setContentsMargins(0,0,0,0);
mainLayout->setSpacing(0);
- statusWidget_ = new QtStatusWidget(this);
- connect(statusWidget_, SIGNAL(onChangeStatusRequest(StatusShow::Type, const QString&)), this, SLOT(handleStatusChanged(StatusShow::Type, const QString&)));
- mainLayout->addWidget(statusWidget_);
+ meView_ = new QtRosterHeader(this);
+ mainLayout->addWidget(meView_);
+ //statusWidget_ = new QtStatusWidget(this);
+ connect(meView_, SIGNAL(onChangeStatusRequest(StatusShow::Type, const QString&)), this, SLOT(handleStatusChanged(StatusShow::Type, const QString&)));
+ //mainLayout->addWidget(statusWidget_);
treeWidget_ = dynamic_cast<QtTreeWidget*>(treeWidgetFactory->createTreeWidget());
mainLayout->addWidget(treeWidget_);
diff --git a/Swift/QtUI/QtMainWindow.h b/Swift/QtUI/QtMainWindow.h
index 6f4b5f7..f56262d 100644
--- a/Swift/QtUI/QtMainWindow.h
+++ b/Swift/QtUI/QtMainWindow.h
@@ -4,6 +4,7 @@
#include <QWidget>
#include <QMenu>
#include "Swift/Controllers/MainWindow.h"
+#include "Swift/QtUI/QtRosterHeader.h"
#include <vector>
@@ -14,7 +15,6 @@ class QPushButton;
namespace Swift {
class QtTreeWidget;
class QtTreeWidgetFactory;
- class QtStatusWidget;
class TreeWidget;
@@ -31,11 +31,12 @@ namespace Swift {
void handleJoinMUCDialogComplete(const JID& muc, const QString& nick);
private:
std::vector<QMenu*> menus_;
- QtStatusWidget *statusWidget_;
- QLineEdit *muc_;
- QLineEdit *mucNick_;
- QPushButton *mucButton_;
- QtTreeWidget *treeWidget_;
+ //QtStatusWidget* statusWidget_;
+ QLineEdit* muc_;
+ QLineEdit* mucNick_;
+ QPushButton* mucButton_;
+ QtTreeWidget* treeWidget_;
+ QtRosterHeader* meView_;
};
}
diff --git a/Swift/QtUI/QtRosterHeader.cpp b/Swift/QtUI/QtRosterHeader.cpp
new file mode 100644
index 0000000..7401b30
--- /dev/null
+++ b/Swift/QtUI/QtRosterHeader.cpp
@@ -0,0 +1,71 @@
+#include "QtRosterHeader.h"
+
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QIcon>
+#include <QSizePolicy>
+
+#include "QtStatusWidget.h"
+
+namespace Swift {
+QtRosterHeader::QtRosterHeader(QWidget* parent) : QWidget(parent) {
+ QVBoxLayout* vLayout = new QVBoxLayout();
+ vLayout->setSpacing(0);
+ vLayout->setContentsMargins(0,0,0,0);
+ setLayout(vLayout);
+
+ //QHBoxLayout* topLayout = new QHBoxLayout();
+ //vLayout->addLayout(topLayout);
+
+ toolBar_ = new QToolBar(this);
+ vLayout->addWidget(toolBar_);
+
+ statusWidget_ = new QtStatusWidget(this);
+ toolBar_->addWidget(statusWidget_);
+ statusWidget_->resize(50, statusWidget_->height());
+ connect(statusWidget_, SIGNAL(onChangeStatusRequest(StatusShow::Type, const QString&)), this, SIGNAL(onChangeStatusRequest(StatusShow::Type, const QString&)));
+
+ nameLabel_ = new QLabel(this);
+ setName("Me");
+ //topLayout->addWidget(nameLabel_);
+ toolBar_->addWidget(nameLabel_);
+
+ QHBoxLayout* expandedLayout = new QHBoxLayout();
+ expandedLayout->setContentsMargins(5,5,5,5);
+ expandedLayout->setSpacing(11);
+
+ avatarLabel_ = new QLabel(this);
+ setAvatar(":/icons/avatar.png");
+ expandedLayout->addWidget(avatarLabel_);
+
+ statusEdit_ = new QTextEdit(this);
+ expandedLayout->addWidget(statusEdit_);
+ statusEdit_->resize(statusEdit_->width(), 64);
+ statusEdit_->setAcceptRichText(false);
+ statusEdit_->setReadOnly(false);
+ setStatusText("Could be here, could be away.");
+
+ vLayout->addLayout(expandedLayout);
+
+ setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
+}
+
+void QtRosterHeader::setStatusText(const QString& statusMessage) {
+ statusEdit_->setText(statusMessage);
+}
+
+void QtRosterHeader::setName(const QString& name) {
+ QString escapedName = name;
+ escapedName.replace("<","&lt;");
+ nameLabel_->setText("<b>" + escapedName + "</b>");
+}
+
+void QtRosterHeader::setAvatar(const QString& path) {
+ avatarLabel_->setPixmap(QIcon(path).pixmap(64, 64));
+}
+
+QSize QtRosterHeader::sizeHint() const {
+ return minimumSizeHint();
+}
+
+}
diff --git a/Swift/QtUI/QtRosterHeader.h b/Swift/QtUI/QtRosterHeader.h
new file mode 100644
index 0000000..94b7249
--- /dev/null
+++ b/Swift/QtUI/QtRosterHeader.h
@@ -0,0 +1,32 @@
+#pragma once
+
+#include <QWidget>
+#include <QLabel>
+#include <QPixmap>
+#include <QTextEdit>
+#include <QSize>
+#include <QToolBar>
+
+#include "Swiften/Elements/StatusShow.h"
+
+namespace Swift {
+ class QtStatusWidget;
+
+ class QtRosterHeader : public QWidget {
+ Q_OBJECT
+ public:
+ QtRosterHeader(QWidget* parent = NULL);
+ void setAvatar(const QString& path);
+ void setName(const QString& name);
+ void setStatusText(const QString& statusMessage);
+ QSize sizeHint() const;
+ signals:
+ void onChangeStatusRequest(StatusShow::Type showType, const QString &statusMessage);
+ private:
+ QLabel* avatarLabel_;
+ QLabel* nameLabel_;
+ QTextEdit* statusEdit_;
+ QToolBar* toolBar_;
+ QtStatusWidget* statusWidget_;
+ };
+}
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript
index c64ae61..cd810a4 100644
--- a/Swift/QtUI/SConscript
+++ b/Swift/QtUI/SConscript
@@ -67,6 +67,7 @@ sources = [
"Roster/QtTreeWidget.cpp",
"Roster/QtTreeWidgetItem.cpp",
"Roster/RosterDelegate.cpp",
+ "QtRosterHeader.cpp",
"qrc_DefaultTheme.cc",
"qrc_Swift.cc",
]