forked from organicmaps/organicmaps
Download Dialog now saves it's state after closing
This commit is contained in:
parent
9b164728dc
commit
58b0bd4baf
4 changed files with 25 additions and 18 deletions
|
@ -27,9 +27,9 @@
|
|||
namespace qt
|
||||
{
|
||||
|
||||
MainWindow::MainWindow()
|
||||
MainWindow::MainWindow() : m_updateDialog(0)
|
||||
{
|
||||
m_pDrawWidget = new DrawWidget(this, m_Storage);
|
||||
m_pDrawWidget = new DrawWidget(this, m_storage);
|
||||
|
||||
CreateNavigationBar();
|
||||
|
||||
|
@ -206,8 +206,11 @@ void MainWindow::CreateNavigationBar()
|
|||
|
||||
void MainWindow::ShowUpdateDialog()
|
||||
{
|
||||
UpdateDialog dlg(this, m_Storage);
|
||||
dlg.exec();
|
||||
if (!m_updateDialog)
|
||||
m_updateDialog = new UpdateDialog(this, m_storage);
|
||||
m_updateDialog->ShowDialog();
|
||||
// tell download manager that we're gone...
|
||||
m_storage.Unsubscribe();
|
||||
}
|
||||
|
||||
void MainWindow::ShowClassifPanel()
|
||||
|
|
|
@ -12,14 +12,16 @@ namespace qt
|
|||
{
|
||||
class FindTableWnd;
|
||||
class DrawWidget;
|
||||
class UpdateDialog;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
DrawWidget * m_pDrawWidget;
|
||||
QDockWidget * m_pClassifDock;
|
||||
//FindTableWnd * m_pFindTable;
|
||||
UpdateDialog * m_updateDialog;
|
||||
|
||||
storage::Storage m_Storage;
|
||||
storage::Storage m_storage;
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
|
|
|
@ -73,18 +73,6 @@ namespace qt
|
|||
|
||||
setWindowTitle(tr("Geographical Regions"));
|
||||
resize(600, 500);
|
||||
|
||||
// we want to receive all download progress and result events
|
||||
m_storage.Subscribe(boost::bind(&UpdateDialog::OnCountryChanged, this, _1),
|
||||
boost::bind(&UpdateDialog::OnCountryDownloadProgress, this, _1, _2),
|
||||
boost::bind(&UpdateDialog::OnUpdateCheck, this, _1, _2));
|
||||
FillTree();
|
||||
}
|
||||
|
||||
UpdateDialog::~UpdateDialog()
|
||||
{
|
||||
// tell download manager that we're gone...
|
||||
m_storage.Unsubscribe();
|
||||
}
|
||||
|
||||
/// when user clicks on any map row in the table
|
||||
|
@ -328,4 +316,17 @@ namespace qt
|
|||
item->setText(KColumnIndexSize, QString("%1%").arg(progress.first * 100 / progress.second));
|
||||
}
|
||||
|
||||
void UpdateDialog::ShowDialog()
|
||||
{
|
||||
// we want to receive all download progress and result events
|
||||
m_storage.Subscribe(boost::bind(&UpdateDialog::OnCountryChanged, this, _1),
|
||||
boost::bind(&UpdateDialog::OnCountryDownloadProgress, this, _1, _2),
|
||||
boost::bind(&UpdateDialog::OnUpdateCheck, this, _1, _2));
|
||||
// if called for first time
|
||||
if (!m_tree->topLevelItemCount())
|
||||
FillTree();
|
||||
|
||||
exec();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ namespace qt
|
|||
|
||||
public:
|
||||
explicit UpdateDialog(QWidget * parent, storage::Storage & storage);
|
||||
~UpdateDialog();
|
||||
|
||||
/// @name Called from downloader to notify GUI
|
||||
//@{
|
||||
|
@ -29,6 +28,8 @@ namespace qt
|
|||
void OnUpdateCheck(int64_t updateSize, char const * readme);
|
||||
//@}
|
||||
|
||||
void ShowDialog();
|
||||
|
||||
private slots:
|
||||
void OnItemClick(QTreeWidgetItem * item, int column);
|
||||
void OnButtonClick(bool checked = false);
|
||||
|
|
Loading…
Add table
Reference in a new issue