Tag* Message::tag() const { if( m_subtype == Invalid ) return 0; Tag* t = new Tag( "message" ); if( m_to ) t->addAttribute( "to", m_to.full() ); if( m_from ) t->addAttribute( "from", m_from.full() ); if( !m_id.empty() ) t->addAttribute( "id", m_id ); if( !m_timestamp.empty() ) t->addAttribute( "timestamp", m_timestamp ); t->addAttribute( TYPE, typeString( m_subtype ) ); getLangs( m_bodies, m_body, "body", t ); getLangs( m_subjects, m_subject, "subject", t ); getLangs( m_htmls, m_html, "html", t ); if( !m_thread.empty() ) new Tag( t, "thread", m_thread ); StanzaExtensionList::const_iterator it = m_extensionList.begin(); for( ; it != m_extensionList.end(); ++it ) t->addChild( (*it)->tag() ); return t; }
Tag* Presence::tag() const { if( m_subtype == Invalid ) return 0; Tag* t = new Tag( "presence" ); if( m_to ) t->addAttribute( "to", m_to.full() ); if( m_from ) t->addAttribute( "from", m_from.full() ); const std::string& type = typeString( m_subtype ); if( !type.empty() ) { if( type != "available" ) t->addAttribute( "type", type ); } else { const std::string& show = showString( m_subtype ); if( !show.empty() ) new Tag( t, "show", show ); } new Tag( t, "priority", util::int2string( m_priority ) ); getLangs( m_stati, m_status, "status", t ); StanzaExtensionList::const_iterator it = m_extensionList.begin(); for( ; it != m_extensionList.end(); ++it ) t->addChild( (*it)->tag() ); return t; }
WikipediaSettings::WikipediaSettings(QWidget *p) : ToggleList(p) , state(Initial) , job(0) , spinner(0) , loader(0) { label->setText(i18n("Choose the wikipedia languages you want to use when searching for artist and album information.")); reload=new Action(i18n("Reload"), this); connect(reload, SIGNAL(triggered()), this, SLOT(getLangs())); available->addAction(reload); available->setContextMenuPolicy(Qt::ActionsContextMenu); }
Tag* Subscription::tag() const { if( m_subtype == Invalid ) return 0; Tag* t = new Tag( "presence" ); if( m_to ) t->addAttribute( "to", m_to.full() ); if( m_from ) t->addAttribute( "from", m_from.full() ); t->addAttribute( "type", typeString( m_subtype ) ); getLangs( m_stati, m_status, "status", t ); StanzaExtensionList::const_iterator it = m_extensionList.begin(); for( ; it != m_extensionList.end(); ++it ) t->addChild( (*it)->tag() ); return t; }
void WikipediaSettings::showEvent(QShowEvent *e) { if (Initial==state) { state=Loading; QByteArray data; QString fileName=localeFile(); if (QFile::exists(fileName)) { QFile f(fileName); QtIOCompressor compressor(&f); compressor.setStreamFormat(QtIOCompressor::GzipFormat); if (compressor.open(QIODevice::ReadOnly)) { data=compressor.readAll(); } } if (data.isEmpty()) { getLangs(); } else { showSpinner(); parseLangs(data); } } QWidget::showEvent(e); }
AppSettings::AppSettings(QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f) { // Loading libq4wine-core.so #ifdef RELEASE libq4wine.setFileName(_CORELIB_PATH_); #else libq4wine.setFileName("../q4wine-lib/libq4wine-core"); #endif if (!libq4wine.load()){ libq4wine.load(); } // Getting corelib calss pointer CoreLibClassPointer = (CoreLibPrototype *) libq4wine.resolve("createCoreLib"); CoreLib.reset((corelib *)CoreLibClassPointer(true)); setupUi(this); splitter.reset(new QSplitter(widgetContent)); splitter->addWidget(optionsTreeWidget); splitter->addWidget(optionsStack); QList<int> size; size << 150 << 150; splitter->setSizes(size); std::auto_ptr<QVBoxLayout> vlayout (new QVBoxLayout); vlayout->addWidget(splitter.release()); vlayout->setMargin(0); vlayout->setSpacing(0); widgetContent->setLayout(vlayout.release()); setWindowTitle(tr("%1 settings").arg(APP_NAME)); setWindowIcon(CoreLib->loadIcon(CoreLib->getSetting("app", "icon", false, "q4wine").toString())); connect(optionsTree, SIGNAL(itemClicked (QTreeWidgetItem *, int)), this, SLOT(optionsTree_itemClicked ( QTreeWidgetItem *, int))); connect(cmdCancel, SIGNAL(clicked()), this, SLOT(cmdCancel_Click())); connect(cmdOk, SIGNAL(clicked()), this, SLOT(cmdOk_Click())); connect(cmdHelp, SIGNAL(clicked()), this, SLOT(cmdHelp_Click())); connect(cmdVersionManager, SIGNAL(clicked()), this, SLOT(cmdVersionManager_Click())); connect(comboProxyType, SIGNAL(currentIndexChanged(QString)), this, SLOT(comboProxyType_indexChanged(QString))); //Installing event filters for get buttuns cmdGetTarBin->installEventFilter(this); cmdGetMountBin->installEventFilter(this); cmdGetUmountBin->installEventFilter(this); cmdGetSudoBin->installEventFilter(this); cmdGetGuiSudoBin->installEventFilter(this); cmdGetNiceBin->installEventFilter(this); cmdGetReniceBin->installEventFilter(this); cmdGetConsoleBin->installEventFilter(this); cmdGetShBin->installEventFilter(this); cmdGetDefPrefixPath->installEventFilter(this); QSettings settings(APP_SHORT_NAME, "default"); settings.beginGroup("logging"); connect (cbShowTray, SIGNAL(stateChanged (int)), this, SLOT(cbShowTray_stateChanged (int))); if (settings.value("autoClear", 1).toInt()==1){ cbClearLogs->setCheckState(Qt::Checked); } else { cbClearLogs->setCheckState(Qt::Unchecked); } settings.endGroup(); settings.beginGroup("app"); QString appIcon = settings.value("icon").toString(); if (appIcon == "q4wine-ambiance"){ comboAppIcons->setCurrentIndex(comboAppIcons->findText(tr("Ambient Light"))); } else if (appIcon == "q4wine-ambiance-dark"){ comboAppIcons->setCurrentIndex(comboAppIcons->findText(tr("Ambient Dark"))); } else { comboAppIcons->setCurrentIndex(comboAppIcons->findText(tr("Default"))); } if (settings.value("showTrareyIcon", 0).toInt()==1){ cbShowTray->setCheckState(Qt::Checked); } else { cbShowTray->setCheckState(Qt::Unchecked); } if (settings.value("showNotifications", 1).toInt()==1){ cbShowNotifications->setCheckState(Qt::Checked); } else { cbShowNotifications->setCheckState(Qt::Unchecked); } if (settings.value("minimizeToTray", 0).toInt()==1){ cbMinimizeToTray->setCheckState(Qt::Checked); } else { cbMinimizeToTray->setCheckState(Qt::Unchecked); } if (settings.value("minimizeToTrayAtAppStart", 0).toInt()==1){ cbMinimizeToTrayApp->setCheckState(Qt::Checked); } else { cbMinimizeToTrayApp->setCheckState(Qt::Unchecked); } loadThemeIcons(); getLangs(); if (settings.value("lang").toString().isEmpty()){ comboLangs->setCurrentIndex(comboLangs->findText(tr("System Default"))); } else { QString lName = settings.value("lang").toString(); //Strip q4wine_ from setting if any lName.replace("q4wine_", ""); comboLangs->setCurrentIndex(comboLangs->findText(QLocale(lName).nativeLanguageName())); } settings.endGroup(); settings.beginGroup("system"); txtTarBin->setText(settings.value("tar").toString()); txtMountBin->setText(settings.value("mount").toString()); txtUmountBin->setText(settings.value("umount").toString()); txtSudoBin->setText(settings.value("sudo").toString()); txtGuiSudoBin->setText(settings.value("gui_sudo").toString()); txtNiceBin->setText(settings.value("nice").toString()); txtReniceBin->setText(settings.value("renice").toString()); txtShBin->setText(settings.value("sh").toString()); settings.endGroup(); settings.beginGroup("console"); txtConsoleBin->setText(settings.value("bin").toString()); txtConsoleArgs->setText(settings.value("args").toString()); settings.endGroup(); settings.beginGroup("quickmount"); comboMountProfiles->setCurrentIndex(settings.value("type", 0).toInt()); connect(comboMountProfiles, SIGNAL(currentIndexChanged(int)), this, SLOT(comboMountProfiles_currentIndexChanged(int))); if (!settings.value("mount_drive_string").toString().isEmpty()) txtMountString->setText(settings.value("mount_drive_string").toString()); if (!settings.value("mount_image_string").toString().isEmpty()) txtMountImageString->setText(settings.value("mount_image_string").toString()); if (!settings.value("umount_string").toString().isEmpty()) txtUmountString->setText(settings.value("umount_string").toString()); settings.endGroup(); #ifdef WITH_ICOUTILS settings.beginGroup("icotool"); txtWrestoolBin->setText(settings.value("wrestool").toString()); txtIcotoolBin->setText(settings.value("icotool").toString()); settings.endGroup(); cmdGetWrestoolBin->installEventFilter(this); cmdGetIcotoolBin->installEventFilter(this); #else txtWrestoolBin->setEnabled(false); txtIcotoolBin->setEnabled(false); cmdGetWrestoolBin->setEnabled(false); cmdGetIcotoolBin->setEnabled(false); #endif settings.beginGroup("network"); txtProxyHost->setText(settings.value("host").toString()); txtProxyPort->setText(settings.value("port").toString()); txtProxyUser->setText(settings.value("user").toString()); txtProxyPass->setText(settings.value("pass").toString()); comboProxyType->setCurrentIndex(settings.value("type").toInt()); settings.endGroup(); #ifdef _OS_FREEBSD_ this->comboMountProfiles->removeItem(3); this->comboMountProfiles->removeItem(2); #endif #ifdef _OS_DARWIN_ this->comboMountProfiles->removeItem(3); this->comboMountProfiles->removeItem(2); this->comboMountProfiles->removeItem(1); this->comboMountProfiles->setItemText(0, tr("generic")); this->txtMountString->setEnabled(false); this->frameMount->setVisible(false); #endif settings.beginGroup("advanced"); txtDefPrefixPath->setText(settings.value("prefixDefaultPath").toString()); if (settings.value("openRunDialog", 0).toInt()==0){ cbOpenRunDialog->setChecked(false); } else { cbOpenRunDialog->setChecked(true); } if (settings.value("useSingleClick", 0).toInt()==0){ cbUseSingleClick->setChecked(false); } else { cbUseSingleClick->setChecked(true); } #if QT_VERSION >= 0x040500 if (settings.value("useNativeFileDialog", 1).toInt()==1){ cbUseNativeDialog->setChecked(true); } else { cbUseNativeDialog->setChecked(false); } #else cbUseNativeDialog->setEnabled(false); #endif QString res = settings.value("defaultDesktopSize").toString(); if (res.isEmpty()){ cboxDesktopSize->setCurrentIndex(0); } else { cboxDesktopSize->setCurrentIndex(cboxDesktopSize->findText(res)); } settings.endGroup(); settings.beginGroup("DesktopImport"); if (settings.value("remove", 0).toInt()==0){ cbRemoveDesktopFiles->setChecked(false); } else { cbRemoveDesktopFiles->setChecked(true); } if (settings.value("importAtStartup", 0).toInt()==0){ cbImportDesktopFilesAtStartup->setChecked(false); } else { cbImportDesktopFilesAtStartup->setChecked(true); } settings.endGroup(); settings.beginGroup("AppDB"); if (settings.value("useSystemBrowser", 1).toInt()==1){ cbUseSystemBrowser->setChecked(true); } else { cbUseSystemBrowser->setChecked(false); } settings.endGroup(); #ifndef _OS_DARWIN_ settings.beginGroup("Plugins"); if (settings.value("enableMenuDesktop", 1).toInt()==1){ cbEnableDesktopMenu->setChecked(true); } else { cbEnableDesktopMenu->setChecked(false); } settings.endGroup(); connect(cmdDesktopMenu_Regen, SIGNAL(clicked()), this, SLOT(cmdDesktopMenu_Regen_Click())); connect(cmdDesktopMenu_Remove, SIGNAL(clicked()), this, SLOT(cmdDesktopMenu_Remove_Click())); #else cbEnableDesktopMenu->setEnabled(false); cmdDesktopMenu_Regen->setEnabled(false); cmdDesktopMenu_Remove->setEnabled(false); #endif QList<QTreeWidgetItem *> items = optionsTree->findItems (tr("General"), Qt::MatchExactly); if (items.count()>0){ items.at(0)->setExpanded(true); optionsTree->setCurrentItem(items.at(0)); optionsStack->setCurrentIndex(0); tabwGeneral->setCurrentIndex(0); } cmdOk->setFocus(Qt::ActiveWindowFocusReason); return; }
AppSettings::AppSettings(QWidget * parent, Qt::WFlags f) : QDialog(parent, f) { // Loading libq4wine-core.so #ifdef RELEASE libq4wine.setFileName(_CORELIB_PATH_); #else libq4wine.setFileName("../q4wine-lib/libq4wine-core"); #endif if (!libq4wine.load()){ libq4wine.load(); } // Getting corelib calss pointer CoreLibClassPointer = (CoreLibPrototype *) libq4wine.resolve("createCoreLib"); CoreLib.reset((corelib *)CoreLibClassPointer(true)); setupUi(this); splitter.reset(new QSplitter(widgetContent)); splitter->addWidget(optionsTreeWidget); splitter->addWidget(optionsStack); QList<int> size; size << 150 << 150; splitter->setSizes(size); std::auto_ptr<QVBoxLayout> vlayout (new QVBoxLayout); vlayout->addWidget(splitter.release()); vlayout->setMargin(0); vlayout->setSpacing(0); widgetContent->setLayout(vlayout.release()); setWindowTitle(tr("%1 settings").arg(APP_NAME)); lblCaption->setText(tr("%1 settings").arg(APP_NAME)); connect(optionsTree, SIGNAL(itemClicked (QTreeWidgetItem *, int)), this, SLOT(optionsTree_itemClicked ( QTreeWidgetItem *, int))); connect(cmdCancel, SIGNAL(clicked()), this, SLOT(cmdCancel_Click())); connect(cmdOk, SIGNAL(clicked()), this, SLOT(cmdOk_Click())); connect(cmdHelp, SIGNAL(clicked()), this, SLOT(cmdHelp_Click())); connect(comboProxyType, SIGNAL(currentIndexChanged(QString)), this, SLOT(comboProxyType_indexChanged(QString))); //Installing event filters for get buttuns cmdGetWineBin->installEventFilter(this); cmdGetWineServerBin->installEventFilter(this); cmdGetWineLoaderBin->installEventFilter(this); cmdGetWineLibs->installEventFilter(this); cmdGetTarBin->installEventFilter(this); cmdGetMountBin->installEventFilter(this); cmdGetUmountBin->installEventFilter(this); cmdGetSudoBin->installEventFilter(this); cmdGetGuiSudoBin->installEventFilter(this); cmdGetNiceBin->installEventFilter(this); cmdGetReniceBin->installEventFilter(this); cmdGetConsoleBin->installEventFilter(this); cmdGetShBin->installEventFilter(this); QSettings settings(APP_SHORT_NAME, "default"); settings.beginGroup("wine"); txtWineBin->setText(settings.value("WineBin").toString()); txtWineServerBin->setText(settings.value("ServerBin").toString()); txtWineLoaderBin->setText(settings.value("LoaderBin").toString()); txtWineLibs->setText(settings.value("WineLibs").toString()); settings.endGroup(); settings.beginGroup("logging"); connect (cbShowTray, SIGNAL(stateChanged (int)), this, SLOT(cbShowTray_stateChanged (int))); if (settings.value("autoClear", 1).toInt()==1){ cbClearLogs->setCheckState(Qt::Checked); } else { cbClearLogs->setCheckState(Qt::Unchecked); } settings.endGroup(); settings.beginGroup("app"); if (settings.value("showTrareyIcon", 0).toInt()==1){ cbShowTray->setCheckState(Qt::Checked); } else { cbShowTray->setCheckState(Qt::Unchecked); } if (settings.value("showNotifications", 1).toInt()==1){ cbShowNotifications->setCheckState(Qt::Checked); } else { cbShowNotifications->setCheckState(Qt::Unchecked); } if (settings.value("minimizeToTray", 0).toInt()==1){ cbMinimizeToTray->setCheckState(Qt::Checked); } else { cbMinimizeToTray->setCheckState(Qt::Unchecked); } if (settings.value("minimizeToTrayAtAppStart", 0).toInt()==1){ cbMinimizeToTrayApp->setCheckState(Qt::Checked); } else { cbMinimizeToTrayApp->setCheckState(Qt::Unchecked); } listThemesView->clear(); std::auto_ptr<QListWidgetItem> iconItem (new QListWidgetItem(listThemesView, 0)); iconItem->setText("Default [Aughtor: Xavier Corredor Llano ([email protected]); License: GPL v.2.1]"); iconItem->setIcon(QIcon(":data/wine.png")); iconItem->setToolTip("Default"); listThemesView->setSelectionMode(QAbstractItemView::SingleSelection); QString themeDir=""; themeDir.append(QDir::homePath()); themeDir.append("/.config/"); themeDir.append(APP_SHORT_NAME); themeDir.append("/theme/"); getThemes(settings.value("theme").toString(), themeDir); loadThemeIcons(); if (settings.value("theme").toString()=="Default"){ listThemesView->setCurrentItem(iconItem.release()); } themeDir.clear(); #ifdef _OS_DARWIN_ themeDir.append(QDir::currentPath()); themeDir.append("/"); themeDir.append(APP_SHORT_NAME); themeDir.append(".app/Contents/Resources/theme"); #else themeDir.append(APP_PREF); themeDir.append("/share/"); themeDir.append(APP_SHORT_NAME); themeDir.append("/theme"); #endif getThemes(settings.value("theme").toString(), themeDir); getLangs(); if (settings.value("lang").toString().isEmpty()){ comboLangs->setCurrentIndex(comboLangs->findText(tr("System Default"))); } else { comboLangs->setCurrentIndex(comboLangs->findText(settings.value("lang").toString())); } settings.endGroup(); settings.beginGroup("system"); txtTarBin->setText(settings.value("tar").toString()); txtMountBin->setText(settings.value("mount").toString()); txtUmountBin->setText(settings.value("umount").toString()); txtSudoBin->setText(settings.value("sudo").toString()); txtGuiSudoBin->setText(settings.value("gui_sudo").toString()); txtNiceBin->setText(settings.value("nice").toString()); txtReniceBin->setText(settings.value("renice").toString()); txtShBin->setText(settings.value("sh").toString()); settings.endGroup(); settings.beginGroup("console"); txtConsoleBin->setText(settings.value("bin").toString()); txtConsoleArgs->setText(settings.value("args").toString()); settings.endGroup(); settings.beginGroup("quickmount"); comboMountProfiles->setCurrentIndex(settings.value("type", 0).toInt()); connect(comboMountProfiles, SIGNAL(currentIndexChanged(int)), this, SLOT(comboMountProfiles_currentIndexChanged(int))); if (!settings.value("mount_drive_string").toString().isEmpty()) txtMountString->setText(settings.value("mount_drive_string").toString()); if (!settings.value("mount_image_string").toString().isEmpty()) txtMountImageString->setText(settings.value("mount_image_string").toString()); if (!settings.value("umount_string").toString().isEmpty()) txtUmountString->setText(settings.value("umount_string").toString()); settings.endGroup(); #ifdef WITH_ICOUTILS settings.beginGroup("icotool"); txtWrestoolBin->setText(settings.value("wrestool").toString()); txtIcotoolBin->setText(settings.value("icotool").toString()); settings.endGroup(); cmdGetWrestoolBin->installEventFilter(this); cmdGetIcotoolBin->installEventFilter(this); #else txtWrestoolBin->setEnabled(false); txtIcotoolBin->setEnabled(false); cmdGetWrestoolBin->setEnabled(false); cmdGetIcotoolBin->setEnabled(false); #endif settings.beginGroup("network"); txtProxyHost->setText(settings.value("host").toString()); txtProxyPort->setText(settings.value("port").toString()); txtProxyUser->setText(settings.value("user").toString()); txtProxyPass->setText(settings.value("pass").toString()); comboProxyType->setCurrentIndex(settings.value("type").toInt()); settings.endGroup(); #ifdef _OS_FREEBSD_ this->comboMountProfiles->removeItem(3); this->comboMountProfiles->removeItem(2); #endif #ifdef _OS_DARWIN_ this->comboMountProfiles->removeItem(3); this->comboMountProfiles->removeItem(2); this->comboMountProfiles->removeItem(1); this->comboMountProfiles->setItemText(0, tr("generic")); this->txtMountString->setEnabled(false); this->frameMount->setVisible(false); #endif settings.beginGroup("advanced"); if (settings.value("openRunDialog", 0).toInt()==0){ cbOpenRunDialog->setChecked(false); } else { cbOpenRunDialog->setChecked(true); } if (settings.value("useSingleClick", 0).toInt()==0){ cbUseSingleClick->setChecked(false); } else { cbUseSingleClick->setChecked(true); } #if QT_VERSION >= 0x040500 if (settings.value("useNativeFileDialog", 1).toInt()==1){ cbUseNativeDialog->setChecked(true); } else { cbUseNativeDialog->setChecked(false); } #else cbUseNativeDialog->setEnabled(false); #endif QString res = settings.value("defaultDesktopSize").toString(); if (res.isEmpty()){ cboxDesktopSize->setCurrentIndex(0); } else { cboxDesktopSize->setCurrentIndex(cboxDesktopSize->findText(res)); } settings.endGroup(); settings.beginGroup("DesktopImport"); if (settings.value("remove", 0).toInt()==0){ cbRemoveDesktopFiles->setChecked(false); } else { cbRemoveDesktopFiles->setChecked(true); } if (settings.value("importAtStartup", 0).toInt()==0){ cbImportDesktopFilesAtStartup->setChecked(false); } else { cbImportDesktopFilesAtStartup->setChecked(true); } settings.endGroup(); settings.beginGroup("AppDB"); if (settings.value("useSystemBrowser", 1).toInt()==1){ cbUseSystemBrowser->setChecked(true); } else { cbUseSystemBrowser->setChecked(false); } settings.endGroup(); QList<QTreeWidgetItem *> items = optionsTree->findItems (tr("General"), Qt::MatchExactly); if (items.count()>0){ items.at(0)->setExpanded(true); optionsTree->setCurrentItem(items.at(0)); optionsStack->setCurrentIndex(0); tabwGeneral->setCurrentIndex(0); } cmdOk->setFocus(Qt::ActiveWindowFocusReason); return; }