• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • lib
  • marble
  • cloudsync
CloudRoutesDialog.cpp
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2013 Utku Aydın <utkuaydin34@gmail.com>
9 //
10 
11 #include "CloudRoutesDialog.h"
12 #include "ui_CloudRoutesDialog.h"
13 
14 #include "RouteItemDelegate.h"
15 
16 #include <QTimer>
17 
18 namespace Marble {
19 
20 class CloudRoutesDialog::Private : public Ui::CloudRoutesDialog {
21  public:
22  explicit Private( CloudRouteModel *model );
23  CloudRouteModel *m_model;
24 };
25 
26 CloudRoutesDialog::Private::Private( CloudRouteModel *model ) : Ui::CloudRoutesDialog(),
27  m_model( model )
28 {
29 }
30 
31 CloudRoutesDialog::CloudRoutesDialog( CloudRouteModel *model, QWidget *parent ) : QDialog( parent ),
32  d( new Private( model ) )
33 {
34  d->setupUi( this );
35 
36  RouteItemDelegate *delegate = new RouteItemDelegate( d->listView, d->m_model );
37  connect( delegate, SIGNAL(downloadButtonClicked(QString)), this, SIGNAL(downloadButtonClicked(QString)) );
38  connect( delegate, SIGNAL(openButtonClicked(QString)), this, SIGNAL(openButtonClicked(QString)) );
39  connect( delegate, SIGNAL(deleteButtonClicked(QString)), this, SIGNAL(deleteButtonClicked(QString)) );
40  connect( delegate, SIGNAL(removeFromCacheButtonClicked(QString)), this, SIGNAL(removeFromCacheButtonClicked(QString)) );
41  connect( delegate, SIGNAL(uploadToCloudButtonClicked(QString)), this, SIGNAL(uploadToCloudButtonClicked(QString)) );
42  connect( d->m_model, SIGNAL(modelReset()), this, SLOT(updateNoRouteLabel()) );
43 
44  d->progressBar->setHidden( true );
45  d->labelNoRoute->setHidden( true );
46 
47  d->listView->setItemDelegate( delegate );
48  d->listView->setModel( d->m_model );
49 }
50 
51 CloudRoutesDialog::~CloudRoutesDialog()
52 {
53  delete d;
54 }
55 
56 CloudRouteModel* CloudRoutesDialog::model()
57 {
58  return d->m_model;
59 }
60 
61 void CloudRoutesDialog::updateListDownloadProgressbar( qint64 received, qint64 total )
62 {
63  d->progressBar->setHidden( false );
64  d->progressBar->setValue( qRound( 100.0 * qreal( received ) / total ) );
65  if( received == total ) {
66  QTimer::singleShot( 1000, d->progressBar, SLOT(hide()) );
67  }
68 }
69 
70 void CloudRoutesDialog::updateNoRouteLabel() {
71  bool const isEmpty = d->listView->model()->rowCount() == 0;
72  d->listView->setHidden( isEmpty );
73  d->labelNoRoute->setVisible( isEmpty );
74 }
75 
76 }
77 
78 #include "CloudRoutesDialog.moc"
Marble::CloudRoutesDialog::model
CloudRouteModel * model()
Definition: CloudRoutesDialog.cpp:56
QWidget
Marble::CloudRouteModel
Definition: CloudRouteModel.h:25
CloudRoutesDialog.h
RouteItemDelegate.h
Marble::CloudRoutesDialog::openButtonClicked
void openButtonClicked(QString timestamp)
Marble::CloudRoutesDialog::downloadButtonClicked
void downloadButtonClicked(QString timestamp)
Marble::RouteItemDelegate
Definition: RouteItemDelegate.h:12
Marble::CloudRoutesDialog::CloudRoutesDialog
CloudRoutesDialog(CloudRouteModel *model, QWidget *parent=0)
Definition: CloudRoutesDialog.cpp:31
Marble::CloudRoutesDialog::deleteButtonClicked
void deleteButtonClicked(QString timestamp)
QString
QWidget::hide
void hide()
Marble::CloudRoutesDialog::updateListDownloadProgressbar
void updateListDownloadProgressbar(qint64 received, qint64 total)
Definition: CloudRoutesDialog.cpp:61
Marble::CloudRoutesDialog::~CloudRoutesDialog
~CloudRoutesDialog()
Definition: CloudRoutesDialog.cpp:51
Marble::CloudRoutesDialog::uploadToCloudButtonClicked
void uploadToCloudButtonClicked(QString timestamp)
QDialog
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Marble::CloudRoutesDialog::removeFromCacheButtonClicked
void removeFromCacheButtonClicked(QString timestamp)
QTimer::singleShot
singleShot
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:38 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal