summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVlad Voicu <vladvoic@gmail.com>2011-05-30 18:02:15 (GMT)
committerVlad Voicu <vladvoic@gmail.com>2011-05-31 18:34:03 (GMT)
commit7d53b6a3b139faeb7b12ec158ac88686dd41ed55 (patch)
tree1f9535c33844833a1ac3e511b1f24cabce7a90b3
parentdc09259ab9e7c27e0e1026b72f801bd85cbb8190 (diff)
downloadswift-contrib-7d53b6a3b139faeb7b12ec158ac88686dd41ed55.zip
swift-contrib-7d53b6a3b139faeb7b12ec158ac88686dd41ed55.tar.bz2
History Window mockup
-rw-r--r--Swift/QtUI/QtViewHistoryWindow.cpp57
-rw-r--r--Swift/QtUI/QtViewHistoryWindow.h4
-rw-r--r--Swift/QtUI/QtViewHistoryWindow.ui324
3 files changed, 227 insertions, 158 deletions
diff --git a/Swift/QtUI/QtViewHistoryWindow.cpp b/Swift/QtUI/QtViewHistoryWindow.cpp
index 71f77b8..56543a2 100644
--- a/Swift/QtUI/QtViewHistoryWindow.cpp
+++ b/Swift/QtUI/QtViewHistoryWindow.cpp
@@ -6,10 +6,19 @@
#include <QWidget>
#include <QBoxLayout>
+#include <QString>
+#include <cstring>
#include "QtViewHistoryWindow.h"
#include "QtChatView.h"
#include "QtChatTheme.h"
+#include "MessageSnippet.h"
+#include "QtSwiftUtil.h"
+#include <QDebug>
+#include <QStandardItemModel>
+
+#include <boost/bind.hpp>
+#include <cstdio>
namespace Swift {
@@ -17,7 +26,15 @@ QtViewHistoryWindow::QtViewHistoryWindow() {
ui.setupUi(this);
QtChatTheme *theme = new QtChatTheme(""); // Where should I get the theme path from?
messageLog_ = new QtChatView(theme, this);
- ui.chatView_->addWidget(messageLog_);
+ ui.chatView_ = messageLog_;
+ QStandardItemModel *dummyModel = new QStandardItemModel(1, 1);
+ QStandardItem *item = new QStandardItem(QString("test row, test column"));
+ dummyModel->setItem(0, 0, item);
+ QTreeView *userHistory = new QTreeView();
+ userHistory->setModel(dummyModel);
+ ui.userHistory_ = userHistory;
+ connect(ui.periodPickerBefore_, SIGNAL(valueChanged(int)), this, SLOT(handleBeforeSliderValueChanged(int)));
+ connect(ui.periodPickerAfter_, SIGNAL(valueChanged(int)), this, SLOT(handleAfterSliderValueChanged(int)));
show();
}
@@ -30,4 +47,42 @@ void QtViewHistoryWindow::setEnabled(bool enabled) {
QWidget::setEnabled(enabled);
}
+std::string QtViewHistoryWindow::getLabel(const int value) {
+ std::string labelText;
+ switch (value / 16) {
+ case 0:
+ labelText = "1 day";
+ break;
+ case 1:
+ labelText = "3 days";
+ break;
+ case 2:
+ labelText = "1 week";
+ break;
+ case 3:
+ labelText = "2 weeks";
+ break;
+ case 4:
+ labelText = "1 month";
+ break;
+ case 5:
+ labelText = "3 months";
+ break;
+ case 6:
+ labelText = "1 year";
+ break;
+ }
+ return labelText;
+}
+
+void QtViewHistoryWindow::handleBeforeSliderValueChanged(const int value) {
+ QString labelText = P2QSTRING(getLabel(value));
+ ui.beforePeriodLabel_->setText(labelText);
+}
+
+void QtViewHistoryWindow::handleAfterSliderValueChanged(const int value) {
+ QString labelText = P2QSTRING(getLabel(value));
+ ui.afterPeriodLabel_->setText(labelText);
+}
+
}
diff --git a/Swift/QtUI/QtViewHistoryWindow.h b/Swift/QtUI/QtViewHistoryWindow.h
index 145731c..1ed5757 100644
--- a/Swift/QtUI/QtViewHistoryWindow.h
+++ b/Swift/QtUI/QtViewHistoryWindow.h
@@ -21,8 +21,12 @@ namespace Swift {
QtViewHistoryWindow();
void show();
void setEnabled(bool enabled);
+ private slots:
+ void handleBeforeSliderValueChanged(const int value);
+ void handleAfterSliderValueChanged(const int value);
private:
+ std::string getLabel(const int value);
QtChatView* messageLog_;
Ui::QtViewHistoryWindow ui;
JID jid_;
diff --git a/Swift/QtUI/QtViewHistoryWindow.ui b/Swift/QtUI/QtViewHistoryWindow.ui
index 17a5b6b..736776f 100644
--- a/Swift/QtUI/QtViewHistoryWindow.ui
+++ b/Swift/QtUI/QtViewHistoryWindow.ui
@@ -6,174 +6,184 @@
<rect>
<x>0</x>
<y>0</y>
- <width>990</width>
- <height>614</height>
+ <width>1237</width>
+ <height>899</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
- <widget class="QLabel" name="label_2">
- <property name="geometry">
- <rect>
- <x>930</x>
- <y>1100</y>
- <width>131</width>
- <height>17</height>
- </rect>
- </property>
- <property name="text">
- <string>Search keywords:</string>
- </property>
- </widget>
- <widget class="QTextEdit" name="textEdit_2">
- <property name="geometry">
- <rect>
- <x>930</x>
- <y>1120</y>
- <width>651</width>
- <height>31</height>
- </rect>
- </property>
- </widget>
- <widget class="QLabel" name="label">
- <property name="geometry">
- <rect>
- <x>1350</x>
- <y>1100</y>
- <width>61</width>
- <height>16</height>
- </rect>
- </property>
- <property name="text">
- <string>Today</string>
- </property>
- </widget>
- <widget class="QTreeView" name="treeView">
- <property name="geometry">
- <rect>
- <x>1590</x>
- <y>620</y>
- <width>256</width>
- <height>531</height>
- </rect>
- </property>
- </widget>
- <widget class="QScrollBar" name="horizontalScrollBar">
- <property name="geometry">
- <rect>
- <x>1420</x>
- <y>1100</y>
- <width>160</width>
- <height>16</height>
- </rect>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- <widget class="QWidget" name="gridLayoutWidget">
- <property name="geometry">
- <rect>
- <x>100</x>
- <y>30</y>
- <width>871</width>
- <height>571</height>
- </rect>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="2" column="0">
- <widget class="QWidget" name="widget" native="true">
- <widget class="QTreeView" name="treeView_2">
- <property name="geometry">
- <rect>
- <x>610</x>
- <y>20</y>
- <width>251</width>
- <height>471</height>
- </rect>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QWidget" name="chatView_" native="true"/>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QTreeView" name="userHistory_">
+ <property name="maximumSize">
+ <size>
+ <width>350</width>
+ <height>800</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="SerachText">
+ <property name="text">
+ <string>Search keywords:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QProgressBar" name="progressBar">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>350</width>
+ <height>50</height>
+ </size>
+ </property>
+ <property name="value">
+ <number>24</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QTextEdit" name="Search">
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>30</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="beforePeriodLabel_">
+ <property name="text">
+ <string>Before</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="afterPeriodLabel_">
+ <property name="text">
+ <string>After</string>
</property>
</widget>
- <widget class="QWidget" name="gridLayoutWidget_2">
- <property name="geometry">
- <rect>
- <x>20</x>
- <y>20</y>
- <width>581</width>
- <height>471</height>
- </rect>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QSlider" name="periodPickerBefore_">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
</property>
- <layout class="QGridLayout" name="chatView_"/>
</widget>
- <widget class="QWidget" name="gridLayoutWidget_3">
- <property name="geometry">
- <rect>
- <x>20</x>
- <y>500</y>
- <width>841</width>
- <height>61</height>
- </rect>
+ </item>
+ <item>
+ <widget class="QDateEdit" name="dateEdit">
+ <property name="calendarPopup">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="periodPickerAfter_">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pushButton">
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>50</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Search</string>
</property>
- <layout class="QGridLayout" name="gridLayout_4">
- <item row="1" column="0">
- <widget class="QWidget" name="widget_3" native="true">
- <widget class="QTextEdit" name="textEdit_3">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>20</y>
- <width>841</width>
- <height>31</height>
- </rect>
- </property>
- </widget>
- <widget class="QLabel" name="label_3">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>131</width>
- <height>17</height>
- </rect>
- </property>
- <property name="text">
- <string>Search keywords:</string>
- </property>
- </widget>
- <widget class="QScrollBar" name="horizontalScrollBar_2">
- <property name="geometry">
- <rect>
- <x>490</x>
- <y>0</y>
- <width>160</width>
- <height>16</height>
- </rect>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- <widget class="QLabel" name="label_4">
- <property name="geometry">
- <rect>
- <x>410</x>
- <y>0</y>
- <width>61</width>
- <height>16</height>
- </rect>
- </property>
- <property name="text">
- <string>Today</string>
- </property>
- </widget>
- </widget>
- </item>
- </layout>
</widget>
- </widget>
- </item>
- </layout>
- </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
</widget>
<resources/>
<connections/>