replace Arecord with Qtmultimedia (requiers pulse?)
This commit is contained in:
36
main.cpp
36
main.cpp
@ -11,11 +11,13 @@
|
||||
#include <QCommandLineParser>
|
||||
|
||||
|
||||
|
||||
#include "alarmtime.h"
|
||||
#include "microcontroller.h"
|
||||
#include "mainwindow.h"
|
||||
#include "relaydialog.h"
|
||||
#include "ampmanager.h"
|
||||
#include "power.h"
|
||||
|
||||
#define BAUD QSerialPort::Baud38400
|
||||
|
||||
@ -46,12 +48,14 @@ int main(int argc, char *argv[])
|
||||
parser.addOption(serialOption);
|
||||
QCommandLineOption baudOption(QStringList() << "b" << "baud", QCoreApplication::translate("main", "Set Baud Rate"));
|
||||
parser.addOption(baudOption);
|
||||
QCommandLineOption secondaryOption(QStringList() << "s" << "secondary", QCoreApplication::translate("main", "Set if instance is not main instance"));
|
||||
QCommandLineOption secondaryOption(QStringList() << "e" << "secondary", QCoreApplication::translate("main", "Set if instance is not main instance"));
|
||||
parser.addOption(secondaryOption);
|
||||
parser.process(a);
|
||||
|
||||
QSettings settings;
|
||||
|
||||
|
||||
|
||||
//connect to microcontoler
|
||||
Microcontroller micro;
|
||||
if(parser.isSet(tcpOption))
|
||||
@ -85,23 +89,35 @@ int main(int argc, char *argv[])
|
||||
else micro.setIODevice(microPort);
|
||||
}
|
||||
|
||||
AmpManager amp(µ, 0);
|
||||
Power power(&settings, µ);
|
||||
|
||||
|
||||
|
||||
|
||||
AmpManager amp(µ, 0, QAudioDeviceInfo::defaultInputDevice());
|
||||
|
||||
MainWindow w(&settings, µ, parser.isSet(secondaryOption));
|
||||
QObject::connect(µ, SIGNAL(textRecived(QString)), &w, SLOT(changeHeaderLableText(QString)));
|
||||
QObject::connect(µ, SIGNAL(relayStateChanged(std::vector<bool>)), &w, SLOT(relayStateChanged(std::vector<bool>)));
|
||||
|
||||
RelayDialog relayDialog(µ);
|
||||
QObject::connect(µ, SIGNAL(relayStateChanged(std::vector<bool>)), &relayDialog, SLOT(relayStateChanged(std::vector<bool>)));
|
||||
|
||||
//Alarms
|
||||
AlarmTime almNight(settings.value("nightTime").toTime());
|
||||
|
||||
AlarmTime *almAlarm = new AlarmTime(settings.value("alarmTime").toTime());
|
||||
QSignalMapper signalMapper;
|
||||
|
||||
if(!parser.isSet(secondaryOption))
|
||||
{
|
||||
//Alarms
|
||||
AlarmTime almNight(settings.value("nightTime").toTime());
|
||||
QObject::connect(&almNight, SIGNAL(trigger()), &w, SLOT(slotSyncoff()));
|
||||
|
||||
QObject::connect(&almNight, SIGNAL(trigger()), &power, SLOT(syncoff()));
|
||||
QObject::connect(&w, SIGNAL(signalAlmNightChanged(QTime)), &almNight, SLOT(changeTime(QTime)));
|
||||
QObject::connect(&w, SIGNAL(signalAlmNightStateChanged(int)), &almNight, SLOT(runOrAbort(int)));
|
||||
//QMetaObject::invokeMethod(&almNight, "run", Qt::QueuedConnection );
|
||||
|
||||
AlarmTime *almAlarm = new AlarmTime(settings.value("alarmTime").toTime());
|
||||
QSignalMapper signalMapper;
|
||||
|
||||
QObject::connect(almAlarm, SIGNAL(trigger()), &signalMapper, SLOT(map()));
|
||||
signalMapper.setMapping(almAlarm, 4);
|
||||
QObject::connect(&signalMapper, SIGNAL(mapped(int)), µ, SLOT(setPattern(int)));
|
||||
@ -115,13 +131,11 @@ int main(int argc, char *argv[])
|
||||
QMetaObject::invokeMethod(&, "run", Qt::QueuedConnection );
|
||||
}
|
||||
|
||||
//serial display
|
||||
QObject::connect(µ, SIGNAL(textRecived(QString)), &w, SLOT(changeHeaderLableText(QString)));
|
||||
QMetaObject::invokeMethod(µ, "run", Qt::QueuedConnection );
|
||||
|
||||
//Advanced Relays
|
||||
QObject::connect(&w, SIGNAL(showAdvRelayDialog()), &relayDialog, SLOT(show()));
|
||||
|
||||
QMetaObject::invokeMethod(µ, "run", Qt::QueuedConnection );
|
||||
|
||||
QMetaObject::invokeMethod(&w, "postActivate", Qt::QueuedConnection );
|
||||
w.show();
|
||||
|
||||
|
Reference in New Issue
Block a user