MainWindowsEventHandling::MainWindowsEventHandling( RobotProxy &robot, QQmlContext& qmlContext, RobotStateHistory& history) : robot(robot), qmlContext(qmlContext), history(history) { QObject::connect(&history, SIGNAL(historyChanged()), this, SLOT(historyChanged())); }
LookupPanel::LookupPanel() : QDockWidget(tr("Search")) { _wordEdit = new QLineEdit(this); connect(_wordEdit, SIGNAL(returnPressed()), this, SLOT(editingFinished())); _toolBar = new QToolBar(this); _toolBar->setFloatable(false); _toolBar->setAllowedAreas(Qt::NoToolBarArea); _toolBar->setMovable(false); // remove excessive space around small buttons _toolBar->setStyleSheet("QToolButton{margin:0}"); // Go Home button. _homeAct = new QAction(QIcon(":/images/go-home.svg"), tr("Title page"), this); _toolBar->addAction(_homeAct); connect(_homeAct, SIGNAL(triggered()), this, SLOT(goHome())); // Previous Entry button. Backspace added as an important // shortcut. _previousAct = new QAction(QIcon(":/images/go-previous.svg"), tr("Previous"), this); QList<QKeySequence> previousActShortcuts; previousActShortcuts.append(QKeySequence::Back); previousActShortcuts.append(Qt::Key_Backspace); _previousAct->setShortcuts(previousActShortcuts); connect(_previousAct, SIGNAL(triggered()), this, SLOT(goPrevious())); _toolBar->addAction(_previousAct); // Next Entry button. _nextAct = new QAction(QIcon(":/images/go-next.svg"), tr("Next"), this); _nextAct->setShortcut(QKeySequence::Forward); connect(_nextAct, SIGNAL(triggered()), this, SLOT(goNext())); _toolBar->addAction(_nextAct); // Update displayed entry history and register a slot catching its changes. historyChanged(); connect(&_history, SIGNAL(changed()), this, SLOT(historyChanged())); // Vertical fixed layout without margins. QWidget *layoutWidget = new QWidget(this); QVBoxLayout *layout = new QVBoxLayout(layoutWidget); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); layout->setSizeConstraint(QLayout::SetMaximumSize); layout->addWidget(_wordEdit); layout->addWidget(_toolBar); layoutWidget->setMaximumHeight(_wordEdit->height() + _toolBar->height()); layoutWidget->setLayout(layout); setWidget(layoutWidget); // Not movable, no title bar. setAllowedAreas(Qt::LeftDockWidgetArea); setFeatures(QDockWidget::NoDockWidgetFeatures); setContentsMargins(0, 4, 2, 4); setTitleBarWidget(new QWidget(this)); // no title bar }
void HelpPopup::DoInitDialog() { ToLog(LOGMSG_DEBUGTRACE,"IN:HelpPopup::DoInitDialog"); if (HelpEngine) { ui->HelpBrowserWidget->HelpEngine=HelpEngine; ui->ContentWidget->InitHelpEngine(HelpEngine); ui->FollowInterfaceCB->setChecked(*WikiFollowInterface); ui->HelpSplitter->setStretchFactor(0,1); ui->HelpSplitter->setStretchFactor(1,3); connect(ui->HelpBrowserWidget,SIGNAL(historyChanged()),SLOT(PageChanged())); connect(ui->HelpBrowserWidget,SIGNAL(sourceChanged(QUrl)),SLOT(SourceChanged(QUrl))); connect(ui->ContentWidget,SIGNAL(clicked(QModelIndex)),this,SLOT(UpdateUrl(QModelIndex))); connect(ui->ContentWidget,SIGNAL(collapsed(QModelIndex)),this,SLOT(CollapsedOrExpanded(QModelIndex))); connect(ui->ContentWidget,SIGNAL(expanded(QModelIndex)),this,SLOT(CollapsedOrExpanded(QModelIndex))); connect(ui->ExitBT,SIGNAL(pressed()),this,SLOT(Exit())); connect(ui->PreviousBT,SIGNAL(pressed()),this,SLOT(Back())); connect(ui->NextBT,SIGNAL(pressed()),this,SLOT(Next())); connect(ui->CCBYSABT,SIGNAL(pressed()),this,SLOT(CCBYSABT())); connect(ui->HomeBT,SIGNAL(pressed()),this,SLOT(Home())); connect(ui->WebSiteBT,SIGNAL(pressed()),this,SLOT(WebSite())); connect(ui->ForumBT,SIGNAL(pressed()),this,SLOT(Forum())); connect(ui->FollowInterfaceCB,SIGNAL(clicked()),this,SLOT(Follow())); PageChanged(); } }
void LastFmUserSettings::removeRecentStation( int n ) { MyQSettings s( this ); QString const N = QString::number( n ); s.beginGroup( "RecentStations" ); QString const url = s.value( N ).toString(); s.remove( N ); // now renumber in correct order (maps are auto-sorted by key) QMap<int, QString> urls; foreach (QString key, s.childKeys()) urls[key.toInt()] = s.value( key ).toString(); s.remove( "" ); //current group int i = 0; foreach (QString url, urls) s.setValue( QString::number( i++ ), url ); s.endGroup(); s.remove( "StationNames/" + url ); s.sync(); emit userChanged( username() ); emit historyChanged(); }
void Plugin::Init (ICoreProxy_ptr proxy) { Util::InstallTranslator ("hotsensors"); #ifdef USE_CPP14 HistoryMgr_ = std::make_unique<HistoryManager> (); #else HistoryMgr_.reset (new HistoryManager); #endif #ifdef Q_OS_LINUX SensorsMgr_ = std::make_shared<LmSensorsBackend> (); #elif defined (Q_OS_MAC) SensorsMgr_ = std::make_shared<MacOsBackend> (); #endif if (SensorsMgr_) connect (SensorsMgr_.get (), SIGNAL (gotReadings (Readings_t)), HistoryMgr_.get (), SLOT (handleReadings (Readings_t))); #ifdef USE_CPP14 PlotMgr_ = std::make_unique<PlotManager> (proxy); #else PlotMgr_.reset (new PlotManager { proxy }); #endif connect (HistoryMgr_.get (), SIGNAL (historyChanged (ReadingsHistory_t)), PlotMgr_.get (), SLOT (handleHistoryUpdated (ReadingsHistory_t))); }
void HistoryManager::addToHistory(QString input_word) { if(input_word.size() && !_history.contains(input_word)) _history.push_back(input_word); emit historyChanged(_history); }
void BTHistory::sendChangedSignal() { bool backEnabled = m_index > 0; //there are items in the back list bool fwEnabled = m_historyList.size() > m_index+1; //there are items in the fw list emit historyChanged(backEnabled, fwEnabled); Q_ASSERT(class_invariant()); }
void UrlNavigator::setLocationUrl(const QUrl &url) { #ifdef DEBUG_LOCATION DEBUGOUT << "START; Current history index: " << m_currentHistoryIndex << m_history; #endif if (m_historyIndex + 1 < m_history.size()) { QList<QUrl>::iterator begin = m_history.begin() + m_historyIndex + 1; QList<QUrl>::iterator end = m_history.end(); m_history.erase(begin, end); } if (m_history.isEmpty() || (!m_history.isEmpty() && m_history.last() != url)) { m_history.append(url); } if (m_history.size() > m_historyMax) { m_history.removeAt(0); } m_historyIndex = m_history.size() - 1; #ifdef DEBUG_LOCATION DEBUGOUT << "END; Current history index: " << m_currentHistoryIndex << m_history; #endif setLocationUrlInternal(url); emit historyChanged(); }
void LastFmUserSettings::addRecentStation( const Station& station ) { MyQSettings s( this ); QList<Station> stations = recentStations(); // remove duplicates for ( int i = 0; i < stations.count(); ++i ) if ( stations[i].url() == station.url() ) stations.removeAt( i-- ); stations.prepend( station ); s.remove( "RecentStations" ); s.beginGroup( "RecentStations" ); int j = stations.count(); while (j--) s.setValue( QString::number( j ), stations[j].url() ); s.endGroup(); s.setValue( "StationNames/" + station.url(), station.name() ); s.sync(); emit userChanged( username() ); emit historyChanged(); }
void HistoryManager::removeFromHistory(QString input_word) { int i = _history.indexOf(input_word); if( i != -1) _history.remove(i); emit historyChanged(_history); }
void LastFmUserSettings::clearRecentStations( bool emitting ) { MyQSettings( this ).remove( "RecentStations" ); //TODO needed still? if ( emitting ) emit historyChanged(); }
void URLNavigator::goForward() { if (m_historyIndex > 0) { --m_historyIndex; updateContent(); emit urlChanged(url()); emit historyChanged(); } }
GitHistoryModel::GitHistoryModel(Git::Repo &repo, QObject *parent) : QAbstractTableModel(parent) , m_branch(repo.currentHead().name()) , m_commits() , m_repo(repo) { connect(&m_repo, SIGNAL(historyChanged()), this, SLOT(reset())); setBranch(m_branch); }
void HistoryManager::addToHistory(QVector<QString> words) { for(int i=0; i<words.size(); ++i) { if(!_history.contains(words[i])) _history.push_back(words[i]); } emit historyChanged(_history); }
void NotifyQt::notifyHistoryChanged(uint32_t msgId, int type) { { QMutexLocker m(&_mutex) ; if(!_enabled) return ; } emit historyChanged(msgId, type); }
void View::reloadConfig() { m_config.config()->reparseConfiguration(); setFreeFloating(m_config.readEntry("FreeFloating", false)); const QStringList history = m_config.readEntry("history", QStringList()); if (m_history != history) { m_history = history; emit historyChanged(); } }
void Logbook::updateHistoryCounter(const QString &url) { QDEBUG_EXP("Logbook::addHistory()", "url: " << url); m_query.prepare(UPDATE_HISTORY_LCOUNT_SQL); m_query.bindValue(0, url); // Let's query! if ( !m_query.exec() ) { QWARNING_EXP("Logbook::addHistory()", "Query exec error: " << m_query.lastError().text() << " Query: " << m_query.lastQuery()); } else { emit historyChanged( getHistory(url)->id ); } }
void URLNavigator::goBack() { updateHistoryElem(); const int count = m_history.count(); if (m_historyIndex < count - 1) { ++m_historyIndex; updateContent(); emit urlChanged(url()); emit historyChanged(); } }
int Dashboard::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = HistoryView::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: historyChanged((*reinterpret_cast< const Quackle::History(*)>(_a[1]))); break; } _id -= 1; } return _id; }
int HistoryView::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = BaseView::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: goToHistoryLocation((*reinterpret_cast< const Quackle::HistoryLocation(*)>(_a[1]))); break; case 1: historyChanged((*reinterpret_cast< const Quackle::History(*)>(_a[1]))); break; } _id -= 2; } return _id; }
bool UrlNavigator::setHistoryIndex(int index) { if (index < 0 || index > m_history.size() - 1) { return false; } if (index == m_historyIndex) { return true; } m_historyIndex = index; updateContent(); emit historyChanged(); return true; }
int History::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = HistoryView::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: historyChanged((*reinterpret_cast< const Quackle::History(*)>(_a[1]))); break; case 1: itemActivated((*reinterpret_cast< QTableWidgetItem*(*)>(_a[1]))); break; } _id -= 2; } return _id; }
void View::addToHistory(const QString &item) { if (item == QLatin1String("SESSIONS")) { return; } m_history.removeOne(item); m_history.prepend(item); while (m_history.count() > 50) { // make configurable? m_history.removeLast(); } emit historyChanged(); m_config.writeEntry("history", m_history); m_config.sync(); }
void Logbook::addHistory(const QString &title, const QString &url, const linkItemId &historyItemId) { QDEBUG_EXP("Logbook::addHistory()", "title: " << title << " url: " << url << " id: " << historyItemId); if ( historyItemId != LINK_ITEM_ID_UNDEFINED ) { // Update history QDEBUG_EXP("Logbook::addHistory()", "Provided Bookmark Id -> Updating"); m_query.prepare(UPDATE_HISTORY_SQL_BY_ID); m_query.bindValue(0, url); m_query.bindValue(1, title); m_query.bindValue(2, historyItemId); } else { // Insert History, or Update if ( NULL != getHistory(url) ) { // Update, there is already this URL QDEBUG_EXP("Logbook::addHistory()", "Updating History"); m_query.prepare(UPDATE_HISTORY_SQL_BY_URL); m_query.bindValue(0, title); m_query.bindValue(1, url); } else { // Insert, never stored this URL QDEBUG_EXP("Logbook::addHistory()", "Inserting History"); m_query.prepare(INSERT_HISTORY_SQL); m_query.bindValue(0, url); m_query.bindValue(1, title); } } // Let's query! if ( !m_query.exec() ) { QWARNING_EXP("Logbook::addHistory()", "Query exec error: " << m_query.lastError().text() << " Query: " << m_query.lastQuery()); } else { emit historyChanged( getHistory(url)->id ); } }
void HistoryManager::clearHistory() { _history.clear(); emit historyChanged(_history); }
DolphinView::DolphinView(QWidget *parent, const KURL& url, Mode mode, bool showHiddenFiles) : QWidget(parent), m_refreshing(false), m_showProgress(false), m_mode(mode), m_iconsView(0), m_detailsView(0), m_statusBar(0), m_iconSize(0), m_folderCount(0), m_fileCount(0), m_filterBar(0) { setFocusPolicy(QWidget::StrongFocus); m_topLayout = new QVBoxLayout(this); Dolphin& dolphin = Dolphin::mainWin(); connect(this, SIGNAL(signalModeChanged()), &dolphin, SLOT(slotViewModeChanged())); connect(this, SIGNAL(signalShowHiddenFilesChanged()), &dolphin, SLOT(slotShowHiddenFilesChanged())); connect(this, SIGNAL(signalSortingChanged(DolphinView::Sorting)), &dolphin, SLOT(slotSortingChanged(DolphinView::Sorting))); connect(this, SIGNAL(signalSortOrderChanged(Qt::SortOrder)), &dolphin, SLOT(slotSortOrderChanged(Qt::SortOrder))); m_urlNavigator = new URLNavigator(url, this); connect(m_urlNavigator, SIGNAL(urlChanged(const KURL&)), this, SLOT(slotURLChanged(const KURL&))); connect(m_urlNavigator, SIGNAL(urlChanged(const KURL&)), &dolphin, SLOT(slotURLChanged(const KURL&))); connect(m_urlNavigator, SIGNAL(historyChanged()), &dolphin, SLOT(slotHistoryChanged())); m_statusBar = new DolphinStatusBar(this); m_dirLister = new DolphinDirLister(); m_dirLister->setAutoUpdate(true); m_dirLister->setMainWindow(this); m_dirLister->setShowingDotFiles(showHiddenFiles); connect(m_dirLister, SIGNAL(clear()), this, SLOT(slotClear())); connect(m_dirLister, SIGNAL(percent(int)), this, SLOT(slotPercent(int))); connect(m_dirLister, SIGNAL(deleteItem(KFileItem*)), this, SLOT(slotDeleteItem(KFileItem*))); connect(m_dirLister, SIGNAL(completed()), this, SLOT(slotCompleted())); connect(m_dirLister, SIGNAL(infoMessage(const QString&)), this, SLOT(slotInfoMessage(const QString&))); connect(m_dirLister, SIGNAL(errorMessage(const QString&)), this, SLOT(slotErrorMessage(const QString&))); connect(m_dirLister, SIGNAL(refreshItems (const KFileItemList&)), this, SLOT(slotRefreshItems(const KFileItemList&))); connect(m_dirLister, SIGNAL(newItems(const KFileItemList&)), this, SLOT(slotAddItems(const KFileItemList&))); m_iconSize = KIcon::SizeMedium; m_topLayout->addWidget(m_urlNavigator); createView(); m_filterBar = new FilterBar(this); m_filterBar->hide(); m_topLayout->addWidget(m_filterBar); connect(m_filterBar, SIGNAL(signalFilterChanged(const QString&)), this, SLOT(slotChangeNameFilter(const QString&))); m_topLayout->addWidget(m_statusBar); }
HaveClip::HaveClip(QObject *parent) : QObject(parent) { Settings *s = Settings::create(this); connect(s, SIGNAL(firstStart()), this, SLOT(onFirstStart())); s->init(); manager = new ClipboardManager(this); connect(manager->history(), SIGNAL(historyChanged()), this, SLOT(updateHistory())); connect(manager->connectionManager(), SIGNAL(untrustedCertificateError(Node,QList<QSslError>)), this, SLOT(determineCertificateTrust(Node,QList<QSslError>))); connect(manager->connectionManager(), SIGNAL(sslFatalError(QList<QSslError>)), this, SLOT(sslFatalError(QList<QSslError>))); connect(manager->connectionManager(), SIGNAL(verificationRequested(Node)), this, SLOT(verificationRequest(Node))); historySignalMapper = new QSignalMapper(this); connect(historySignalMapper, SIGNAL(mapped(QObject*)), this, SLOT(historyActionClicked(QObject*))); // Tray #ifdef Q_OS_MAC trayIcon = new QSystemTrayIcon(QIcon(":/gfx/HaveClip_mac_tray.png"), this); #else trayIcon = new QSystemTrayIcon(QIcon(":/gfx/HaveClip_256.png"), this); #endif trayIcon->setToolTip(tr("HaveClip")); #ifndef Q_OS_MAC connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason))); #endif historyMenu = new QMenu(tr("History")); historySeparator = historyMenu->addSeparator(); menu = new QMenu; #if defined Q_OS_MAC menu->addMenu(historyMenu); menu->addSeparator(); #endif QAction *a = menu->addAction(tr("&Enable clipboard synchronization")); a->setCheckable(true); a->setChecked(manager->isSyncEnabled()); connect(a, SIGNAL(toggled(bool)), this, SLOT(toggleSharedClipboard(bool))); clipSndAction = menu->addAction(tr("Enable clipboard se&nding")); clipSndAction->setCheckable(true); clipSndAction->setChecked(manager->isSendingEnabled()); clipSndAction->setEnabled(manager->isSyncEnabled()); connect(clipSndAction, SIGNAL(toggled(bool)), this, SLOT(toggleSend(bool))); clipRecvAction = menu->addAction(tr("Enable clipboard &receiving")); clipRecvAction->setCheckable(true); clipRecvAction->setChecked(manager->isReceivingEnabled()); clipRecvAction->setEnabled(manager->isSyncEnabled()); connect(clipRecvAction, SIGNAL(toggled(bool)), this, SLOT(toggleReceive(bool))); menu->addSeparator(); menu->addAction(tr("Synchronize clipboard"), this, SLOT(synchronizeClipboard())); menuSeparator = menu->addSeparator(); menu->addAction(tr("&Settings"), this, SLOT(showSettings())); menu->addAction(tr("&About..."), this, SLOT(showAbout())); menu->addAction(tr("&Quit"), qApp, SLOT(quit())); trayIcon->setContextMenu(menu); trayIcon->show(); qApp->setQuitOnLastWindowClosed(false); qApp->setWindowIcon(QIcon(":/gfx/HaveClip_256.png")); manager->start(); }
CKJVBrowser::CKJVBrowser(CVerseListModel *pModel, CBibleDatabasePtr pBibleDatabase, QWidget *parent) : QWidget(parent), m_pBibleDatabase(pBibleDatabase), m_ndxCurrent(0), m_SearchResultsHighlighter(pModel, false), m_ExcludedSearchResultsHighlighter(pModel, true), m_bShowExcludedSearchResults(CPersistentSettings::instance()->showExcludedSearchResultsInBrowser()), m_bDoingUpdate(false), #ifndef PLASTIQUE_STATIC m_pPlastiqueStyle(NULL), #endif m_bDoingPassageReference(false), m_pScriptureBrowser(NULL) { assert(!m_pBibleDatabase.isNull()); assert(!g_pUserNotesDatabase.isNull()); ui.setupUi(this); #ifndef PLASTIQUE_STATIC m_pPlastiqueStyle = new QProxyStyle(QStyleFactory::create("plastique")); #endif initialize(); assert(m_pScriptureBrowser != NULL); ui.lblBibleDatabaseName->setText(m_pBibleDatabase->description()); setNavigationActivationDelay(CPersistentSettings::instance()->navigationActivationDelay()); setPassageReferenceActivationDelay(CPersistentSettings::instance()->passageReferenceActivationDelay()); setBrowserNavigationPaneMode(CPersistentSettings::instance()->browserNavigationPaneMode()); connect(CPersistentSettings::instance(), SIGNAL(changedNavigationActivationDelay(int)), this, SLOT(setNavigationActivationDelay(int))); connect(CPersistentSettings::instance(), SIGNAL(changedPassageReferenceActivationDelay(int)), this, SLOT(setPassageReferenceActivationDelay(int))); connect(CPersistentSettings::instance(), SIGNAL(changedChapterScrollbarMode(CHAPTER_SCROLLBAR_MODE_ENUM)), this, SLOT(en_changedChapterScrollbarMode())); connect(CPersistentSettings::instance(), SIGNAL(changedBrowserNavigationPaneMode(BROWSER_NAVIGATION_PANE_MODE_ENUM)), this, SLOT(setBrowserNavigationPaneMode(BROWSER_NAVIGATION_PANE_MODE_ENUM))); // Data Connections: connect(pModel, SIGNAL(verseListAboutToChange()), this, SLOT(en_SearchResultsVerseListAboutToChange())); connect(pModel, SIGNAL(verseListChanged()), this, SLOT(en_SearchResultsVerseListChanged())); // UI Connections: connect(m_pScriptureBrowser, SIGNAL(gotoIndex(const TPhraseTag &)), &m_dlyGotoIndex, SLOT(trigger(const TPhraseTag &))); connect(&m_dlyGotoIndex, SIGNAL(triggered(const TPhraseTag &)), this, SLOT(gotoIndex(const TPhraseTag &))); connect(this, SIGNAL(en_gotoIndex(const TPhraseTag &)), m_pScriptureBrowser, SLOT(en_gotoIndex(const TPhraseTag &))); connect(m_pScriptureBrowser, SIGNAL(sourceChanged(const QUrl &)), this, SLOT(en_sourceChanged(const QUrl &))); connect(m_pScriptureBrowser, SIGNAL(cursorPositionChanged()), this, SLOT(en_selectionChanged())); connect(ui.btnHideNavigation, SIGNAL(clicked()), this, SLOT(en_clickedHideNavigationPane())); connect(ui.comboBk, SIGNAL(currentIndexChanged(int)), this, SLOT(delayBkComboIndexChanged(int))); connect(ui.comboBkChp, SIGNAL(currentIndexChanged(int)), this, SLOT(delayBkChpComboIndexChanged(int))); connect(ui.comboTstBk, SIGNAL(currentIndexChanged(int)), this, SLOT(delayTstBkComboIndexChanged(int))); connect(ui.comboTstChp, SIGNAL(currentIndexChanged(int)), this, SLOT(delayTstChpComboIndexChanged(int))); connect(ui.comboBibleBk, SIGNAL(currentIndexChanged(int)), this, SLOT(delayBibleBkComboIndexChanged(int))); connect(ui.comboBibleChp, SIGNAL(currentIndexChanged(int)), this, SLOT(delayBibleChpComboIndexChanged(int))); connect(ui.widgetPassageReference, SIGNAL(passageReferenceChanged(const TPhraseTag &)), this, SLOT(delayPassageReference(const TPhraseTag &))); connect(ui.widgetPassageReference, SIGNAL(enterPressed()), this, SLOT(PassageReferenceEnterPressed())); connect(&m_dlyBkCombo, SIGNAL(triggered(int)), this, SLOT(BkComboIndexChanged(int))); connect(&m_dlyBkChpCombo, SIGNAL(triggered(int)), this, SLOT(BkChpComboIndexChanged(int))); connect(&m_dlyTstBkCombo, SIGNAL(triggered(int)), this, SLOT(TstBkComboIndexChanged(int))); connect(&m_dlyTstChpCombo, SIGNAL(triggered(int)), this, SLOT(TstChpComboIndexChanged(int))); connect(&m_dlyBibleBkCombo, SIGNAL(triggered(int)), this, SLOT(BibleBkComboIndexChanged(int))); connect(&m_dlyBibleChpCombo, SIGNAL(triggered(int)), this, SLOT(BibleChpComboIndexChanged(int))); connect(&m_dlyPassageReference, SIGNAL(triggered(const TPhraseTag &)), this, SLOT(PassageReferenceChanged(const TPhraseTag &))); connect(m_pScriptureBrowser, SIGNAL(activatedScriptureText()), this, SLOT(en_activatedScriptureText())); connect(ui.widgetPassageReference, SIGNAL(activatedPassageReference()), this, SLOT(en_activatedPassageReference())); // Set Outgoing Pass-Through Signals: connect(m_pScriptureBrowser, SIGNAL(backwardAvailable(bool)), this, SIGNAL(backwardAvailable(bool))); connect(m_pScriptureBrowser, SIGNAL(forwardAvailable(bool)), this, SIGNAL(forwardAvailable(bool))); connect(m_pScriptureBrowser, SIGNAL(historyChanged()), this, SIGNAL(historyChanged())); // Set Incoming Pass-Through Signals: connect(this, SIGNAL(backward()), m_pScriptureBrowser, SLOT(backward())); connect(this, SIGNAL(forward()), m_pScriptureBrowser, SLOT(forward())); connect(this, SIGNAL(home()), m_pScriptureBrowser, SLOT(home())); connect(this, SIGNAL(reload()), m_pScriptureBrowser, SLOT(reload())); connect(this, SIGNAL(rerender()), m_pScriptureBrowser, SLOT(rerender())); // Highlighting colors changing: connect(CPersistentSettings::instance(), SIGNAL(changedColorSearchResults(const QColor &)), this, SLOT(en_SearchResultsColorChanged(const QColor &))); connect(CPersistentSettings::instance(), SIGNAL(changedColorWordsOfJesus(const QColor &)), this, SLOT(en_WordsOfJesusColorChanged(const QColor &))); connect(CPersistentSettings::instance(), SIGNAL(changedShowExcludedSearchResultsInBrowser(bool)), this, SLOT(en_ShowExcludedSearchResultsChanged(bool))); connect(g_pUserNotesDatabase.data(), SIGNAL(highlighterTagsAboutToChange(CBibleDatabasePtr, const QString &)), this, SLOT(en_highlighterTagsAboutToChange(CBibleDatabasePtr, const QString &))); connect(g_pUserNotesDatabase.data(), SIGNAL(highlighterTagsChanged(CBibleDatabasePtr, const QString &)), this, SLOT(en_highlighterTagsChanged(CBibleDatabasePtr, const QString &))); connect(g_pUserNotesDatabase.data(), SIGNAL(aboutToChangeHighlighters()), this, SLOT(en_highlightersAboutToChange())); connect(g_pUserNotesDatabase.data(), SIGNAL(changedHighlighters()), this, SLOT(en_highlightersChanged())); // User Notes changing: connect(g_pUserNotesDatabase.data(), SIGNAL(addedUserNote(const CRelIndex &)), this, SLOT(en_userNoteEvent(const CRelIndex &))); connect(g_pUserNotesDatabase.data(), SIGNAL(changedUserNote(const CRelIndex &)), this, SLOT(en_userNoteEvent(const CRelIndex &))); connect(g_pUserNotesDatabase.data(), SIGNAL(removedUserNote(const CRelIndex &)), this, SLOT(en_userNoteEvent(const CRelIndex &))); // Cross Refs changing: connect(g_pUserNotesDatabase.data(), SIGNAL(addedCrossRef(const CRelIndex &, const CRelIndex &)), this, SLOT(en_crossRefsEvent(const CRelIndex &, const CRelIndex &))); connect(g_pUserNotesDatabase.data(), SIGNAL(removedCrossRef(const CRelIndex &, const CRelIndex &)), this, SLOT(en_crossRefsEvent(const CRelIndex &, const CRelIndex &))); connect(g_pUserNotesDatabase.data(), SIGNAL(changedAllCrossRefs()), this, SLOT(en_allCrossRefsChanged())); }
void Exchange_BitCurex::dataReceivedAuth(QByteArray data, int reqType) { if(debugLevel)logThread->writeLog("RCV: "+data); if(data.size()<4)return; if(data.at(0)==QLatin1Char('<'))return; bool success=true; switch(reqType) { case 103: //ticker if(data.startsWith("{\"lowest_tx_price_h\": \"")) { QByteArray tickerHigh=getMidData("\"highest_tx_price_h\": \"","\", \"",&data); if(!tickerHigh.isEmpty()) { double newTickerHigh=tickerHigh.toDouble(); if(newTickerHigh!=lastTickerHigh) IndicatorEngine::setValue(baseValues.exchangeName,baseValues.currentPair.symbol,"High",newTickerHigh); lastTickerHigh=newTickerHigh; } QByteArray tickerLow=getMidData("\"lowest_tx_price_h\": \"","\", \"",&data); if(!tickerLow.isEmpty()) { double newTickerLow=tickerLow.toDouble(); if(newTickerLow!=lastTickerLow) IndicatorEngine::setValue(baseValues.exchangeName,baseValues.currentPair.symbol,"Low",newTickerLow); lastTickerLow=newTickerLow; } QByteArray tickerSell=getMidData("\"best_bid_h\": \"","\", \"",&data); if(!tickerSell.isEmpty()) { double newTickerSell=tickerSell.toDouble(); if(newTickerSell!=lastTickerSell) IndicatorEngine::setValue(baseValues.exchangeName,baseValues.currentPair.symbol,"Sell",newTickerSell); lastTickerSell=newTickerSell; } QByteArray tickerBuy=getMidData("\"best_ask_h\": \"","\", \"",&data); if(!tickerBuy.isEmpty()) { double newTickerBuy=tickerBuy.toDouble(); if(newTickerBuy!=lastTickerBuy) IndicatorEngine::setValue(baseValues.exchangeName,baseValues.currentPair.symbol,"Buy",newTickerBuy); lastTickerBuy=newTickerBuy; } QByteArray tickerVolume=getMidData("\"total_volume_h\": \"","\", \"",&data); if(!tickerVolume.isEmpty()) { double newTickerVolume=tickerVolume.toDouble(); if(newTickerVolume!=lastTickerVolume) IndicatorEngine::setValue(baseValues.exchangeName,baseValues.currentPair.symbol,"Volume",newTickerVolume); lastTickerVolume=newTickerVolume; } QByteArray tickerLast=getMidData("\"last_tx_price_h\": \"","\", \"",&data); if(!tickerLast.isEmpty()) { double newTickerLast=tickerLast.toDouble(); if(newTickerLast!=lastTickerLast) IndicatorEngine::setValue(baseValues.exchangeName,baseValues.currentPair.symbol,"Last",newTickerLast); lastTickerLast=newTickerLast; } } else success=false; break;//ticker case 109: //trades if(data.startsWith("{\"status\": \"ok\", \"data\": {\"symbol\": \""+baseValues.currentPair.symbol.toLower().toLatin1()+"\", \"trades\": [{\"")) { QStringList tradeList=QString(data).split("}, {"); QList<TradesItem> *newTradesItems=new QList<TradesItem>; TradesItem newItem; for(int n=tradeList.count()-1;n>=0;n--) { QByteArray tradeData=tradeList.at(n).toLatin1()+"}"; newItem.date=getMidData("\"ts\": ",", \"",&tradeData).toUInt(); if(newItem.date<startTradesDate)continue; quint32 currentTid=getMidData("\"txid\": ",", \"",&tradeData).toUInt(); if(lastFetchTid>=currentTid)continue; lastFetchTid=currentTid; newItem.price=getMidData("\"price\": ",", \"",&tradeData).toDouble(); newItem.amount=getMidData("\"amount\": ",", \"",&tradeData).toDouble(); newItem.orderType=getMidData("\"type\": \"","\"}",&tradeData)=="ask"?-1:1; newItem.symbol=baseValues.currentPair.symbol; if(newItem.isValid())(*newTradesItems)<<newItem; else if(debugLevel)logThread->writeLog("Invalid trades fetch data line:"+tradeData,2); } if(newItem.price>0&&lastTradesDate<newItem.date) { lastTradesDate=newItem.date; IndicatorEngine::setValue(baseValues.exchangeName,baseValues.currentPair.symbol,"Last",newItem.price); lastTickerLast=newItem.price; } if(newTradesItems->count())emit addLastTrades(baseValues.currentPair.symbol,newTradesItems); else delete newTradesItems; } else if(!data.startsWith("{\"status\": \"ok\", \"data\": {\"symbol\": \""))success=false; break;//trades case 111: //depth if(data.startsWith("{\"symbol\": \""+baseValues.currentPair.symbol.toLower().toLatin1()+"\", \"bids\": [")) { emit depthRequestReceived(); if(lastDepthData!=data) { lastDepthData=data; depthAsks=new QList<DepthItem>; depthBids=new QList<DepthItem>; QMap<double,double> currentAsksMap; QStringList asksList=QString(getMidData("asks\": [[","]]",&data)).split("], ["); double groupedPrice=0.0; double groupedVolume=0.0; int rowCounter=0; for(int n=0;n<asksList.count();n++) { if(baseValues.depthCountLimit&&rowCounter>=baseValues.depthCountLimit)break; QStringList currentPair=asksList.at(n).split(", "); if(currentPair.count()!=2)continue; double priceDouble=currentPair.first().toDouble(); double amount=currentPair.last().toDouble(); if(baseValues.groupPriceValue>0.0) { if(n==0) { emit depthFirstOrder(baseValues.currentPair.symbol,priceDouble,amount,true); groupedPrice=baseValues.groupPriceValue*(int)(priceDouble/baseValues.groupPriceValue); groupedVolume=amount; } else { bool matchCurrentGroup=priceDouble<groupedPrice+baseValues.groupPriceValue; if(matchCurrentGroup)groupedVolume+=amount; if(!matchCurrentGroup||n==asksList.count()-1) { depthSubmitOrder(baseValues.currentPair.symbol, ¤tAsksMap,groupedPrice+baseValues.groupPriceValue,groupedVolume,true); rowCounter++; groupedVolume=amount; groupedPrice+=baseValues.groupPriceValue; } } } else { depthSubmitOrder(baseValues.currentPair.symbol, ¤tAsksMap,priceDouble,amount,true); rowCounter++; } } QList<double> currentAsksList=lastDepthAsksMap.keys(); for(int n=0;n<currentAsksList.count();n++) if(currentAsksMap.value(currentAsksList.at(n),0)==0)depthUpdateOrder(baseValues.currentPair.symbol, currentAsksList.at(n),0.0,true); lastDepthAsksMap=currentAsksMap; QMap<double,double> currentBidsMap; QStringList bidsList=QString(getMidData("bids\": [[","]]",&data)).split("], ["); groupedPrice=0.0; groupedVolume=0.0; rowCounter=0; for(int n=0;n<bidsList.count();n++) { if(baseValues.depthCountLimit&&rowCounter>=baseValues.depthCountLimit)break; QStringList currentPair=bidsList.at(n).split(", "); if(currentPair.count()!=2)continue; double priceDouble=currentPair.first().toDouble(); double amount=currentPair.last().toDouble(); if(baseValues.groupPriceValue>0.0) { if(n==0) { emit depthFirstOrder(baseValues.currentPair.symbol,priceDouble,amount,false); groupedPrice=baseValues.groupPriceValue*(int)(priceDouble/baseValues.groupPriceValue); groupedVolume=amount; } else { bool matchCurrentGroup=priceDouble>groupedPrice-baseValues.groupPriceValue; if(matchCurrentGroup)groupedVolume+=amount; if(!matchCurrentGroup||n==asksList.count()-1) { depthSubmitOrder(baseValues.currentPair.symbol, ¤tBidsMap,groupedPrice-baseValues.groupPriceValue,groupedVolume,false); rowCounter++; groupedVolume=amount; groupedPrice-=baseValues.groupPriceValue; } } } else { depthSubmitOrder(baseValues.currentPair.symbol, ¤tBidsMap,priceDouble,amount,false); rowCounter++; } } QList<double> currentBidsList=lastDepthBidsMap.keys(); for(int n=0;n<currentBidsList.count();n++) if(currentBidsMap.value(currentBidsList.at(n),0)==0)depthUpdateOrder(baseValues.currentPair.symbol, currentBidsList.at(n),0.0,false); lastDepthBidsMap=currentBidsMap; emit depthSubmitOrders(baseValues.currentPair.symbol,depthAsks, depthBids); depthAsks=0; depthBids=0; } } else if(!data.startsWith("{\"symbol\": \"")) { if(debugLevel)logThread->writeLog("Invalid depth data:"+data,2); success=false; } break; case 202: //info if(data.startsWith("{\"status\": \"ok\", \"data\": {\"")) { QByteArray fundsData=getMidData("data\": {","}",&data); QByteArray btcBalance=getMidData(baseValues.currentPair.currAStrLow+"\": \"","\"",&fundsData); if(!btcBalance.isEmpty()) { double newBtcBalance=btcBalance.toDouble(); if(lastBtcBalance!=newBtcBalance)emit accBtcBalanceChanged(baseValues.currentPair.symbol,newBtcBalance); lastBtcBalance=newBtcBalance; } QByteArray usdBalance=getMidData("\""+baseValues.currentPair.currBStrLow+"\": \"","\"",&fundsData); if(!usdBalance.isEmpty()) { double newUsdBalance=usdBalance.toDouble(); if(newUsdBalance!=lastUsdBalance)emit accUsdBalanceChanged(baseValues.currentPair.symbol,newUsdBalance); lastUsdBalance=newUsdBalance; } QByteArray fee=getMidData("\"fee\": ",",",&data); if(!fee.isEmpty()) { double newFee=fee.toDouble(); if(newFee!=lastFee)emit accFeeChanged(baseValues.currentPair.symbol,newFee); lastFee=newFee; } } else success=false; break;//info case 204://orders if(data.startsWith("{\"status\": \"ok\", \"data\": [{\"")) { if(lastOrders!=data) { lastOrders=data; QStringList ordersList=QString(data).split("}, {"); QList<OrderItem> *orders=new QList<OrderItem>; for(int n=0;n<ordersList.count();n++) { OrderItem currentOrder; QByteArray currentOrderData=ordersList.at(n).toLatin1()+"}"; currentOrder.oid=getMidData("id\": \"","\"}",¤tOrderData); QByteArray tempDate=getMidData("issued\": ",", \"",¤tOrderData); tempDate.chop(3); currentOrder.date=tempDate.toUInt(); currentOrder.type=getMidData("type\": \"","\", \"",¤tOrderData)=="ask"; currentOrder.amount=getMidData("volume\": \"","\", \"",¤tOrderData).toDouble(); currentOrder.price=getMidData("limit\": \"","\", \"",¤tOrderData).toDouble(); currentOrder.symbol="BTC"+getMidData("currency\": \"","\", \"",¤tOrderData).toUpper(); currentOrder.status=1; if(currentOrder.isValid())(*orders)<<currentOrder; } emit orderBookChanged(baseValues.currentPair.symbol,orders); } } else if(data.startsWith("{\"status\": \"ok\", \"data\": [")) emit ordersIsEmpty(); else success=false; break;//orders case 305: //order/cancel if(data.startsWith("{\"status\": \"ok\", \"data\": [{\"")) { QByteArray oid=getMidData("id\": \"","\"",&data); if(!oid.isEmpty())emit orderCanceled(baseValues.currentPair.symbol,oid); } else success=false; break;//order/cancel case 306: if(debugLevel)logThread->writeLog("Buy OK: "+data,2);break;//order/buy case 307: if(debugLevel)logThread->writeLog("Sell OK: "+data,2);break;//order/sell case 208: ///history if(data.startsWith("{\"status\": \"ok\", \"data\": {\"symbol\": \""+baseValues.currentPair.symbol.toLower().toLatin1()+"\", \"trades\": [")) { if(lastHistory!=data) { lastHistory=data; QStringList dataList=QString(data).split("}, {"); QList<HistoryItem> *historyItems=new QList<HistoryItem>; quint32 currentId; quint32 maxId=0; for(int n=dataList.count()-1;n>=0;n--) { QByteArray curLog=dataList.at(n).toLatin1()+"}"; currentId=getMidData("txid\": ",", \"",&curLog).toUInt(); if(currentId<=lastHistoryId)break; if(n==dataList.count()-1)maxId=currentId; HistoryItem currentHistoryItem; QByteArray logType=getMidData("type\": \"","\"}",&curLog); if(logType=="ask")currentHistoryItem.type=2; else if(logType=="bid")currentHistoryItem.type=1; if(currentHistoryItem.type) { currentHistoryItem.symbol=baseValues.currentPair.symbol; currentHistoryItem.dateTimeInt=getMidData("ts\": ",", \"",&curLog).toUInt(); currentHistoryItem.price=getMidData("price\": ",", \"",&curLog).toDouble(); currentHistoryItem.volume=getMidData("amount\": ",", \"",&curLog).toDouble(); if(currentHistoryItem.isValid())(*historyItems)<<currentHistoryItem; } } if(maxId>lastHistoryId)lastHistoryId=maxId; emit historyChanged(historyItems); } } else success=false; break;//money/wallet/history default: break; } static int authErrorCount=0; if(reqType>=200 && reqType<300) { if(!success) { authErrorCount++; if(authErrorCount>2) { QString authErrorString=getMidData("data\": \"","\"",&data); if(debugLevel)logThread->writeLog("API error: "+authErrorString.toLatin1()+" ReqType: "+QByteArray::number(reqType),2); if(authErrorString=="auth_error")authErrorString=julyTr("TRUNAUTHORIZED","Invalid API key."); else if(authErrorString=="nonce_error")authErrorString=julyTr("THIS_PROFILE_ALREADY_USED","Invalid nonce parameter."); if(!authErrorString.isEmpty())emit showErrorMessage(authErrorString); } } else authErrorCount=0; } static int errorCount=0; if(!success) { QString errorString; errorString=getMidData("{\"status\": \"error\", \"data\": \"","\"",&data); errorCount++; if(errorCount<3)return; if(debugLevel)logThread->writeLog("API error: "+errorString.toLatin1()+" ReqType:"+QByteArray::number(reqType),2); if(errorString.isEmpty())return; if(errorString==QLatin1String("no orders"))return; if(reqType<300)emit showErrorMessage("I:>"+errorString); } else errorCount=0; }
DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) : QWidget(parent), m_topLayout(0), m_urlNavigator(0), m_searchBox(0), m_view(0), m_filterBar(0), m_statusBar(0), m_statusBarTimer(0), m_statusBarTimestamp() { hide(); m_topLayout = new QVBoxLayout(this); m_topLayout->setSpacing(0); m_topLayout->setMargin(0); m_urlNavigator = new KUrlNavigator(DolphinSettings::instance().placesModel(), url, this); connect(m_urlNavigator, SIGNAL(urlsDropped(const KUrl&, QDropEvent*)), this, SLOT(dropUrls(const KUrl&, QDropEvent*))); connect(m_urlNavigator, SIGNAL(activated()), this, SLOT(activate())); connect(m_urlNavigator->editor(), SIGNAL(completionModeChanged(KGlobalSettings::Completion)), this, SLOT(saveUrlCompletionMode(KGlobalSettings::Completion))); const GeneralSettings* settings = DolphinSettings::instance().generalSettings(); m_urlNavigator->setUrlEditable(settings->editableUrl()); m_urlNavigator->setShowFullPath(settings->showFullPath()); m_urlNavigator->setHomeUrl(KUrl(settings->homeUrl())); KUrlComboBox* editor = m_urlNavigator->editor(); editor->setCompletionMode(KGlobalSettings::Completion(settings->urlCompletionMode())); m_searchBox = new DolphinSearchBox(this); m_searchBox->hide(); connect(m_searchBox, SIGNAL(closeRequest()), this, SLOT(closeSearchBox())); connect(m_searchBox, SIGNAL(search(QString)), this, SLOT(startSearching(QString))); connect(m_searchBox, SIGNAL(returnPressed(QString)), this, SLOT(requestFocus())); m_view = new DolphinView(url, this); connect(m_view, SIGNAL(urlChanged(const KUrl&)), m_urlNavigator, SLOT(setUrl(const KUrl&))); connect(m_view, SIGNAL(writeStateChanged(bool)), this, SIGNAL(writeStateChanged(bool))); connect(m_view, SIGNAL(requestItemInfo(KFileItem)), this, SLOT(showItemInfo(KFileItem))); connect(m_view, SIGNAL(errorMessage(const QString&)), this, SLOT(showErrorMessage(const QString&))); connect(m_view, SIGNAL(infoMessage(const QString&)), this, SLOT(showInfoMessage(const QString&))); connect(m_view, SIGNAL(itemTriggered(KFileItem)), this, SLOT(slotItemTriggered(KFileItem))); connect(m_view, SIGNAL(redirection(KUrl, KUrl)), this, SLOT(redirect(KUrl, KUrl))); connect(m_view, SIGNAL(startedPathLoading(KUrl)), this, SLOT(slotStartedPathLoading())); connect(m_view, SIGNAL(finishedPathLoading(KUrl)), this, SLOT(slotFinishedPathLoading())); connect(m_view, SIGNAL(itemCountChanged()), this, SLOT(delayedStatusBarUpdate())); connect(m_view, SIGNAL(pathLoadingProgress(int)), this, SLOT(updateProgress(int))); connect(m_view, SIGNAL(infoMessage(const QString&)), this, SLOT(showInfoMessage(const QString&))); connect(m_view, SIGNAL(errorMessage(const QString&)), this, SLOT(showErrorMessage(const QString&))); connect(m_view, SIGNAL(urlIsFileError(const KUrl&)), this, SLOT(openFile(const KUrl&))); connect(m_view, SIGNAL(selectionChanged(const KFileItemList&)), this, SLOT(delayedStatusBarUpdate())); connect(m_view, SIGNAL(operationCompletedMessage(const QString&)), this, SLOT(showOperationCompletedMessage(const QString&))); connect(m_urlNavigator, SIGNAL(urlChanged(const KUrl&)), this, SLOT(slotUrlNavigatorLocationChanged(const KUrl&))); connect(m_urlNavigator, SIGNAL(urlAboutToBeChanged(const KUrl&)), this, SLOT(saveViewState())); connect(m_urlNavigator, SIGNAL(historyChanged()), this, SLOT(slotHistoryChanged())); // initialize status bar m_statusBar = new DolphinStatusBar(this, m_view); connect(m_statusBar, SIGNAL(stopPressed()), this, SLOT(stopLoading())); m_statusBarTimer = new QTimer(this); m_statusBarTimer->setSingleShot(true); m_statusBarTimer->setInterval(300); connect(m_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar())); KIO::FileUndoManager* undoManager = KIO::FileUndoManager::self(); connect(undoManager, SIGNAL(jobRecordingFinished(CommandType)), this, SLOT(delayedStatusBarUpdate())); // initialize filter bar m_filterBar = new FilterBar(this); m_filterBar->setVisible(settings->filterBar()); connect(m_filterBar, SIGNAL(filterChanged(const QString&)), this, SLOT(setNameFilter(const QString&))); connect(m_filterBar, SIGNAL(closeRequest()), this, SLOT(closeFilterBar())); connect(m_view, SIGNAL(urlChanged(const KUrl&)), m_filterBar, SLOT(clear())); m_topLayout->addWidget(m_urlNavigator); m_topLayout->addWidget(m_searchBox); m_topLayout->addWidget(m_view); m_topLayout->addWidget(m_filterBar); m_topLayout->addWidget(m_statusBar); setSearchModeEnabled(isSearchUrl(url)); }