summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtViewHistoryWindow.cpp')
-rw-r--r--Swift/QtUI/QtViewHistoryWindow.cpp57
1 files changed, 56 insertions, 1 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);
+}
+
}