void AppearanceSettings::applyCurrentSettings() { Theme *theme = currentTheme(); if (!theme) return; bool needsRestart = themeNeedsRestart(theme); if (needsRestart) { if (QMessageBox::warning(this, tr("Restart?"), tr("Device will be restarted for theme to be fully applied.<br>Apply Now?"), QMessageBox::Yes, QMessageBox::No) != QMessageBox::Yes) { return; } } bool themeChanged = (theme->uniqueName() + ".conf" != m_savedTheme); bool colorSchemeChanged = (theme->colorSchemeNames()[theme->currentColorIndex()] + ".scheme" != m_savedColorScheme); bool backgroundChanged = (theme->backgrounds()[theme->currentBackgroundIndex()] != m_savedBackground); bool softKeyLabelTypeChanged = (m_softKeyIconCheck->isChecked() ? QSoftMenuBar::IconLabel : QSoftMenuBar::TextLabel) != m_savedLabelType; qLog(UI) << "Theme settings changed?" << themeChanged << colorSchemeChanged << backgroundChanged <<softKeyLabelTypeChanged; // write config settings if (themeChanged) theme->writeThemeSettings(theme->uniqueName() + ".conf" != m_themeCombo->currentText()); if (colorSchemeChanged) theme->writeColorSchemeSettings(); // apply changes if (themeChanged || colorSchemeChanged) { QtopiaChannel::send("QPE/System", "applyStyle()"); if (themeChanged) QtopiaChannel::send("QPE/System", "applyStyleSplash()"); else QtopiaChannel::send("QPE/System", "applyStyleNoSplash()"); } if (backgroundChanged) applyBackgroundImage(); if (softKeyLabelTypeChanged) applySoftKeyLabels(); if (!theme->stringValue(Theme::ServerWidgets).isEmpty()) { QSettings serverWidgetsConfig("Trolltech", "ServerWidgets"); serverWidgetsConfig.beginGroup("Mapping"); serverWidgetsConfig.remove(""); //delete all entries in current grp serverWidgetsConfig.setValue("Default", theme->stringValue(Theme::ServerWidgets)); if (needsRestart) { QtopiaIpcEnvelope env("QPE/System", "restart()"); QtopiaApplication::quit(); } } }
void AppearanceSettings::backgroundChanged(int index) { Theme *theme = currentTheme(); if (theme) { theme->setCurrentBackgroundIndex(index); QTimer::singleShot(0, this, SLOT(previewBackgroundChanges())); } }
void AppearanceSettings::colorChanged(int index) { Theme *theme = currentTheme(); if (theme) { theme->setCurrentColorIndex(index); QTimer::singleShot(0, this, SLOT(previewColorChanges())); } }
void AppearanceSettings::previewSoftMenuBarChanges() { Theme *theme = currentTheme(); if (theme) { QPixmap pm; QSoftMenuBar::LabelType labelType = (m_softKeyIconCheck->isChecked() ? QSoftMenuBar::IconLabel : QSoftMenuBar::TextLabel); theme->getSoftMenuBarPreview(&pm, labelType); m_previewSoftMenuBar->setPixmap( pm.scaledToWidth(int(pm.width() * 0.55), Qt::SmoothTransformation)); m_previewBox->show(); } }
void AppearanceSettings::previewColorChanges() { Theme *theme = currentTheme(); if (theme) { QPixmap pm; theme->getTitlePreview(&pm); m_previewTitle->setPixmap( pm.scaledToWidth(int(pm.width() * 0.55), Qt::SmoothTransformation)); previewSoftMenuBarChanges(); m_previewBox->show(); } }
void TerraStat::empiricalBayesAction_activated() { if (currentDatabase() && currentView() && currentLayer() && currentTheme() ) { BayesWindow *bayes = new BayesWindow(); bayes->exec(); delete bayes; return; } QString msg; if(currentDatabase() == 0) msg = tr("Select a database!"); else if(currentLayer() == 0) msg = tr("Select a layer!"); else if(currentView() == 0) msg = tr("Select a view!"); else if(currentTheme() == 0) msg = tr("Select a theme!"); QMessageBox::warning(this, tr("Warning"), msg); }
void AppearanceSettings::previewBackgroundChanges() { Theme *theme = currentTheme(); if (theme) { QDesktopWidget *dw = QApplication::desktop(); QSize screenSize = dw->screenGeometry(dw->primaryScreen()).size(); QPixmap pm; theme->getBackgroundPreview(&pm); m_previewBackground->setPixmap( pm.scaled(int(screenSize.width() * 0.2), int(screenSize.height() * 0.2), Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); m_previewBox->show(); } }
int main(int argc, char *argv[]) { QApplication app(argc, argv); LxQt::LxQtTheme theme = currentTheme(); if(QFile::exists(theme.path()+"/lightdm-lxqt-greeter.qss")){ app.setStyleSheet( "file:///" + theme.path()+"/lightdm-lxqt-greeter.qss"); } //for (int i = 0; i < QApplication::desktop()->screenCount(); ++i){ Window * wnd = new Window(0); wnd->show(); //} //wnd->setFocus(Qt::OtherFocusReason); wnd->activateWindow(); return app.exec(); }