-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDatabaseViewer.cpp
44 lines (37 loc) · 1 KB
/
DatabaseViewer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* DatabaseViewer.cpp
*
* Created on: Feb 2, 2013
* Author: vincent
*/
#include "DatabaseViewer.h"
#include "Utility.h"
#include <QWebFrame>
DatabaseViewer::DatabaseViewer(QWidget *parent) :
QDialog(parent) {
ui.setupUi(this);
}
DatabaseViewer::~DatabaseViewer() {
}
void DatabaseViewer::on_refreshButton_clicked() {
loadList();
}
void DatabaseViewer::loadList() {
pageList = Utility::getInstance()->getPageList();
ui.pageList->clear();
for (int i = 0; i < pageList.size(); ++i) {
QListWidgetItem *item = new QListWidgetItem;
item->setData(Qt::DisplayRole, pageList[i].getUrl());
item->setData(Qt::UserRole, i);
ui.pageList->addItem(item);
}
}
void DatabaseViewer::on_pageList_currentItemChanged(QListWidgetItem * current,
QListWidgetItem *) {
ui.textBrowser->setPlainText(
pageList[current->data(Qt::UserRole).toInt()].getHtml());
}
void DatabaseViewer::on_lineWrapCheck_clicked(bool wrap) {
ui.textBrowser->setLineWrapMode(
wrap ? QTextEdit::WidgetWidth : QTextEdit::NoWrap);
}