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

mwms_borders_selection.cpp « qt - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 714327cc9e09f19f3f7e090f54bf0e09dccb167f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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