-
Notifications
You must be signed in to change notification settings - Fork 0
/
controller.cpp
53 lines (41 loc) · 1.3 KB
/
controller.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
#include <QDebug>
#include "controller.h"
Controller::Controller()
{
m_encodingManager = new EncodingManager(this);
m_ui = new MainWindow();
m_ui->show();
connect(m_encodingManager, SIGNAL(convertingFile(QString)), m_ui, SLOT(addConvertingFile(QString)));
connect(m_encodingManager, SIGNAL(completedFile(QString)), m_ui, SLOT(moveFromConvertingToCompleted(QString)));
connect(m_ui, SIGNAL(startClicked()), this, SLOT(startClicked()));
connect(m_ui, SIGNAL(newInputFilesAdded(QStringList)), this, SLOT(newInputFilesAdded(QStringList)));
connect(m_ui, SIGNAL(consumptionLevelChanged()), this, SLOT(consumptionLevelChanged()));
}
void Controller::consumptionLevelChanged()
{
if (m_encodingManager->isRunning())
m_encodingManager->dispatch();
}
ConsumptionLevel Controller::getConsumptionLevel()
{
return m_ui->getConsumptionLevel();
}
void Controller::newInputFilesAdded(QStringList filenames)
{
//TBD - Check for valid files
m_ui->addInputFiles(filenames);
if (m_encodingManager->isRunning())
m_encodingManager->dispatch();
}
void Controller::startClicked()
{
m_encodingManager->start();
}
QString Controller::takeTopInputFile()
{
return m_ui->takeTopInputFile();
}
bool Controller::hasInputFiles()
{
return m_ui->hasInputFiles();
}