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

update_dialog.hpp « qt - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1e1291d20793496a1c4607203a88f4257bc753ad (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
#pragma once

#include "map/framework.hpp"

#include "std/unordered_map.hpp"
#include "std/vector.hpp"

#include <QtWidgets/QApplication>
#include <QtWidgets/QDialog>

class QTreeWidget;
class QTreeWidgetItem;
class QLabel;
class QPushButton;

class Framework;

namespace qt
{
  class UpdateDialog : public QDialog
  {
    Q_OBJECT

  public:
    explicit UpdateDialog(QWidget * parent, Framework & framework);
    virtual ~UpdateDialog();

    /// @name Called from downloader to notify GUI
    //@{
    void OnCountryChanged(storage::CountryId const & countryId);
    void OnCountryDownloadProgress(storage::CountryId const & countryId,
                                   storage::MapFilesDownloader::Progress const & progress);
    //@}

    void ShowModal();

  private slots:
    void OnItemClick(QTreeWidgetItem * item, int column);
    void OnCloseClick();
    void OnTextChanged(QString const & text);

  private:
    void FillTree(string const & filter);
    void FillTreeImpl(QTreeWidgetItem * parent, storage::CountryId const & countryId,
                      string const & filter);
    void UpdateRowWithCountryInfo(storage::CountryId const & countryId);
    void UpdateRowWithCountryInfo(QTreeWidgetItem * item, storage::CountryId const & countryId);
    QString GetNodeName(storage::CountryId const & countryId);

    QTreeWidgetItem * CreateTreeItem(storage::CountryId const & countryId,
                                     QTreeWidgetItem * parent);
    vector<QTreeWidgetItem *> GetTreeItemsByCountryId(storage::CountryId const & countryId);
    storage::CountryId GetCountryIdByTreeItem(QTreeWidgetItem *);

  private:
    inline storage::Storage & GetStorage() const { return m_framework.GetStorage(); }

    QTreeWidget * m_tree;
    Framework & m_framework;
    int m_observerSlotId;

    unordered_multimap<storage::CountryId, QTreeWidgetItem *> m_treeItemByCountryId;
  };
} // namespace qt