Add Setting and Status
[QFreeRecite.git] / src / gui / MainWidget.cpp
blob4ed7eecab106fb5913861f7d57794e671de87779
1 #include <QHeaderView>
2 #include <QModelIndex>
3 #include <Reciter.h>
4 #include <fstream>
5 #include <set>
7 #include "MainWidget.h"
8 #include "TaskModel.h"
10 MainWidget::MainWidget(QWidget *parent)
11 : QWidget(parent),taskModel(0)
13 setupUi(this);
14 setWindowFlags(Qt::FramelessWindowHint);
15 webView->load(QUrl("http://www.kermit-mei.info/freerecite"));
16 taskModel = new TaskModel(this);
17 taskTableView->setModel(taskModel);
18 taskTableView->setSelectionBehavior(QAbstractItemView::SelectRows);
19 taskTableView->setSelectionMode(QAbstractItemView::SingleSelection);
20 taskTableView->setShowGrid(false);
21 taskTableView->resizeColumnsToContents();
22 taskTableView->setAlternatingRowColors(true);
23 taskTableView->horizontalHeader()->setStretchLastSection(true);
24 if(taskModel->rowCount() > 0)
25 taskTableView->setCurrentIndex(taskModel->index(0,0));
28 MainWidget::~MainWidget() {
32 time_t MainWidget::getCurrentTaskID() const {
33 QModelIndex currIndex = taskTableView->selectionModel()->currentIndex();
34 return taskModel->getTaskID(currIndex);
37 void MainWidget::updateMode() {
38 taskModel->updateMode();