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

mainwindow.hpp « qt - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2ea03849ef63d6942d89e53fa66499ffab5662da (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#pragma once

#include "qt/draw_widget.hpp"

#include "storage/index.hpp"

#include "platform/location.hpp"
#include "platform/location_service.hpp"

#include "std/array.hpp"
#include "std/unique_ptr.hpp"

#include <QtWidgets/QApplication>
#include <QtWidgets/QMainWindow>

class Framework;
class QDockWidget;
class QLabel;
class QPushButton;
class QToolButton;
class TrafficMode;

namespace search { class Result; }

namespace qt
{
class MainWindow : public QMainWindow, location::LocationObserver
{
  QAction * m_pMyPositionAction;
  QAction * m_pCreateFeatureAction;
  QAction * m_selectionMode;
  QAction * m_clearSelection;
  QAction * m_pSearchAction;
  QAction * m_trafficEnableAction;
  QAction * m_saveTrafficSampleAction;
  QAction * m_quitTrafficModeAction;
  QToolButton * m_routePointsToolButton;
  QAction * m_selectStartRoutePoint;
  QAction * m_selectFinishRoutePoint;
  QAction * m_selectIntermediateRoutePoint;
  DrawWidget * m_pDrawWidget;

  // TODO(mgsergio): Make indexing more informative.
  array<QDockWidget *, 2> m_Docks;

  QPushButton * m_downloadButton;
  QPushButton * m_retryButton;
  QLabel * m_downloadingStatusLabel;
  storage::TCountryId m_lastCountry;

  unique_ptr<location::LocationService> const m_locationService;

  // This object is managed by Qt memory system.
  TrafficMode * m_trafficMode = nullptr;

  Q_OBJECT

public:
  MainWindow(Framework & framework, bool apiOpenGLES3);

  virtual void OnLocationError(location::TLocationError errorCode);
  virtual void OnLocationUpdated(location::GpsInfo const & info);

  static void SetDefaultSurfaceFormat(bool apiOpenGLES3);

protected:
  string GetIniFile();

  void LocationStateModeChanged(location::EMyPositionMode mode);

protected:
  void CreatePanelImpl(size_t i, Qt::DockWidgetArea area, QString const & name,
                       QKeySequence const & hotkey, char const * slot);
  void CreateNavigationBar();
  void CreateSearchBarAndPanel();
  void CreateCountryStatusControls();

  void CreateTrafficPanel(string const & dataFilePath, string const & sampleFilePath);
  void DestroyTrafficPanel();

#if defined(Q_WS_WIN)
  /// to handle menu messages
  virtual bool winEvent(MSG * msg, long * result);
#endif

  virtual void closeEvent(QCloseEvent * e);

protected Q_SLOTS:
#ifndef NO_DOWNLOADER
  void ShowUpdateDialog();
#endif // NO_DOWNLOADER

  void OnPreferences();
  void OnAbout();
  void OnMyPosition();
  void OnCreateFeatureClicked();
  void OnSearchButtonClicked();
  void OnLoginMenuItem();
  void OnUploadEditsMenuItem();

  void OnBeforeEngineCreation();

  void OnDownloadClicked();
  void OnRetryDownloadClicked();

  void OnSwitchSelectionMode();
  void OnClearSelection();

  void OnTrafficEnabled();
  void OnOpenTrafficSample();
  void OnSaveTrafficSample();
  void OnQuitTrafficMode();

  void OnStartPointSelected();
  void OnFinishPointSelected();
  void OnIntermediatePointSelected();
  void OnFollowRoute();
  void OnClearRoute();
};
}