这篇教程C++ GetMythDB函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetMythDB函数的典型用法代码示例。如果您正苦于以下问题:C++ GetMythDB函数的具体用法?C++ GetMythDB怎么用?C++ GetMythDB使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetMythDB函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetMythDBvoid LCD::SetupLCD (void){ QString lcd_host; int lcd_port; if (m_lcd) { delete m_lcd; m_lcd = NULL; m_serverUnavailable = false; } lcd_host = GetMythDB()->GetSetting("LCDServerHost", "localhost"); lcd_port = GetMythDB()->GetNumSetting("LCDServerPort", 6545); m_enabled = GetMythDB()->GetNumSetting("LCDEnable", 0); // workaround a problem with Ubuntu not resolving localhost properly if (lcd_host == "localhost") lcd_host = "127.0.0.1"; if (m_enabled && lcd_host.length() > 0 && lcd_port > 1024) { LCD *lcd = LCD::Get(); if (lcd->connectToHost(lcd_host, lcd_port) == false) { delete m_lcd; m_lcd = NULL; m_serverUnavailable = false; } }}
开发者ID:DragonStalker,项目名称:mythtv,代码行数:31,
示例2: GetMythDBMSqlQueryInfo MSqlQuery::InitCon(ConnectionReuse _reuse){ bool reuse = kNormalConnection == _reuse; MSqlDatabase *db = GetMythDB()->GetDBManager()->popConnection(reuse); MSqlQueryInfo qi; InitMSqlQueryInfo(qi); // Bootstrapping without a database? //if (db->pretendHaveDB) if (db->m_db.hostName().isEmpty()) { // Return an invalid database so that QSqlQuery does nothing. // Also works around a Qt4 bug where QSqlQuery::~QSqlQuery // calls QMYSQLResult::cleanup() which uses mysql_next_result() GetMythDB()->GetDBManager()->pushConnection(db); qi.returnConnection = false; return qi; } qi.db = db; qi.qsqldb = db->db(); db->KickDatabase(); return qi;}
开发者ID:DaveDaCoda,项目名称:mythtv,代码行数:29,
示例3: GetMythDBvoid MythLocale::Init(const QString &localeName){ QString dbLanguage = GetMythDB()->GetSetting("Language", ""); QString dbCountry = GetMythDB()->GetSetting("Country", ""); if (!localeName.isEmpty()) { m_localeCode = localeName; } else if (!dbLanguage.isEmpty() && !dbCountry.isEmpty()) { QString langcode = dbLanguage.section('_',0,0); m_localeCode = QString("%1_%2").arg(langcode) .arg(dbCountry.toUpper()); } else { QLocale locale = QLocale::system(); if (locale.name().isEmpty() || locale.name() == "C") { // If all else has failed use the US locale m_localeCode = "en_US"; } else m_localeCode = locale.name(); } m_qtLocale = QLocale(m_localeCode);}
开发者ID:DaveDaCoda,项目名称:mythtv,代码行数:31,
示例4: trvoid EditAlbumartDialog::showMenu(void ){ QString label = tr("Options"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythDialogBox *menu = new MythDialogBox(label, popupStack, "optionsmenu"); if (!menu->Create()) { delete menu; return; } menu->SetReturnEvent(this, "optionsmenu"); menu->AddButton(tr("Edit Metadata")); menu->AddButton(tr("Rescan For Images")); menu->AddButton(tr("Search Internet For Images")); if (m_coverartList->GetItemCurrent()) { menu->AddButton(tr("Change Image Type"), NULL, true); if (GetMythDB()->GetNumSetting("AllowTagWriting", 0)) { MythUIButtonListItem *item = m_coverartList->GetItemCurrent(); if (item) { AlbumArtImage *image = qVariantValue<AlbumArtImage*> (item->GetData()); if (image) { if (!image->embedded) { if (m_metadata->getTagger()->supportsEmbeddedImages()) menu->AddButton(tr("Copy Selected Image To Tag")); } else { if (m_metadata->getTagger()->supportsEmbeddedImages()) menu->AddButton(tr("Remove Selected Image From Tag")); } } } } } if (GetMythDB()->GetNumSetting("AllowTagWriting", 0)) { if (m_metadata->getTagger()->supportsEmbeddedImages()) menu->AddButton(tr("Copy Image To Tag")); } menu->AddButton(tr("Cancel")); popupStack->AddScreen(menu);}
开发者ID:daveyboyc,项目名称:mythtv,代码行数:57,
示例5: GetThemesParentDir/** * /brief Returns the full path to the theme denoted by themename * * If the theme cannot be found falls back to the DEFAULT_UI_THEME. * If the DEFAULT_UI_THEME doesn't exist then returns an empty string. * /param themename The theme name. * /return Path to theme or empty string. */QString MythUIHelper::FindThemeDir(const QString &themename){ QString testdir; QDir dir; if (!themename.isEmpty()) { testdir = d->m_userThemeDir + themename; dir.setPath(testdir); if (dir.exists()) return testdir; testdir = GetThemesParentDir() + themename; dir.setPath(testdir); if (dir.exists()) return testdir; LOG(VB_GENERAL, LOG_WARNING, LOC + QString("No theme dir: '%1'") .arg(dir.absolutePath())); } testdir = GetThemesParentDir() + DEFAULT_UI_THEME; dir.setPath(testdir); if (dir.exists()) { LOG(VB_GENERAL, LOG_ERR, LOC + QString("Could not find theme: %1 - Switching to %2") .arg(themename).arg(DEFAULT_UI_THEME)); GetMythDB()->OverrideSettingForSession("Theme", DEFAULT_UI_THEME); return testdir; } LOG(VB_GENERAL, LOG_WARNING, LOC + QString("No default theme dir: '%1'") .arg(dir.absolutePath())); testdir = GetThemesParentDir() + FALLBACK_UI_THEME; dir.setPath(testdir); if (dir.exists()) { LOG(VB_GENERAL, LOG_ERR, LOC + QString("Could not find theme: %1 - Switching to %2") .arg(themename).arg(FALLBACK_UI_THEME)); GetMythDB()->OverrideSettingForSession("Theme", FALLBACK_UI_THEME); return testdir; } LOG(VB_GENERAL, LOG_ERR, LOC + QString("No fallback GUI theme dir: '%1'") .arg(dir.absolutePath())); return QString();}
开发者ID:chadparry,项目名称:mythtv,代码行数:64,
示例6: GetMythDBvoid MythThemedMenu::customEvent(QEvent *event){ if (event->type() == DialogCompletionEvent::kEventType) { DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); //int buttonnum = dce->GetResult(); QString halt_cmd = GetMythDB()->GetSetting("HaltCommand"); QString reboot_cmd = GetMythDB()->GetSetting("RebootCommand"); if (resultid == "popmenu") { QString action = dce->GetData().toString(); if (action == "shutdown") { if (!halt_cmd.isEmpty()) myth_system(halt_cmd); } else if (action == "reboot") { if (!reboot_cmd.isEmpty()) myth_system(reboot_cmd); } else if (action == "about") { aboutScreen(); } else if (action == "standby") { QString arg("standby_mode"); m_state->m_callback(m_state->m_callbackdata, arg); } } else if (resultid == "password") { QString text = dce->GetResultText(); MythUIButtonListItem *item = m_buttonList->GetItemCurrent(); ThemedButton button = item->GetData().value<ThemedButton>(); QString password = GetMythDB()->GetSetting(button.password); if (text == password) { QString timestamp_setting = QString("%1Time").arg(button.password); QDateTime curr_time = QDateTime::currentDateTime(); QString last_time_stamp = curr_time.toString(Qt::TextDate); GetMythDB()->SetSetting(timestamp_setting, last_time_stamp); GetMythDB()->SaveSetting(timestamp_setting, last_time_stamp); buttonAction(item, true); } } m_menuPopup = NULL; }}
开发者ID:killerkiwi,项目名称:mythtv,代码行数:54,
示例7: MythUITextMythUIClock::MythUIClock(MythUIType *parent, const QString &name) : MythUIText(parent, name){ m_DateFormat = GetMythDB()->GetSetting("DateFormat", "ddd d MMMM"); m_ShortDateFormat = GetMythDB()->GetSetting("ShortDateFormat", "ddd d"); m_TimeFormat = GetMythDB()->GetSetting("TimeFormat", "hh:mm"); m_Format = QString("%1, %2").arg(m_DateFormat).arg(m_TimeFormat); m_Flash = false;}
开发者ID:StefanRoss,项目名称:mythtv,代码行数:11,
示例8: QString/** /brief Queries the user for a password to enter a part of MythTV * restricted by a password. * * /param timestamp_setting time settings to be checked * /param password_setting password to be checked * /param text the message text to be displayed * /return true if password checks out or is not needed. */bool MythThemedMenu::checkPinCode(const QString &password_setting){ QString timestamp_setting = QString("%1Time").arg(password_setting); QDateTime curr_time = QDateTime::currentDateTime(); QString last_time_stamp = GetMythDB()->GetSetting(timestamp_setting); QString password = GetMythDB()->GetSetting(password_setting); // Password empty? Then skip asking for it if (password.isEmpty()) return true; if (last_time_stamp.length() < 1) { LOG(VB_GENERAL, LOG_ERR, "MythThemedMenu: Could not read password/pin time stamp./n" "This is only an issue if it happens repeatedly."); } else { QDateTime last_time = QDateTime::fromString(last_time_stamp, Qt::TextDate); if (last_time.secsTo(curr_time) < 120) { last_time_stamp = curr_time.toString(Qt::TextDate); GetMythDB()->SetSetting(timestamp_setting, last_time_stamp); GetMythDB()->SaveSetting(timestamp_setting, last_time_stamp); return true; } } LOG(VB_GENERAL, LOG_INFO, QString("Using Password: %1") .arg(password_setting)); QString text = tr("Enter password:"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythTextInputDialog *dialog = new MythTextInputDialog(popupStack, text, FilterNone, true); if (dialog->Create()) { dialog->SetReturnEvent(this, "password"); popupStack->AddScreen(dialog); } else delete dialog; return false;}
开发者ID:killerkiwi,项目名称:mythtv,代码行数:56,
示例9: ResetTimer void ResetTimer(void) { LOG(VB_PLAYBACK, LOG_DEBUG, LOC + "ResetTimer -- begin"); StopTimer(); if (m_timeoutInterval == -1) { m_timeoutInterval = GetMythDB()->GetNumSettingOnHost( "xscreensaverInterval", GetMythDB()->GetHostName(), 50) * 1000; } if (m_timeoutInterval > 0) StartTimer(); LOG(VB_PLAYBACK, LOG_DEBUG, LOC + "ResetTimer -- end"); }
开发者ID:StefanRoss,项目名称:mythtv,代码行数:17,
示例10: GetMythDBQString Myth::GetFormatDate(const QDateTime Date, bool ShortDate){ QString dateFormat; if (ShortDate) dateFormat = gCoreContext->GetSetting("ShortDateFormat", "ddd d"); else dateFormat = GetMythDB()->GetSetting("DateFormat", "ddd d MMMM"); return gCoreContext->GetQLocale().toString(Date, dateFormat);}
开发者ID:JGunning,项目名称:OpenAOL-TV,代码行数:10,
示例11: LOGbool MSqlQuery::prepare(const QString& query){ if (!m_db) { // Database structure's been deleted return false; } m_last_prepared_query = query;#ifdef DEBUG_QT4_PORT if (query.contains(m_testbindings)) { LOG(VB_GENERAL, LOG_DEBUG, QString("/n/nQuery contains bind value /"%1/" twice:/n/n/n") .arg(m_testbindings.cap(1)) + query);#if 0 exit(1);#endif }#endif // Database connection down. Try to restart it, give up if it's still // down if (!m_db) { // Database structure has been deleted... return false; } if (!m_db->isOpen() && !Reconnect()) { LOG(VB_GENERAL, LOG_INFO, "MySQL server disconnected"); return false; } bool ok = QSqlQuery::prepare(query); // if the prepare failed with "MySQL server has gone away" // Close and reopen the database connection and retry the query if it // connects again if (!ok && QSqlQuery::lastError().number() == 2006 && Reconnect()) ok = true; if (!ok && !(GetMythDB()->SuppressDBMessages())) { LOG(VB_GENERAL, LOG_ERR, QString("Error preparing query: %1").arg(query)); LOG(VB_GENERAL, LOG_ERR, MythDB::DBErrorMessage(QSqlQuery::lastError())); } return ok;}
开发者ID:stunami,项目名称:mythtv,代码行数:54,
示例12: GetConfDirQString MythUIHelper::GetThemeCacheDir(void){ QString cachedirname = GetConfDir() + "/cache/themecache/"; QString tmpcachedir = cachedirname + GetMythDB()->GetSetting("Theme", DEFAULT_UI_THEME) + "." + QString::number(d->m_screenwidth) + "." + QString::number(d->m_screenheight); return tmpcachedir;}
开发者ID:chadparry,项目名称:mythtv,代码行数:11,
示例13: GetMythDBvoid MythUIHelper::Init(MythUIMenuCallbacks &cbs){ d->Init(); d->callbacks = cbs; d->m_maxCacheSize.fetchAndStoreRelease( GetMythDB()->GetNumSetting("UIImageCacheSize", 30) * 1024 * 1024); LOG(VB_GUI, LOG_INFO, LOC + QString("MythUI Image Cache size set to %1 bytes") .arg(d->m_maxCacheSize.fetchAndAddRelease(0)));}
开发者ID:chadparry,项目名称:mythtv,代码行数:12,
示例14: saveAllvoid EditMetadataCommon::saveAll(){ if (GetMythDB()->GetNumSetting("AllowTagWriting", 0)) { MetaIO *tagger = m_metadata->getTagger(); if (tagger) tagger->write(m_metadata); } saveToDatabase(); cleanupAndClose();}
开发者ID:daveyboyc,项目名称:mythtv,代码行数:14,
示例15: commitVolatileMetadata/** * /brief Write the changable metadata, e.g. ratings, playcounts; to the * /p filename if the tag format supports it. * * Creates a /p MetaIO object using /p Decoder::doCreateTagger and * asks the MetaIO object to write changes to a specific subset of metadata * to /p filename. * * /params mdata the metadata to write to the disk */void Decoder::commitVolatileMetadata(const Metadata *mdata){ if (!mdata || !GetMythDB()->GetNumSetting("AllowTagWriting", 0)) return; MetaIO* p_tagger = doCreateTagger(); if (p_tagger) { p_tagger->writeVolatileMetadata(mdata); delete p_tagger; } mdata->UpdateModTime();}
开发者ID:txase,项目名称:mythtv,代码行数:24,
示例16: cancelPopupvoid EditMetadataDialog::saveAll(){ cancelPopup(); if (GetMythDB()->GetNumSetting("AllowTagWriting", 0)) { Decoder *decoder = Decoder::create(m_metadata->Filename(), NULL, NULL, true); if (decoder) { decoder->commitMetadata(m_metadata); delete decoder; } } saveToDatabase();}
开发者ID:Openivo,项目名称:mythtv,代码行数:16,
示例17: GetMythDBvoid DBConfiguration::SetValue( const QString &sSetting, QString sValue ) { GetMythDB()->SaveSetting( sSetting, sValue );}
开发者ID:jhludwig,项目名称:mythtv,代码行数:4,
示例18: LOGbool MSqlQuery::prepare(const QString& query){ if (!m_db) { // Database structure's been deleted return false; } m_last_prepared_query = query;#ifdef DEBUG_QT4_PORT if (query.contains(m_testbindings)) { LOG(VB_GENERAL, LOG_DEBUG, QString("/n/nQuery contains bind value /"%1/" twice:/n/n/n") .arg(m_testbindings.cap(1)) + query);#if 0 exit(1);#endif }#endif // Database connection down. Try to restart it, give up if it's still // down if (!m_db) { // Database structure has been deleted... return false; } if (!m_db->isOpen() && !Reconnect()) { LOG(VB_GENERAL, LOG_INFO, "MySQL server disconnected"); return false; } // QT docs indicate that there are significant speed ups and a reduction // in memory usage by enabling forward-only cursors // // Unconditionally enable this since all existing uses of the database // iterate forward over the result set. setForwardOnly(true); bool ok = QSqlQuery::prepare(query); // if the prepare failed with "MySQL server has gone away" // Close and reopen the database connection and retry the query if it // connects again if (!ok && QSqlQuery::lastError().number() == 2006 && Reconnect()) ok = true; if (!ok && !(GetMythDB()->SuppressDBMessages())) { LOG(VB_GENERAL, LOG_ERR, QString("Error preparing query: %1").arg(query)); LOG(VB_GENERAL, LOG_ERR, MythDB::DBErrorMessage(QSqlQuery::lastError())); } return ok;}
开发者ID:DaveDaCoda,项目名称:mythtv,代码行数:61,
注:本文中的GetMythDB函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetNArray函数代码示例 C++ GetMyClass函数代码示例 |