This repository has been archived by the owner on Sep 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
DockThreadsPool.cpp
61 lines (54 loc) · 2.28 KB
/
DockThreadsPool.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/***************************************************************************//**
* @brief Thumbnail me 3.0
* Thumbnail me is a user interface for Movie thumbnailer.
* Generate thumbnails from any movie is now easier !
*
* @file DockThreadsPool.h
* @class DockThreadsPool
* Cette classe permet la de voir les threads actifs
*
* @author Quentin Rousseau\n
* @note Copyright (C) 2011-2012 Quentin Rousseau\n
* License: GNU General Public License version 2 (GPLv2) - http://www.gnu.org/licenses/gpl-2.0.html\n
* Site web: www.thumbnailme.com\n
* Email: [email protected]
*
* @since 3.5
* @version 3.5
* @date 2011-2012
*******************************************************************************/
#include <QApplication>
#include <QDesktopWidget>
#include "DockThreadsPool.h"
#include "ThumbnailTreeItem.h"
#include <QHeaderView>
#include "MainWindow.h"
DockThreadsPool::DockThreadsPool(QWidget *main_window) : QDockWidget(main_window)
{
this->main_window = (MainWindow*) main_window;
this->setMinimumWidth(QApplication::desktop()->screenGeometry(QApplication::desktop()->primaryScreen()).width()/4);
this->setObjectName("DockThreadsPool");
this->setWindowTitle("Tasks");
treeWidget = new QTreeWidget(this);
treeWidget->setColumnCount(2);
treeWidget->setHeaderLabels(QStringList() << tr("Path") << tr("State"));
treeWidget->header()->resizeSection(0,this->width()*2/3);
treeWidget->header()->resizeSection(1,this->width()/3);
this->setWidget(treeWidget);
}
void DockThreadsPool::addThumbnailItem(ThumbnailItem* item)
{
ThumbnailTreeItem *three_item = new ThumbnailTreeItem(item);
three_item->setThreadStatus(tr("QUEUED"));
this->treeWidget->addTopLevelItem(three_item);
}
void DockThreadsPool::threadStarted(ThumbnailItem* item)
{
QList<QTreeWidgetItem*> itemFound = this->treeWidget->findItems(item->getFilePath().toString(),Qt::MatchExactly);
((ThumbnailTreeItem*) itemFound.last())->setThreadStatus(tr("STARTED"));
}
void DockThreadsPool::threadFinished(ThumbnailItem* item)
{
QList<QTreeWidgetItem*> itemFound = this->treeWidget->findItems(item->getFilePath().toString(),Qt::MatchExactly);
((ThumbnailTreeItem*) itemFound.last())->setThreadStatus(tr("FINISHED"));
}