Debian Codegraph @

src/HistoryPanel/HistoryWidget.cpp

raw symbols SCIP
1 /*
2 * Copyright 2014 Mihai Niculescu <[email protected]>
3 *
4 * This file is part of EqualX Project (https://launchpad.net/equalx/)
5 *
6 * EqualX is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * EqualX is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include <QDebug>
21 #include <QStandardItemModel>
22
23 #include "Library/Library.h"
24 #include "HistoryPanel/HistoryWidget.h"
25 #include "HistoryPanel/HistoryListModel.h"
26
27
28 #include "ui_HistoryWidget.h"
29
30
31 HistoryWidget::HistoryWidget(QWidget *parent) :
32 QWidget(parent),
33 ui(new Ui::HistoryWidget)
34 {
35 ui->setupUi(this);
36
37 LibraryManager* lib = LibraryManager::Instance();
38
39 mModel = new HistoryListModel(lib);
40
41 ui->listView->setModel(mModel);
42
43 setWindowTitle("History");
44
45 connect(ui->listView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onViewItemActivated(QModelIndex)) );
46 }
47
48 HistoryWidget::~HistoryWidget()
49 {
50 delete ui;
51 mModel->deleteLater();
52 }
53
54 void HistoryWidget::onViewItemActivated(QModelIndex index)
55 {
56 LibraryModelData row = qvariant_cast<LibraryModelData>(index.data(Qt::DisplayRole));
57
58 emit activated(row);
59 }