ControlView::ControlView( QWidget *parent ) : QWidget( parent ), m_mapThemeManager( new MapThemeManager( this ) ), m_searchDock( 0 ), m_locationWidget( 0 ), m_conflictDialog( 0 ), m_togglePanelVisibilityAction( 0 ), m_isPanelVisible( true ), m_tourWidget( 0 ), m_annotationDock( 0 ), m_annotationPlugin( 0 ) { setWindowTitle( tr( "Marble - Virtual Globe" ) ); resize( 680, 640 ); m_marbleWidget = new MarbleWidget( this ); m_marbleWidget->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); QVBoxLayout* layout = new QVBoxLayout; layout->addWidget( m_marbleWidget ); layout->setMargin( 0 ); setLayout( layout ); m_cloudSyncManager = new CloudSyncManager( this ); m_cloudSyncManager->routeSyncManager()->setRoutingManager( m_marbleWidget->model()->routingManager() ); BookmarkSyncManager* bookmarkSyncManager = m_cloudSyncManager->bookmarkSyncManager(); bookmarkSyncManager->setBookmarkManager( m_marbleWidget->model()->bookmarkManager() ); m_conflictDialog = new ConflictDialog( m_marbleWidget ); connect( bookmarkSyncManager, SIGNAL(mergeConflict(MergeItem*)), this, SLOT(showConflictDialog(MergeItem*)) ); connect( bookmarkSyncManager, SIGNAL(syncComplete()), m_conflictDialog, SLOT(stopAutoResolve()) ); connect( m_conflictDialog, SIGNAL(resolveConflict(MergeItem*)), bookmarkSyncManager, SLOT(resolveConflict(MergeItem*)) ); }
void SyncRunner::synchronize() { QLOG_DEBUG() << "Starting SyncRunner.synchronize()"; if (!init) { this->setObjectName("SyncRunnerThread"); init = true; consumerKey = ""; secret = ""; apiRateLimitExceeded = false; // Setup the user agent userAgent = NN_APP_CLIENT_NAME; userStoreUrl = QString("http://" + global.server + "/edam/user").toStdString(); updateSequenceNumber = 0; defaultMsgTimeout = 150000; db = new DatabaseConnection("syncrunner"); comm = new CommunicationManager(db); if (global.guiAvailable) connect(global.application, SIGNAL(stdException(QString)), this, SLOT(applicationException(QString))); } // If we are already connected, we are already synchronizing so there is nothing more to do if (global.connected) { return; } error = false; comm->resetError(); if (!comm->enConnect()) { this->communicationErrorHandler(); error = true; emit syncComplete(); return; } global.connected = true; keepRunning = true; evernoteSync(); emit syncComplete(); comm->enDisconnect(); global.connected = false; }
void QtMarbleConfigDialog::disableSyncNow() { if ( !d->m_syncManager ) { return; } d->ui_cloudSyncSettings.button_syncNow->setDisabled(true); QTimer *timeoutTimer = new QTimer(this); connect(timeoutTimer, SIGNAL(timeout()), timeoutTimer, SLOT(stop())); connect(timeoutTimer, SIGNAL(timeout()), this, SLOT(enableSyncNow())); connect(d->m_syncManager, SIGNAL(syncComplete()), this, SLOT(enableSyncNow())); connect(d->m_syncManager, SIGNAL(syncComplete()), timeoutTimer, SLOT(stop())); connect(d->m_syncManager, SIGNAL(syncComplete()), timeoutTimer, SLOT(deleteLater())); timeoutTimer->start(30*1000); // 30 sec }
ControlView::ControlView( QWidget *parent ) : QWidget( parent ), m_mapThemeManager( new MapThemeManager( this ) ), m_searchDock( 0 ), m_locationWidget( 0 ), m_conflictDialog( 0 ), m_togglePanelVisibilityAction( 0 ), m_isPanelVisible( true ), m_tourWidget( 0 ), m_annotationDock( 0 ), m_annotationPlugin( 0 ) { setWindowTitle( tr( "Marble - Virtual Globe" ) ); resize( 680, 640 ); m_marbleWidget = new MarbleWidget( this ); m_marbleWidget->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); #ifdef MARBLE_DBUS new MarbleDBusInterface( m_marbleWidget ); QDBusConnection::sessionBus().registerObject( "/Marble", m_marbleWidget ); if (!QDBusConnection::sessionBus().registerService( "org.kde.marble" )) { QString const urlWithPid = QString("org.kde.marble-%1").arg( QCoreApplication::applicationPid() ); if ( !QDBusConnection::sessionBus().registerService( urlWithPid ) ) { mDebug() << "Failed to register service org.kde.marble and " << urlWithPid << " with the DBus session bus."; } } #endif QVBoxLayout* layout = new QVBoxLayout; layout->addWidget( m_marbleWidget ); layout->setMargin( 0 ); setLayout( layout ); m_cloudSyncManager = new CloudSyncManager( this ); m_cloudSyncManager->routeSyncManager()->setRoutingManager( m_marbleWidget->model()->routingManager() ); BookmarkSyncManager* bookmarkSyncManager = m_cloudSyncManager->bookmarkSyncManager(); bookmarkSyncManager->setBookmarkManager( m_marbleWidget->model()->bookmarkManager() ); m_conflictDialog = new ConflictDialog( m_marbleWidget ); connect( bookmarkSyncManager, SIGNAL(mergeConflict(MergeItem*)), this, SLOT(showConflictDialog(MergeItem*)) ); connect( bookmarkSyncManager, SIGNAL(syncComplete()), m_conflictDialog, SLOT(stopAutoResolve()) ); connect( m_conflictDialog, SIGNAL(resolveConflict(MergeItem*)), bookmarkSyncManager, SLOT(resolveConflict(MergeItem*)) ); }
QtMarbleConfigDialog::QtMarbleConfigDialog(MarbleWidget *marbleWidget, CloudSyncManager *cloudSyncManager, QWidget *parent ) : QDialog( parent ), d( new QtMarbleConfigDialogPrivate( marbleWidget, cloudSyncManager ) ) { QTabWidget *tabWidget = new QTabWidget( this ); QDialogButtonBox *buttons = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel, Qt::Horizontal, this ); // Connect the signals of the ButtonBox // to the corresponding slots of the dialog. connect( buttons, SIGNAL(accepted()), this, SLOT(accept()) ); // Ok connect( buttons, SIGNAL(rejected()), this, SLOT(reject()) ); // Cancel connect( buttons->button( QDialogButtonBox::Apply ),SIGNAL(clicked()), this, SLOT(writeSettings()) ); // Apply // If the dialog is accepted. Save the settings. connect( this, SIGNAL(accepted()), this, SLOT(writeSettings()) ); // view page QWidget *w_viewSettings = new QWidget( this ); d->ui_viewSettings.setupUi( w_viewSettings ); tabWidget->addTab( w_viewSettings, tr( "View" ) ); // It's experimental -- so we remove it for now. // FIXME: Delete the following line once OpenGL support is officially supported. d->ui_viewSettings.kcfg_graphicsSystem->removeItem( Marble::OpenGLGraphics ); QString nativeString ( tr("Native") ); #ifdef Q_WS_X11 nativeString = tr( "Native (X11)" ); #endif #ifdef Q_WS_MAC nativeString = tr( "Native (Mac OS X Core Graphics)" ); #endif d->ui_viewSettings.kcfg_graphicsSystem->setItemText( Marble::NativeGraphics, nativeString ); d->ui_viewSettings.kcfg_labelLocalization->hide(); d->ui_viewSettings.label_labelLocalization->hide(); // navigation page QWidget *w_navigationSettings = new QWidget( this ); d->ui_navigationSettings.setupUi( w_navigationSettings ); tabWidget->addTab( w_navigationSettings, tr( "Navigation" ) ); d->ui_navigationSettings.kcfg_dragLocation->hide(); d->ui_navigationSettings.label_dragLocation->hide(); // cache page QWidget *w_cacheSettings = new QWidget( this ); d->ui_cacheSettings.setupUi( w_cacheSettings ); tabWidget->addTab( w_cacheSettings, tr( "Cache and Proxy" ) ); // Forwarding clear button signals connect( d->ui_cacheSettings.button_clearVolatileCache, SIGNAL(clicked()), SIGNAL(clearVolatileCacheClicked()) ); connect( d->ui_cacheSettings.button_clearPersistentCache, SIGNAL(clicked()), SIGNAL(clearPersistentCacheClicked()) ); // time page QWidget *w_timeSettings = new QWidget( this ); d->ui_timeSettings.setupUi( w_timeSettings ); tabWidget->addTab( w_timeSettings, tr( "Date and Time" ) ); // routing page QWidget *w_routingSettings = new RoutingProfilesWidget( marbleWidget->model() ); tabWidget->addTab( w_routingSettings, tr( "Routing" ) ); // plugin page d->m_pluginModel.setRenderPlugins( d->m_marbleWidget->renderPlugins() ); d->w_pluginSettings = new MarblePluginSettingsWidget( this ); d->w_pluginSettings->setModel( &d->m_pluginModel ); d->w_pluginSettings->setObjectName( "plugin_page" ); tabWidget->addTab( d->w_pluginSettings, tr( "Plugins" ) ); // Setting the icons for the plugin dialog. d->w_pluginSettings->setAboutIcon( QIcon(":/icons/help-about.png") ); d->w_pluginSettings->setConfigIcon( QIcon(":/icons/settings-configure.png") ); connect( this, SIGNAL(rejected()), &d->m_pluginModel, SLOT(retrievePluginState()) ); connect( this, SIGNAL(accepted()), &d->m_pluginModel, SLOT(applyPluginState()) ); QWidget *w_cloudSyncSettings = new QWidget( this ); d->ui_cloudSyncSettings.setupUi( w_cloudSyncSettings ); tabWidget->addTab( w_cloudSyncSettings, tr( "Synchronization" ) ); d->ui_cloudSyncSettings.button_syncNow->setEnabled( syncBookmarks() ); d->m_cloudSyncStatusLabel = d->ui_cloudSyncSettings.cloudSyncStatus; connect( d->ui_cloudSyncSettings.button_syncNow, SIGNAL(clicked()), SIGNAL(syncNowClicked()) ); connect( d->ui_cloudSyncSettings.testLoginButton, SIGNAL(clicked()), this, SLOT(updateCloudSyncCredentials()) ); if ( d->m_syncManager ) { connect(d->m_syncManager, SIGNAL(syncComplete()), this, SLOT(updateLastSync())); updateLastSync(); } if ( d->m_cloudSyncManager ) { connect( d->m_cloudSyncManager, SIGNAL(statusChanged(QString)), this, SLOT(updateCloudSyncStatus(QString))); } // Layout QVBoxLayout *layout = new QVBoxLayout( this ); layout->addWidget( tabWidget ); layout->addWidget( buttons ); this->setLayout( layout ); // When the settings have been changed, write to disk. connect( this, SIGNAL(settingsChanged()), this, SLOT(syncSettings()) ); initializeCustomTimezone(); }