Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'qt/mwms_borders_selection.cpp')
-rw-r--r--qt/mwms_borders_selection.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/qt/mwms_borders_selection.cpp b/qt/mwms_borders_selection.cpp
new file mode 100644
index 0000000000..714327cc9e
--- /dev/null
+++ b/qt/mwms_borders_selection.cpp
@@ -0,0 +1,54 @@
+#include "qt/mwms_borders_selection.hpp"
+
+#include "base/assert.hpp"
+
+#include <QtWidgets/QDialogButtonBox>
+#include <QtWidgets/QRadioButton>
+#include <QtWidgets/QVBoxLayout>
+
+namespace qt
+{
+MwmsBordersSelection::MwmsBordersSelection(QWidget * parent)
+ : QDialog(parent),
+ m_form(this)
+{
+ setWindowTitle("Mwms borders selection settings");
+
+ m_radioWithPoints = new QRadioButton(tr("Show borders with points."));
+ m_radioJustBorders = new QRadioButton(tr("Show just borders."));
+
+ m_radioJustBorders->setChecked(true);
+
+ auto * vbox = new QVBoxLayout;
+ vbox->addWidget(m_radioWithPoints);
+ vbox->addWidget(m_radioJustBorders);
+
+ m_form.addRow(vbox);
+ AddButtonBox();
+}
+
+void MwmsBordersSelection::AddButtonBox()
+{
+ auto * buttonBox =
+ new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
+
+ m_form.addRow(buttonBox);
+
+ QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+ QObject::connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+}
+
+MwmsBordersSelection::Response MwmsBordersSelection::ShowModal()
+{
+ if (exec() != QDialog::Accepted)
+ return Response::Canceled;
+
+ if (m_radioJustBorders->isChecked())
+ return Response::JustBorders;
+
+ if (m_radioWithPoints->isChecked())
+ return Response::WithPointsAndBorders;
+
+ UNREACHABLE();
+}
+} // namespace qt