mirror of
https://github.com/tnodir/fort
synced 2024-11-15 07:57:24 +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_actRemoveZone->setText(tr("Remove"));
|
||||
m_btSaveAsText->setText(tr("Save As Text"));
|
||||
m_btUpdateZones->setText(tr("Update Zones"));
|
||||
|
||||
m_formZoneEdit->unsetLocale();
|
||||
m_formZoneEdit->setWindowTitle(tr("Edit Zone"));
|
||||
@ -368,6 +369,26 @@ QLayout *ZonesWindow::setupHeader()
|
||||
m_btEdit->setMenu(editMenu);
|
||||
|
||||
// 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", [&] {
|
||||
const auto filePath = DialogUtil::getSaveFileName(
|
||||
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"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Menu button
|
||||
m_btMenu = windowManager()->createMenuButton();
|
||||
|
||||
layout->addWidget(m_btEdit);
|
||||
layout->addWidget(m_btSaveAsText);
|
||||
layout->addStretch();
|
||||
layout->addWidget(m_btMenu);
|
||||
|
||||
return layout;
|
||||
void ZonesWindow::setupTaskRun()
|
||||
{
|
||||
m_btUpdateZones = ControlUtil::createButton(
|
||||
":/icons/play.png", [&] { taskManager()->runTask(TaskInfo::ZoneDownloader); });
|
||||
}
|
||||
|
||||
void ZonesWindow::setupTableZones()
|
||||
|
@ -62,6 +62,8 @@ private:
|
||||
QLayout *setupZoneEditTextLayout();
|
||||
QLayout *setupZoneEditButtons();
|
||||
QLayout *setupHeader();
|
||||
void setupSaveAsText();
|
||||
void setupTaskRun();
|
||||
void setupTableZones();
|
||||
void setupTableZonesHeader();
|
||||
void setupTableZonesChanged();
|
||||
@ -94,6 +96,7 @@ private:
|
||||
QAction *m_actEditZone = nullptr;
|
||||
QAction *m_actRemoveZone = nullptr;
|
||||
QPushButton *m_btSaveAsText = nullptr;
|
||||
QPushButton *m_btUpdateZones = nullptr;
|
||||
QPushButton *m_btMenu = nullptr;
|
||||
QLabel *m_labelZoneName = nullptr;
|
||||
QLineEdit *m_editZoneName = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user