mirror of
https://github.com/tnodir/fort
synced 2024-11-15 10:35:10 +00:00
UI: ZonesWindow: Add "Update Zones" button
This commit is contained in:
parent
fbc2d818da
commit
58be45bc61
@ -133,6 +133,7 @@ void ZonesWindow::onRetranslateUi()
|
|||||||
m_actEditZone->setText(tr("Edit"));
|
m_actEditZone->setText(tr("Edit"));
|
||||||
m_actRemoveZone->setText(tr("Remove"));
|
m_actRemoveZone->setText(tr("Remove"));
|
||||||
m_btSaveAsText->setText(tr("Save As Text"));
|
m_btSaveAsText->setText(tr("Save As Text"));
|
||||||
|
m_btUpdateZones->setText(tr("Update Zones"));
|
||||||
|
|
||||||
m_formZoneEdit->unsetLocale();
|
m_formZoneEdit->unsetLocale();
|
||||||
m_formZoneEdit->setWindowTitle(tr("Edit Zone"));
|
m_formZoneEdit->setWindowTitle(tr("Edit Zone"));
|
||||||
@ -368,6 +369,26 @@ QLayout *ZonesWindow::setupHeader()
|
|||||||
m_btEdit->setMenu(editMenu);
|
m_btEdit->setMenu(editMenu);
|
||||||
|
|
||||||
// Save As Text
|
// Save As Text
|
||||||
|
setupSaveAsText();
|
||||||
|
|
||||||
|
// Run Task
|
||||||
|
setupTaskRun();
|
||||||
|
|
||||||
|
// Menu button
|
||||||
|
m_btMenu = windowManager()->createMenuButton();
|
||||||
|
|
||||||
|
layout->addWidget(m_btEdit);
|
||||||
|
layout->addWidget(m_btSaveAsText);
|
||||||
|
layout->addWidget(ControlUtil::createSeparator(Qt::Vertical));
|
||||||
|
layout->addWidget(m_btUpdateZones);
|
||||||
|
layout->addStretch();
|
||||||
|
layout->addWidget(m_btMenu);
|
||||||
|
|
||||||
|
return layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ZonesWindow::setupSaveAsText()
|
||||||
|
{
|
||||||
m_btSaveAsText = ControlUtil::createButton(":/icons/save_as.png", [&] {
|
m_btSaveAsText = ControlUtil::createButton(":/icons/save_as.png", [&] {
|
||||||
const auto filePath = DialogUtil::getSaveFileName(
|
const auto filePath = DialogUtil::getSaveFileName(
|
||||||
m_btSaveAsText->text(), tr("Text files (*.txt);;All files (*.*)"));
|
m_btSaveAsText->text(), tr("Text files (*.txt);;All files (*.*)"));
|
||||||
@ -380,16 +401,12 @@ QLayout *ZonesWindow::setupHeader()
|
|||||||
windowManager()->showErrorBox(tr("Cannot save Zone addresses as text file"));
|
windowManager()->showErrorBox(tr("Cannot save Zone addresses as text file"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Menu button
|
void ZonesWindow::setupTaskRun()
|
||||||
m_btMenu = windowManager()->createMenuButton();
|
{
|
||||||
|
m_btUpdateZones = ControlUtil::createButton(
|
||||||
layout->addWidget(m_btEdit);
|
":/icons/play.png", [&] { taskManager()->runTask(TaskInfo::ZoneDownloader); });
|
||||||
layout->addWidget(m_btSaveAsText);
|
|
||||||
layout->addStretch();
|
|
||||||
layout->addWidget(m_btMenu);
|
|
||||||
|
|
||||||
return layout;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZonesWindow::setupTableZones()
|
void ZonesWindow::setupTableZones()
|
||||||
|
@ -62,6 +62,8 @@ private:
|
|||||||
QLayout *setupZoneEditTextLayout();
|
QLayout *setupZoneEditTextLayout();
|
||||||
QLayout *setupZoneEditButtons();
|
QLayout *setupZoneEditButtons();
|
||||||
QLayout *setupHeader();
|
QLayout *setupHeader();
|
||||||
|
void setupSaveAsText();
|
||||||
|
void setupTaskRun();
|
||||||
void setupTableZones();
|
void setupTableZones();
|
||||||
void setupTableZonesHeader();
|
void setupTableZonesHeader();
|
||||||
void setupTableZonesChanged();
|
void setupTableZonesChanged();
|
||||||
@ -94,6 +96,7 @@ private:
|
|||||||
QAction *m_actEditZone = nullptr;
|
QAction *m_actEditZone = nullptr;
|
||||||
QAction *m_actRemoveZone = nullptr;
|
QAction *m_actRemoveZone = nullptr;
|
||||||
QPushButton *m_btSaveAsText = nullptr;
|
QPushButton *m_btSaveAsText = nullptr;
|
||||||
|
QPushButton *m_btUpdateZones = nullptr;
|
||||||
QPushButton *m_btMenu = nullptr;
|
QPushButton *m_btMenu = nullptr;
|
||||||
QLabel *m_labelZoneName = nullptr;
|
QLabel *m_labelZoneName = nullptr;
|
||||||
QLineEdit *m_editZoneName = nullptr;
|
QLineEdit *m_editZoneName = nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user