UI: ProgramEdit: Tweak layout

This commit is contained in:
Nodir Temirkhodjaev 2024-03-30 16:21:18 +03:00
parent 973551596c
commit 30f2255a09
2 changed files with 32 additions and 32 deletions

View File

@ -330,6 +330,9 @@ QLayout *ProgramEditDialog::setupMainLayout()
setupActionsGroup(); setupActionsGroup();
// Zones
auto zonesRulesLayout = setupZonesRulesLayout();
// Schedule // Schedule
auto scheduleLayout = setupScheduleLayout(); auto scheduleLayout = setupScheduleLayout();
@ -345,6 +348,8 @@ QLayout *ProgramEditDialog::setupMainLayout()
layout->addWidget(ControlUtil::createSeparator()); layout->addWidget(ControlUtil::createSeparator());
layout->addStretch(); layout->addStretch();
layout->addLayout(actionsLayout); layout->addLayout(actionsLayout);
layout->addWidget(ControlUtil::createHSeparator());
layout->addLayout(zonesRulesLayout);
layout->addWidget(ControlUtil::createSeparator()); layout->addWidget(ControlUtil::createSeparator());
layout->addLayout(scheduleLayout); layout->addLayout(scheduleLayout);
layout->addStretch(); layout->addStretch();
@ -496,22 +501,26 @@ void ProgramEditDialog::setupAdvancedOptions()
// Use Group Perm. // Use Group Perm.
m_cbUseGroupPerm = new QCheckBox(); m_cbUseGroupPerm = new QCheckBox();
// Parked
m_cbParked = new QCheckBox();
m_cbParked->setIcon(IconCache::icon(":/icons/parking.png"));
// Child Options // Child Options
auto childLayout = setupChildLayout(); setupChildOptions();
// Log // Log Options
auto logLayout = setupLogLayout(); setupLogOptions();
// Zones auto layout = ControlUtil::createVLayoutByWidgets({
auto zonesLayout = setupZonesLayout(); m_cbUseGroupPerm,
m_cbParked,
auto layout = new QVBoxLayout(); ControlUtil::createHSeparator(),
layout->addWidget(m_cbUseGroupPerm); m_cbApplyChild,
layout->addLayout(childLayout); m_cbKillChild,
layout->addWidget(ControlUtil::createHSeparator()); ControlUtil::createHSeparator(),
layout->addLayout(logLayout); m_cbLogBlocked,
layout->addWidget(ControlUtil::createHSeparator()); m_cbLogConn,
layout->addLayout(zonesLayout); });
auto menu = ControlUtil::createMenuByLayout(layout, this); auto menu = ControlUtil::createMenuByLayout(layout, this);
@ -520,43 +529,33 @@ void ProgramEditDialog::setupAdvancedOptions()
m_btOptions->setMenu(menu); m_btOptions->setMenu(menu);
} }
QLayout *ProgramEditDialog::setupChildLayout() void ProgramEditDialog::setupChildOptions()
{ {
// Apply Child // Apply Child
m_cbApplyChild = new QCheckBox(); m_cbApplyChild = new QCheckBox();
// Kill Child // Kill Child
m_cbKillChild = new QCheckBox(); m_cbKillChild = new QCheckBox();
m_cbKillChild->setIcon(IconCache::icon(":/icons/scull.png"));
connect(m_cbKillChild, &QCheckBox::clicked, this, &ProgramEditDialog::warnDangerousOption); connect(m_cbKillChild, &QCheckBox::clicked, this, &ProgramEditDialog::warnDangerousOption);
auto layout = ControlUtil::createHLayoutByWidgets(
{ m_cbApplyChild, ControlUtil::createVSeparator(), m_cbKillChild });
return layout;
} }
QLayout *ProgramEditDialog::setupLogLayout() void ProgramEditDialog::setupLogOptions()
{ {
// Parked
m_cbParked = new QCheckBox();
// Log Blocked // Log Blocked
m_cbLogBlocked = new QCheckBox(); m_cbLogBlocked = new QCheckBox();
// Log Conn // Log Conn
m_cbLogConn = new QCheckBox(); m_cbLogConn = new QCheckBox();
m_cbLogConn->setVisible(false); // TODO: Collect allowed connections m_cbLogConn->setVisible(false); // TODO: Collect allowed connections
auto layout = ControlUtil::createHLayoutByWidgets({ m_cbParked, ControlUtil::createVSeparator(),
m_cbLogBlocked, m_cbLogConn, /*stretch*/ nullptr });
return layout;
} }
QLayout *ProgramEditDialog::setupZonesLayout() QLayout *ProgramEditDialog::setupZonesRulesLayout()
{ {
// LAN Only // LAN Only
m_cbLanOnly = new QCheckBox(); m_cbLanOnly = new QCheckBox();
m_cbLanOnly->setIcon(IconCache::icon(":/icons/hostname.png"));
// Zones // Zones
m_btZones = new ZonesSelector(); m_btZones = new ZonesSelector();
@ -599,6 +598,7 @@ QLayout *ProgramEditDialog::setupScheduleLayout()
void ProgramEditDialog::setupCbSchedule() void ProgramEditDialog::setupCbSchedule()
{ {
m_cbSchedule = new QCheckBox(); m_cbSchedule = new QCheckBox();
m_cbSchedule->setIcon(IconCache::icon(":/icons/time.png"));
const auto refreshScheduleEnabled = [&](bool checked) { const auto refreshScheduleEnabled = [&](bool checked) {
m_comboScheduleAction->setEnabled(checked); m_comboScheduleAction->setEnabled(checked);

View File

@ -78,9 +78,9 @@ private:
QLayout *setupActionsLayout(); QLayout *setupActionsLayout();
void setupActionsGroup(); void setupActionsGroup();
void setupAdvancedOptions(); void setupAdvancedOptions();
QLayout *setupChildLayout(); void setupChildOptions();
QLayout *setupLogLayout(); void setupLogOptions();
QLayout *setupZonesLayout(); QLayout *setupZonesRulesLayout();
QLayout *setupScheduleLayout(); QLayout *setupScheduleLayout();
void setupCbSchedule(); void setupCbSchedule();
void setupComboScheduleType(); void setupComboScheduleType();