IconThemesConfig::IconThemesConfig(QWidget *parent, const char *name) : KCModule(parent, name) { QVBoxLayout *topLayout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); QFrame *m_preview=new QFrame(this); m_preview->setMinimumHeight(50); QHBoxLayout *lh2=new QHBoxLayout( m_preview ); m_previewExec=new QLabel(m_preview); m_previewExec->setPixmap(DesktopIcon("exec")); m_previewFolder=new QLabel(m_preview); m_previewFolder->setPixmap(DesktopIcon("folder")); m_previewDocument=new QLabel(m_preview); m_previewDocument->setPixmap(DesktopIcon("document")); lh2->addStretch(10); lh2->addWidget(m_previewExec); lh2->addStretch(1); lh2->addWidget(m_previewFolder); lh2->addStretch(1); lh2->addWidget(m_previewDocument); lh2->addStretch(10); m_iconThemes=new KListView(this,"IconThemeList"); m_iconThemes->addColumn(i18n("Name")); m_iconThemes->addColumn(i18n("Description")); m_iconThemes->setAllColumnsShowFocus( true ); m_iconThemes->setFullWidth(true); connect(m_iconThemes,SIGNAL(selectionChanged(QListViewItem *)), SLOT(themeSelected(QListViewItem *))); QPushButton *installButton=new QPushButton( i18n("Install New Theme..."), this, "InstallNewTheme"); connect(installButton,SIGNAL(clicked()),SLOT(installNewTheme())); m_removeButton=new QPushButton( i18n("Remove Theme"), this, "RemoveTheme"); connect(m_removeButton,SIGNAL(clicked()),SLOT(removeSelectedTheme())); topLayout->addWidget( new QLabel(i18n("Select the icon theme you want to use:"), this)); topLayout->addWidget(m_preview); topLayout->addWidget(m_iconThemes); QHBoxLayout *lg = new QHBoxLayout(topLayout, KDialog::spacingHint()); lg->addWidget(installButton); lg->addWidget(m_removeButton); loadThemes(); load(); m_iconThemes->setFocus(); }
void IconThemesConfig::installNewTheme() { KURL themeURL = KURLRequesterDlg::getURL(QString::null, this, i18n("Drag or Type Theme URL")); kdDebug() << themeURL.prettyURL() << endl; if (themeURL.url().isEmpty()) return; QString themeTmpFile; // themeTmpFile contains the name of the downloaded file if (!KIO::NetAccess::download(themeURL, themeTmpFile, this)) { QString sorryText; if (themeURL.isLocalFile()) sorryText = i18n("Unable to find the icon theme archive %1."); else sorryText = i18n("Unable to download the icon theme archive;\n" "please check that address %1 is correct."); KMessageBox::sorry(this, sorryText.arg(themeURL.prettyURL())); return; } QStringList themesNames = findThemeDirs(themeTmpFile); if (themesNames.isEmpty()) { QString invalidArch(i18n("The file is not a valid icon theme archive.")); KMessageBox::error(this, invalidArch); KIO::NetAccess::removeTempFile(themeTmpFile); return; } if (!installThemes(themesNames, themeTmpFile)) { //FIXME: make me able to know what is wrong.... // QStringList instead of bool? QString somethingWrong = i18n("A problem occurred during the installation process; " "however, most of the themes in the archive have been installed"); KMessageBox::error(this, somethingWrong); } KIO::NetAccess::removeTempFile(themeTmpFile); KGlobal::instance()->newIconLoader(); loadThemes(); QListViewItem *item=iconThemeItem(KIconTheme::current()); m_iconThemes->setSelected(item, true); updateRemoveButton(); }
int hexchat_plugin_init(hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg){ ph = plugin_handle; *plugin_name = "mpcInfo"; *plugin_desc = "Information-Script for Media Player Classic"; *plugin_version=VERSION; hexchat_hook_command(ph, "mpc", HEXCHAT_PRI_NORM, mpc_tell,"no help text", 0); hexchat_hook_command(ph, "mpc_themes", HEXCHAT_PRI_NORM, print_themes,"no help text", 0); hexchat_hook_command(ph, "mpc_reloadthemes", HEXCHAT_PRI_NORM, mpc_themeReload,"no help text", 0); hexchat_command (ph, "MENU -ietc\\music.png ADD \"Window/Display Current Song (MPC)\" \"MPC\""); themeInit(); loadThemes(); hexchat_printf(ph, "%s %s plugin loaded\n",*plugin_name, VERSION); return 1; }
void IconThemesConfig::removeSelectedTheme() { QListViewItem *selected = m_iconThemes->selectedItem(); if (!selected) return; QString question=i18n("<qt>Are you sure you want to remove the " "<strong>%1</strong> icon theme?<br>" "<br>" "This will delete the files installed by this theme.</qt>"). arg(selected->text(0)); bool deletingCurrentTheme=(selected==iconThemeItem(KIconTheme::current())); int r=KMessageBox::warningContinueCancel(this,question,i18n("Confirmation"),KStdGuiItem::del()); if (r!=KMessageBox::Continue) return; KIconTheme icontheme(m_themeNames[selected->text(0)]); // delete the index file before the async KIO::del so loadThemes() will // ignore that dir. unlink(QFile::encodeName(icontheme.dir()+"/index.theme").data()); unlink(QFile::encodeName(icontheme.dir()+"/index.desktop").data()); KIO::del(KURL( icontheme.dir() )); KGlobal::instance()->newIconLoader(); loadThemes(); QListViewItem *item=0L; //Fallback to the default if we've deleted the current theme if (!deletingCurrentTheme) item=iconThemeItem(KIconTheme::current()); if (!item) item=iconThemeItem(KIconTheme::defaultThemeName()); m_iconThemes->setSelected(item, true); updateRemoveButton(); if (deletingCurrentTheme) // Change the configuration save(); }
AppearanceSettings::AppearanceSettings(QWidget* parent, Qt::WFlags fl) : QDialog(parent, fl), m_isStatusView(false) { initUi(); loadThemes(); loadColorSchemes(); loadSavedTheme(); connect(qApp, SIGNAL(appMessage(QString,QByteArray)), this, SLOT(receiveAppMessage(QString,QByteArray))); QMenu *menu = QSoftMenuBar::menuFor(this); menu->addAction(QIcon(":icon/Note"), tr("Add to current profile"), this, SLOT(pushSettingStatus())); menu->addAction(QIcon(":image/homescreen/homescreen"), tr("Homescreen Settings..."), this, SLOT(openHomescreenSettings())); setWindowTitle(tr("Appearance")); }
void AppearanceSettings::themeChanged(int index) { // Launch web browser for more themes if(index == (m_themeCombo->count() - 1)) { QProcess::execute("arora", QStringList() << "http://qtmoko.sourceforge.net/apps/category-themes.html"); QStringListModel *model = qobject_cast<QStringListModel *>(m_themeCombo->model()); QStringList oldThemes = model->stringList(); loadThemes(); // Find theme which was installed model = qobject_cast<QStringListModel *>(m_themeCombo->model()); QStringList newThemes = model->stringList(); for(int i = 0; i < newThemes.count(); i++) { if(oldThemes.count() <= i || oldThemes[i] != newThemes[i]) { m_prevIndex = i; break; } } m_themeCombo->setCurrentIndex(m_prevIndex); return; } Theme *theme = m_themes.value(index, 0); if (!theme) return; m_prevIndex = index; QStringListModel *model; model = qobject_cast<QStringListModel *>(m_colorCombo->model()); model->setStringList(theme->colorSchemeNames()); m_colorCombo->setCurrentIndex(theme->currentColorIndex()); model = qobject_cast<QStringListModel *>(m_backgroundCombo->model()); model->setStringList(theme->backgrounds()); m_backgroundCombo->setCurrentIndex(theme->currentBackgroundIndex()); }
static int mpc_themeReload(char *word[], char *word_eol[], void *userdata){ themeInit(); loadThemes(); return HEXCHAT_EAT_ALL; }
KNotePrintSelectThemeComboBox::KNotePrintSelectThemeComboBox(QWidget *parent) : QComboBox(parent) { loadThemes(); }