2024-10-06 00:31:31 +01:00
|
|
|
#include "Presenter.hpp"
|
|
|
|
|
|
|
|
#include "Model.hpp"
|
|
|
|
#include "View.hpp"
|
|
|
|
|
|
|
|
#include <score/command/Command.hpp>
|
|
|
|
#include <score/command/Dispatchers/ICommandDispatcher.hpp>
|
|
|
|
#include <score/command/SettingsCommand.hpp>
|
|
|
|
#include <score/widgets/SetIcons.hpp>
|
|
|
|
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QStyle>
|
|
|
|
|
|
|
|
namespace Hardware
|
|
|
|
{
|
|
|
|
namespace Settings
|
|
|
|
{
|
|
|
|
Presenter::Presenter(Model& m, View& v, QObject* parent)
|
|
|
|
: score::GlobalSettingsPresenter{m, v, parent}
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// view -> model
|
2024-12-13 00:10:19 +00:00
|
|
|
con(v, &View::deviceChanged, this, [&](auto val) {
|
|
|
|
if (val != m.getDevice())
|
2024-10-06 00:31:31 +01:00
|
|
|
{
|
2024-12-13 00:10:19 +00:00
|
|
|
m_disp.submit<SetModelDevice>(this->model(this), val);
|
2024-10-06 00:31:31 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// model -> view
|
2024-12-13 00:10:19 +00:00
|
|
|
con(m, &Model::DeviceChanged, &v, &View::setDevice);
|
2024-10-06 00:31:31 +01:00
|
|
|
|
|
|
|
// initial value
|
2024-12-13 00:10:19 +00:00
|
|
|
v.setDevice(m.getDevice());
|
2024-10-06 00:31:31 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Presenter::settingsName()
|
|
|
|
{
|
|
|
|
return tr("Hardware");
|
|
|
|
}
|
|
|
|
|
|
|
|
QIcon Presenter::settingsIcon()
|
|
|
|
{
|
|
|
|
return makeIcons(
|
|
|
|
QStringLiteral(":/icons/settings_remote_control_on.png"),
|
|
|
|
QStringLiteral(":/icons/settings_remote_control_off.png"),
|
|
|
|
QStringLiteral(":/icons/settings_remote_control_off.png"));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|