Player::Player(QWidget *parent) :Html5ApplicationViewer(parent) { QObject::connect(webView()->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), SLOT(addToJavaScript())); api.sync(); playStatus = false; if (HIWORD(BASS_GetVersion())!=BASSVERSION) { return; } if (!BASS_Init(-1,44100,0,NULL,NULL)) { return; } BASS_SetConfig(BASS_CONFIG_NET_PLAYLIST,1); // enable playlist processing BASS_SetConfig(BASS_CONFIG_NET_PREBUF,0); // minimize automatic pre-buffering, so we can do it (and display it) instead playList.insert("1", "http://mp3.polskieradio.pl:8900/;stream"); playList.insert("2", "http://stream3.polskieradio.pl:8902/;stream"); playList.insert("3", "http://stream3.polskieradio.pl:8904/;stream"); playList.insert("4", "http://mp3.polskieradio.pl:8906/;stream"); playList.insert("antyradio", "http://ant-waw.cdn.eurozet.pl:8602/;stream"); acr.loadSettings(); QObject::connect(&acr, SIGNAL(songFound(QJsonObject)), this, SLOT(songFound(QJsonObject))); QObject::connect(&api, SIGNAL(updateReady(QList<Radiostation>)), this, SLOT(songFound(QList<Radiostation>))); }
void Client::update( ) { switch( _phase ) { case PHASE_READY: updateReady( ); break; case PHASE_CONNECTING: updateConnecting( ); break; } }
TitleWidget::TitleWidget(MainWindow *window) : TWidget(window) , wnd(window) , hideLevel(0) , hider(0) , _back(this, st::titleBackButton, lang(lng_menu_back)) , _cancel(this, lang(lng_cancel), st::titleTextButton) , _settings(this, lang(lng_menu_settings), st::titleTextButton) , _contacts(this, lang(lng_menu_contacts), st::titleTextButton) , _about(this, lang(lng_menu_about), st::titleTextButton) , _lock(this, window) , _update(this, window, lang(lng_menu_update)) , _minimize(this, window) , _maximize(this, window) , _restore(this, window) , _close(this, window) , _a_update(animation(this, &TitleWidget::step_update)) , lastMaximized(!(window->windowState() & Qt::WindowMaximized)) { setGeometry(0, 0, wnd->width(), st::titleHeight); setAttribute(Qt::WA_OpaquePaintEvent); _lock.hide(); _update.hide(); _cancel.hide(); _back.hide(); if ( #ifndef TDESKTOP_DISABLE_AUTOUPDATE Sandbox::updatingState() == Application::UpdatingReady || #endif cHasPasscode() ) { showUpdateBtn(); } stateChanged(); connect(&_back, SIGNAL(clicked()), window, SLOT(hideSettings())); connect(&_cancel, SIGNAL(clicked()), this, SIGNAL(hiderClicked())); connect(&_settings, SIGNAL(clicked()), window, SLOT(showSettings())); connect(&_contacts, SIGNAL(clicked()), this, SLOT(onContacts())); connect(&_about, SIGNAL(clicked()), this, SLOT(onAbout())); connect(wnd->windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(stateChanged(Qt::WindowState))); #ifndef TDESKTOP_DISABLE_AUTOUPDATE Sandbox::connect(SIGNAL(updateReady()), this, SLOT(showUpdateBtn())); #endif if (cPlatform() != dbipWindows) { _minimize.hide(); _maximize.hide(); _restore.hide(); _close.hide(); } }
void Dynamic::SearchQueryBias::newQuery() { DEBUG_BLOCK; // ok, I need a new query maker m_qm.reset( CollectionManager::instance()->queryMaker() ); Collections::addTextualFilter( m_qm.data(), m_filter ); m_qm->setQueryType( Collections::QueryMaker::Custom ); m_qm->addReturnValue( Meta::valUniqueId ); connect( m_qm.data(), SIGNAL(newResultReady(QStringList)), this, SLOT(updateReady(QStringList)), Qt::QueuedConnection ); connect( m_qm.data(), SIGNAL(queryDone()), this, SLOT(updateFinished()), Qt::QueuedConnection ); m_qm.data()->run(); }
TitleWidget::TitleWidget(QWidget *parent) : TWidget(parent) , _cancel(this, lang(lng_cancel), st::titleTextButton) , _settings(this, lang(lng_menu_settings), st::titleTextButton) , _contacts(this, lang(lng_menu_contacts), st::titleTextButton) , _about(this, lang(lng_menu_about), st::titleTextButton) , _lock(this) , _update(this) , _minimize(this) , _maximize(this) , _restore(this) , _close(this) , _a_update(animation(this, &TitleWidget::step_update)) , lastMaximized(!(parent->windowState() & Qt::WindowMaximized)) { setGeometry(0, 0, parent->width(), st::titleHeight); setAttribute(Qt::WA_OpaquePaintEvent); onWindowStateChanged(); updateControlsVisibility(); connect(&_cancel, SIGNAL(clicked()), this, SIGNAL(hiderClicked())); connect(&_settings, SIGNAL(clicked()), parent, SLOT(showSettings())); connect(&_contacts, SIGNAL(clicked()), this, SLOT(onContacts())); connect(&_about, SIGNAL(clicked()), this, SLOT(onAbout())); connect(parent->windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(onWindowStateChanged(Qt::WindowState))); #ifndef TDESKTOP_DISABLE_AUTOUPDATE Sandbox::connect(SIGNAL(updateReady()), this, SLOT(updateControlsVisibility())); #endif // !TDESKTOP_DISABLE_AUTOUPDATE subscribe(Adaptive::Changed(), [this]() { updateAdaptiveLayout(); }); if (Media::Player::exists()) { subscribe(Media::Player::instance()->usePanelPlayer(), [this](bool usePanel) { updatePlayerButton(usePanel); }); } if (cPlatform() != dbipWindows) { _minimize.hide(); _maximize.hide(); _restore.hide(); _close.hide(); } }
TitleWidget::TitleWidget(Window *window) : QWidget(window) , wnd(window) , hideLevel(0) , hider(0) , _back(this, st::titleBackButton, lang(lng_menu_back)) , _cancel(this, lang(lng_cancel), st::titleTextButton) , _settings(this, lang(lng_menu_settings), st::titleTextButton) , _contacts(this, lang(lng_menu_contacts), st::titleTextButton) , _about(this, lang(lng_menu_about), st::titleTextButton) , _update(this, window, lang(lng_menu_update)) , _minimize(this, window) , _maximize(this, window) , _restore(this, window) , _close(this, window) , lastMaximized(!(window->windowState() & Qt::WindowMaximized)) { setGeometry(0, 0, wnd->width(), st::titleHeight); _update.hide(); _cancel.hide(); _back.hide(); if (App::app()->updatingState() == Application::UpdatingReady) { showUpdateBtn(); } stateChanged(); connect(&_back, SIGNAL(clicked()), window, SLOT(hideSettings())); connect(&_cancel, SIGNAL(clicked()), this, SIGNAL(hiderClicked())); connect(&_settings, SIGNAL(clicked()), window, SLOT(showSettings())); connect(&_contacts, SIGNAL(clicked()), this, SLOT(onContacts())); connect(&_about, SIGNAL(clicked()), this, SLOT(onAbout())); connect(wnd->windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(stateChanged(Qt::WindowState))); connect(App::app(), SIGNAL(updateReady()), this, SLOT(showUpdateBtn())); if (cPlatform() != dbipWindows) { _minimize.hide(); _maximize.hide(); _restore.hide(); _close.hide(); } }
UpdateStateRow::UpdateStateRow(QWidget *parent) : TWidget(parent) , _check(this, lang(lng_settings_check_now)) , _restart(this, lang(lng_settings_update_now)) { connect(_check, SIGNAL(clicked()), this, SLOT(onCheck())); connect(_restart, SIGNAL(clicked()), this, SIGNAL(restart())); Sandbox::connect(SIGNAL(updateChecking()), this, SLOT(onChecking())); Sandbox::connect(SIGNAL(updateLatest()), this, SLOT(onLatest())); Sandbox::connect(SIGNAL(updateProgress(qint64, qint64)), this, SLOT(onDownloading(qint64, qint64))); Sandbox::connect(SIGNAL(updateFailed()), this, SLOT(onFailed())); Sandbox::connect(SIGNAL(updateReady()), this, SLOT(onReady())); _versionText = lng_settings_current_version_label(lt_version, currentVersionText()); switch (Sandbox::updatingState()) { case Application::UpdatingDownload: setState(State::Download, true); setDownloadProgress(Sandbox::updatingReady(), Sandbox::updatingSize()); break; case Application::UpdatingReady: setState(State::Ready, true); break; default: setState(State::None, true); break; } }
void Dynamic::QuizPlayBias::newQuery() { // ok, I need a new query maker m_qm.reset( CollectionManager::instance()->queryMaker() ); uint field = 0; switch( m_follow ) { case Dynamic::QuizPlayBias::TitleToTitle: field = Meta::valTitle; break; case Dynamic::QuizPlayBias::ArtistToArtist: field = Meta::valArtist; break; case Dynamic::QuizPlayBias::AlbumToAlbum: field = Meta::valAlbum; break; } m_qm->addFilter( field, QString(m_currentCharacter), true, false ); m_qm->setQueryType( Collections::QueryMaker::Custom ); m_qm->addReturnValue( Meta::valUniqueId ); connect( m_qm.data(), SIGNAL(newResultReady( QStringList )), this, SLOT(updateReady( QStringList )) ); connect( m_qm.data(), SIGNAL(queryDone()), this, SLOT(updateFinished()) ); m_qm.data()->run(); }
m_qm.reset( CollectionManager::instance()->queryMaker() ); // - construct the query m_qm->beginOr(); foreach( const QString &artist, artists ) { // debug() << "adding artist to query:" << artist; m_qm->addFilter( Meta::valArtist, artist, true, true ); } m_qm->endAndOr(); m_qm->setQueryType( Collections::QueryMaker::Custom ); m_qm->addReturnValue( Meta::valUniqueId ); connect( m_qm.data(), SIGNAL(newResultReady( QStringList )), this, SLOT(updateReady( QStringList )) ); connect( m_qm.data(), SIGNAL(queryDone()), this, SLOT(updateFinished()) ); // - run the query m_qm.data()->run(); } void Dynamic::WeeklyTopBias::newWeeklyTimesQuery() { DEBUG_BLOCK QMap< QString, QString > params; params[ "method" ] = "user.getWeeklyChartList" ; params[ "user" ] = lastfm::ws::Username;
SettingsInner::SettingsInner(Settings *parent) : QWidget(parent), _self(App::self()), // profile _nameCache(_self ? _self->name : QString()), _phoneText(_self ? App::formatPhone(_self->phone) : QString()), _uploadPhoto(this, lang(lng_settings_upload), st::btnSetUpload), _cancelPhoto(this, lang(lng_cancel)), _nameOver(false), _photoOver(false), a_photo(0), // notifications _desktopNotify(this, lang(lng_settings_desktop_notify), cDesktopNotify()), _soundNotify(this, lang(lng_settings_sound_notify), cSoundNotify()), // general _autoUpdate(this, lang(lng_settings_auto_update), cAutoUpdate()), _checkNow(this, lang(lng_settings_check_now)), _restartNow(this, lang(lng_settings_update_now)), _workmodeTray(this, lang(lng_settings_workmode_tray), (cWorkMode() == dbiwmTrayOnly || cWorkMode() == dbiwmWindowAndTray)), _workmodeWindow(this, lang(lng_settings_workmode_window), (cWorkMode() == dbiwmWindowOnly || cWorkMode() == dbiwmWindowAndTray)), _autoStart(this, lang(lng_settings_auto_start), cAutoStart()), _startMinimized(this, lang(lng_settings_start_min), cStartMinimized()), _dpiAutoScale(this, lang(lng_settings_scale_auto).replace(qsl("{cur}"), scaleLabel(cScreenScale())), (cConfigScale() == dbisAuto)), _dpiSlider(this, st::dpiSlider, dbisScaleCount - 1, cEvalScale(cConfigScale()) - 1), _dpiWidth1(st::dpiFont1->m.width(scaleLabel(dbisOne))), _dpiWidth2(st::dpiFont2->m.width(scaleLabel(dbisOneAndQuarter))), _dpiWidth3(st::dpiFont3->m.width(scaleLabel(dbisOneAndHalf))), _dpiWidth4(st::dpiFont4->m.width(scaleLabel(dbisTwo))), // chat options _replaceEmojis(this, lang(lng_settings_replace_emojis), cReplaceEmojis()), _viewEmojis(this, lang(lng_settings_view_emojis)), _enterSend(this, qsl("send_key"), 0, lang(lng_settings_send_enter), !cCtrlEnter()), _ctrlEnterSend(this, qsl("send_key"), 1, lang((cPlatform() == dbipMac) ? lng_settings_send_cmdenter : lng_settings_send_ctrlenter), cCtrlEnter()), _dontAskDownloadPath(this, lang(lng_download_path_dont_ask), !cAskDownloadPath()), _downloadPathWidth(st::linkFont->m.width(lang(lng_download_path_label))), _downloadPathEdit(this, cDownloadPath().isEmpty() ? lang(lng_download_path_temp) : st::linkFont->m.elidedText(QDir::toNativeSeparators(cDownloadPath()), Qt::ElideRight, st::setWidth - st::setVersionLeft - _downloadPathWidth)), _downloadPathClear(this, lang(lng_download_path_clear)), _tempDirClearingWidth(st::linkFont->m.width(lang(lng_download_path_clearing))), _tempDirClearedWidth(st::linkFont->m.width(lang(lng_download_path_cleared))), _tempDirClearFailedWidth(st::linkFont->m.width(lang(lng_download_path_clear_failed))), _catsAndDogs(this, lang(lng_settings_cats_and_dogs), cCatsAndDogs()), _scrollNotActive(this, lang(lng_settings_scroll_not_active), cScrollNotActive()), // advanced _connectionType(this, lang(lng_connection_auto)), _resetSessions(this, lang(lng_settings_reset)), _logOut(this, lang(lng_settings_logout), st::btnLogout), _resetDone(false) { if (_self) { _nameText.setText(st::setNameFont, _nameCache, _textNameOptions); PhotoData *selfPhoto = _self->photoId ? App::photo(_self->photoId) : 0; if (selfPhoto && selfPhoto->date) _photoLink = TextLinkPtr(new PhotoLink(selfPhoto)); MTP::send(MTPusers_GetFullUser(_self->inputUser), rpcDone(&SettingsInner::gotFullSelf)); connect(App::main(), SIGNAL(peerPhotoChanged(PeerData *)), this, SLOT(peerUpdated(PeerData *))); connect(App::main(), SIGNAL(peerNameChanged(PeerData *, const PeerData::Names &, const PeerData::NameFirstChars &)), this, SLOT(peerUpdated(PeerData *))); } // profile connect(&_uploadPhoto, SIGNAL(clicked()), this, SLOT(onUpdatePhoto())); connect(&_cancelPhoto, SIGNAL(clicked()), this, SLOT(onUpdatePhotoCancel())); connect(App::app(), SIGNAL(peerPhotoDone(PeerId)), this, SLOT(onPhotoUpdateDone(PeerId))); connect(App::app(), SIGNAL(peerPhotoFail(PeerId)), this, SLOT(onPhotoUpdateFail(PeerId))); // notifications connect(&_desktopNotify, SIGNAL(changed()), this, SLOT(onDesktopNotify())); connect(&_soundNotify, SIGNAL(changed()), this, SLOT(onSoundNotify())); // general connect(&_autoUpdate, SIGNAL(changed()), this, SLOT(onAutoUpdate())); connect(&_checkNow, SIGNAL(clicked()), this, SLOT(onCheckNow())); connect(&_restartNow, SIGNAL(clicked()), this, SLOT(onRestartNow())); connect(&_workmodeTray, SIGNAL(changed()), this, SLOT(onWorkmodeTray())); connect(&_workmodeWindow, SIGNAL(changed()), this, SLOT(onWorkmodeWindow())); _startMinimized.setDisabled(!_autoStart.checked()); connect(&_autoStart, SIGNAL(changed()), this, SLOT(onAutoStart())); connect(&_startMinimized, SIGNAL(changed()), this, SLOT(onStartMinimized())); connect(&_dpiAutoScale, SIGNAL(changed()), this, SLOT(onScaleAuto())); connect(&_dpiSlider, SIGNAL(changed(int32)), this, SLOT(onScaleChange())); _curVersionText = lang(lng_settings_current_version).replace(qsl("{version}"), QString::fromWCharArray(AppVersionStr)) + ' '; _curVersionWidth = st::linkFont->m.width(_curVersionText); _newVersionText = lang(lng_settings_update_ready) + ' '; _newVersionWidth = st::linkFont->m.width(_newVersionText); connect(App::app(), SIGNAL(updateChecking()), this, SLOT(onUpdateChecking())); connect(App::app(), SIGNAL(updateLatest()), this, SLOT(onUpdateLatest())); connect(App::app(), SIGNAL(updateDownloading(qint64,qint64)), this, SLOT(onUpdateDownloading(qint64,qint64))); connect(App::app(), SIGNAL(updateReady()), this, SLOT(onUpdateReady())); connect(App::app(), SIGNAL(updateFailed()), this, SLOT(onUpdateFailed())); // chat options connect(&_replaceEmojis, SIGNAL(changed()), this, SLOT(onReplaceEmojis())); connect(&_viewEmojis, SIGNAL(clicked()), this, SLOT(onViewEmojis())); connect(&_enterSend, SIGNAL(changed()), this, SLOT(onEnterSend())); connect(&_ctrlEnterSend, SIGNAL(changed()), this, SLOT(onCtrlEnterSend())); connect(&_dontAskDownloadPath, SIGNAL(changed()), this, SLOT(onDontAskDownloadPath())); connect(&_downloadPathEdit, SIGNAL(clicked()), this, SLOT(onDownloadPathEdit())); connect(&_downloadPathClear, SIGNAL(clicked()), this, SLOT(onDownloadPathClear())); switch (App::wnd()->tempDirState()) { case Window::TempDirEmpty: _tempDirClearState = TempDirEmpty; break; case Window::TempDirExists: _tempDirClearState = TempDirExists; break; case Window::TempDirRemoving: _tempDirClearState = TempDirClearing; break; } connect(App::wnd(), SIGNAL(tempDirCleared()), this, SLOT(onTempDirCleared())); connect(App::wnd(), SIGNAL(tempDirClearFailed()), this, SLOT(onTempDirClearFailed())); connect(&_catsAndDogs, SIGNAL(changed()), this, SLOT(onCatsAndDogs())); connect(&_scrollNotActive, SIGNAL(changed()), this, SLOT(onScrollNotActive())); // advanced connect(&_connectionType, SIGNAL(clicked()), this, SLOT(onConnectionType())); connect(&_resetSessions, SIGNAL(clicked()), this, SLOT(onResetSessions())); connect(&_logOut, SIGNAL(clicked()), this, SLOT(onLogout())); _connectionTypeText = lang(lng_connection_type) + ' '; _connectionTypeWidth = st::linkFont->m.width(_connectionTypeText); if (App::main()) { connect(App::main(), SIGNAL(peerUpdated(PeerData*)), this, SLOT(peerUpdated(PeerData*))); } updateOnlineDisplay(); switch (App::app()->updatingState()) { case Application::UpdatingDownload: setUpdatingState(UpdatingDownload, true); setDownloadProgress(App::app()->updatingReady(), App::app()->updatingSize()); break; case Application::UpdatingReady: setUpdatingState(UpdatingReady, true); break; default: setUpdatingState(UpdatingNone, true); break; } updateConnectionType(); setMouseTracking(true); }
Application::Application(int &argc, char **argv) : PsApplication(argc, argv), serverName(psServerPrefix() + cGUIDStr()), closing(false), updateRequestId(0), updateReply(0), updateThread(0), updateDownloader(0) { DEBUG_LOG(("Application Info: creation..")); QByteArray d(QDir((cPlatform() == dbipWindows ? cExeDir() : cWorkingDir()).toLower()).absolutePath().toUtf8()); char h[33] = { 0 }; hashMd5Hex(d.constData(), d.size(), h); serverName = psServerPrefix() + h + '-' + cGUIDStr(); if (mainApp) { DEBUG_LOG(("Application Error: another Application was created, terminating..")); exit(0); } mainApp = this; installEventFilter(new _DebugWaiter(this)); #if defined Q_OS_LINUX || defined Q_OS_LINUX64 QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/DejaVuSans.ttf")); QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/NanumMyeongjo-Regular.ttf")); #endif QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/OpenSans-Regular.ttf")); QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/OpenSans-Bold.ttf")); QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/OpenSans-Semibold.ttf")); float64 dpi = primaryScreen()->logicalDotsPerInch(); if (dpi <= 108) { // 0-96-108 cSetScreenScale(dbisOne); } else if (dpi <= 132) { // 108-120-132 cSetScreenScale(dbisOneAndQuarter); } else if (dpi <= 168) { // 132-144-168 cSetScreenScale(dbisOneAndHalf); } else { // 168-192-inf cSetScreenScale(dbisTwo); } if (devicePixelRatio() > 1) { cSetRetina(true); cSetRetinaFactor(devicePixelRatio()); cSetIntRetinaFactor(int32(cRetinaFactor())); } if (!cLangFile().isEmpty()) { LangLoaderPlain loader(cLangFile()); if (!loader.errors().isEmpty()) { LOG(("Lang load errors: %1").arg(loader.errors())); } else if (!loader.warnings().isEmpty()) { LOG(("Lang load warnings: %1").arg(loader.warnings())); } } Local::start(); style::startManager(); anim::startManager(); historyInit(); DEBUG_LOG(("Application Info: inited..")); window = new Window(); psInstallEventFilter(); connect(&socket, SIGNAL(connected()), this, SLOT(socketConnected())); connect(&socket, SIGNAL(disconnected()), this, SLOT(socketDisconnected())); connect(&socket, SIGNAL(error(QLocalSocket::LocalSocketError)), this, SLOT(socketError(QLocalSocket::LocalSocketError))); connect(&socket, SIGNAL(bytesWritten(qint64)), this, SLOT(socketWritten(qint64))); connect(&socket, SIGNAL(readyRead()), this, SLOT(socketReading())); connect(&server, SIGNAL(newConnection()), this, SLOT(newInstanceConnected())); connect(this, SIGNAL(aboutToQuit()), this, SLOT(closeApplication())); connect(&updateCheckTimer, SIGNAL(timeout()), this, SLOT(startUpdateCheck())); connect(this, SIGNAL(updateFailed()), this, SLOT(onUpdateFailed())); connect(this, SIGNAL(updateReady()), this, SLOT(onUpdateReady())); connect(this, SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(onAppStateChanged(Qt::ApplicationState))); connect(&writeUserConfigTimer, SIGNAL(timeout()), this, SLOT(onWriteUserConfig())); writeUserConfigTimer.setSingleShot(true); connect(&killDownloadSessionsTimer, SIGNAL(timeout()), this, SLOT(killDownloadSessions())); if (cManyInstance()) { startApp(); } else { DEBUG_LOG(("Application Info: connecting local socket to %1..").arg(serverName)); socket.connectToServer(serverName); } }
Application::Application(int &argc, char **argv) : PsApplication(argc, argv), serverName(psServerPrefix() + cGUIDStr()), closing(false), updateRequestId(0), updateReply(0), updateThread(0), updateDownloader(0) { if (mainApp) { DEBUG_LOG(("Application Error: another Application was created, terminating..")); exit(0); } mainApp = this; installEventFilter(new _DebugWaiter(this)); QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/DejaVuSans.ttf")); QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/OpenSans-Regular.ttf")); QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/OpenSans-Bold.ttf")); QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/OpenSans-Semibold.ttf")); float64 dpi = primaryScreen()->logicalDotsPerInch(); if (dpi <= 108) { // 0-96-108 cSetScreenScale(dbisOne); } else if (dpi <= 132) { // 108-120-132 cSetScreenScale(dbisOneAndQuarter); } else if (dpi <= 168) { // 132-144-168 cSetScreenScale(dbisOneAndHalf); } else { // 168-192-inf cSetScreenScale(dbisTwo); } if (devicePixelRatio() > 1) { cSetRetina(true); cSetRetinaFactor(devicePixelRatio()); cSetIntRetinaFactor(int32(cRetinaFactor())); } if (!cLangFile().isEmpty()) { LangLoaderPlain loader(cLangFile()); if (!loader.errors().isEmpty()) { LOG(("Lang load errors: %1").arg(loader.errors())); } else if (!loader.warnings().isEmpty()) { LOG(("Lang load warnings: %1").arg(loader.warnings())); } } style::startManager(); anim::startManager(); historyInit(); window = new Window(); psInstallEventFilter(); updateCheckTimer.setSingleShot(true); connect(&socket, SIGNAL(connected()), this, SLOT(socketConnected())); connect(&socket, SIGNAL(disconnected()), this, SLOT(socketDisconnected())); connect(&socket, SIGNAL(error(QLocalSocket::LocalSocketError)), this, SLOT(socketError(QLocalSocket::LocalSocketError))); connect(&socket, SIGNAL(bytesWritten(qint64)), this, SLOT(socketWritten(qint64))); connect(&socket, SIGNAL(readyRead()), this, SLOT(socketReading())); connect(&server, SIGNAL(newConnection()), this, SLOT(newInstanceConnected())); connect(this, SIGNAL(aboutToQuit()), this, SLOT(closeApplication())); connect(&updateCheckTimer, SIGNAL(timeout()), this, SLOT(startUpdateCheck())); connect(this, SIGNAL(updateFailed()), this, SLOT(onUpdateFailed())); connect(this, SIGNAL(updateReady()), this, SLOT(onUpdateReady())); connect(&writeUserConfigTimer, SIGNAL(timeout()), this, SLOT(onWriteUserConfig())); writeUserConfigTimer.setSingleShot(true); if (cManyInstance()) { startApp(); } else { DEBUG_LOG(("Application Info: connecting local socket to %1..").arg(serverName)); socket.connectToServer(serverName); } }
void Dynamic::TagMatchBias::newQuery() { DEBUG_BLOCK; // ok, I need a new query maker m_qm.reset( CollectionManager::instance()->queryMaker() ); // -- set the querymaker if( m_filter.isDate() ) { switch( m_filter.condition ) { case MetaQueryWidget::LessThan: case MetaQueryWidget::Equals: case MetaQueryWidget::GreaterThan: m_qm->addNumberFilter( m_filter.field(), m_filter.numValue, (Collections::QueryMaker::NumberComparison)m_filter.condition ); break; case MetaQueryWidget::Between: m_qm->beginAnd(); m_qm->addNumberFilter( m_filter.field(), qMin(m_filter.numValue, m_filter.numValue2)-1, Collections::QueryMaker::GreaterThan ); m_qm->addNumberFilter( m_filter.field(), qMax(m_filter.numValue, m_filter.numValue2)+1, Collections::QueryMaker::LessThan ); m_qm->endAndOr(); break; case MetaQueryWidget::OlderThan: m_qm->addNumberFilter( m_filter.field(), QDateTime::currentDateTime().toTime_t() - m_filter.numValue, Collections::QueryMaker::LessThan ); break; default: ; } } else if( m_filter.isNumeric() ) { switch( m_filter.condition ) { case MetaQueryWidget::LessThan: case MetaQueryWidget::Equals: case MetaQueryWidget::GreaterThan: m_qm->addNumberFilter( m_filter.field(), m_filter.numValue, (Collections::QueryMaker::NumberComparison)m_filter.condition ); break; case MetaQueryWidget::Between: m_qm->beginAnd(); m_qm->addNumberFilter( m_filter.field(), qMin(m_filter.numValue, m_filter.numValue2)-1, Collections::QueryMaker::GreaterThan ); m_qm->addNumberFilter( m_filter.field(), qMax(m_filter.numValue, m_filter.numValue2)+1, Collections::QueryMaker::LessThan ); m_qm->endAndOr(); break; default: ; } } else { switch( m_filter.condition ) { case MetaQueryWidget::Equals: m_qm->addFilter( m_filter.field(), m_filter.value, true, true ); break; case MetaQueryWidget::Contains: if( m_filter.field() == 0 ) { // simple search // TODO: split different words and make separate searches m_qm->beginOr(); m_qm->addFilter( Meta::valArtist, m_filter.value ); m_qm->addFilter( Meta::valTitle, m_filter.value ); m_qm->addFilter( Meta::valAlbum, m_filter.value ); m_qm->addFilter( Meta::valGenre, m_filter.value ); m_qm->addFilter( Meta::valUrl, m_filter.value ); m_qm->addFilter( Meta::valComment, m_filter.value ); m_qm->addFilter( Meta::valLabel, m_filter.value ); m_qm->endAndOr(); } else { m_qm->addFilter( m_filter.field(), m_filter.value ); } break; default: ; } } m_qm->setQueryType( Collections::QueryMaker::Custom ); m_qm->addReturnValue( Meta::valUniqueId ); connect( m_qm.data(), SIGNAL(newResultReady(QStringList)), this, SLOT(updateReady(QStringList)), Qt::QueuedConnection ); connect( m_qm.data(), SIGNAL(queryDone()), this, SLOT(updateFinished()), Qt::QueuedConnection ); m_qm.data()->run(); }