bool FontSettings::fromSettings(const QString &category, const FormatDescriptions &descriptions, const QSettings *s) { clear(); if (!s->childGroups().contains(category)) return false; QString group = category; group += QLatin1Char('/'); m_family = s->value(group + QLatin1String(fontFamilyKey), defaultFixedFontFamily()).toString(); m_fontSize = s->value(group + QLatin1String(fontSizeKey), m_fontSize).toInt(); m_fontZoom= s->value(group + QLatin1String(fontZoomKey), m_fontZoom).toInt(); m_antialias = s->value(group + QLatin1String(antialiasKey), DEFAULT_ANTIALIAS).toBool(); if (s->contains(group + QLatin1String(schemeFileNamesKey))) { // Load the selected color scheme for the current theme auto schemeFileNames = s->value(group + QLatin1String(schemeFileNamesKey)).toMap(); if (schemeFileNames.contains(Utils::creatorTheme()->id())) { const QString scheme = schemeFileNames.value(Utils::creatorTheme()->id()).toString(); loadColorScheme(scheme, descriptions); } } return true; }
const ColorScheme* ColorSchemeManager::findColorScheme(const QString& name) { if ( name.isEmpty() ) return defaultColorScheme(); if ( _colorSchemes.contains(name) ) return _colorSchemes[name]; else { // look for this color scheme QString path = findColorSchemePath(name); if ( !path.isEmpty() && loadColorScheme(path) ) { return findColorScheme(name); } else { if (!path.isEmpty() && loadKDE3ColorScheme(path)) return findColorScheme(name); } qDebug() << "Could not find color scheme - " << name; return 0; } }
void ColorSchemeManager::loadAllColorSchemes() { qDebug() << "loadAllColorSchemes"; int success = 0; int failed = 0; QList<QString> nativeColorSchemes = listColorSchemes(); QListIterator<QString> nativeIter(nativeColorSchemes); while ( nativeIter.hasNext() ) { if ( loadColorScheme( nativeIter.next() ) ) success++; else failed++; } QList<QString> kde3ColorSchemes = listKDE3ColorSchemes(); QListIterator<QString> kde3Iter(kde3ColorSchemes); while ( kde3Iter.hasNext() ) { if ( loadKDE3ColorScheme( kde3Iter.next() ) ) success++; else failed++; } if ( failed > 0 ) qDebug() << "failed to load " << failed << " color schemes."; _haveLoadedAll = true; }
void KStars::printImage( bool usePrintDialog, bool useChartColors ) { //QPRINTER_FOR_NOW // KPrinter printer( true, QPrinter::HighResolution ); QPrinter printer( QPrinter::HighResolution ); printer.setFullPage( false ); //Set up the printer (either with the Print Dialog, //or using the default settings) bool ok( false ); if ( usePrintDialog ) { //QPRINTER_FOR_NOW // ok = printer.setup( this, i18n("Print Sky") ); QPrintDialog *dialog = KdePrint::createPrintDialog(&printer, this); dialog->setWindowTitle( i18n("Print Sky") ); if ( dialog->exec() == QDialog::Accepted ) ok = true; delete dialog; } else { //QPRINTER_FOR_NOW // ok = printer.autoConfigure(); ok = true; } if( ok ) { QApplication::setOverrideCursor( Qt::WaitCursor ); //Save current ColorScheme file name and switch to Star Chart //scheme (if requested) QString schemeName = data()->colorScheme()->fileName(); if ( useChartColors ) { loadColorScheme( "chart.colors" ); } map()->setupProjector(); map()->exportSkyImage( &printer ); //Restore old color scheme if necessary //(if printing was aborted, the ColorScheme is still restored) if ( useChartColors ) { loadColorScheme( schemeName ); map()->forceUpdate(); } QApplication::restoreOverrideCursor(); } }
bool FontSettings::fromSettings(const QString &category, const FormatDescriptions &descriptions, const QSettings *s) { clear(); if (!s->childGroups().contains(category)) return false; QString group = category; group += QLatin1Char('/'); m_family = s->value(group + QLatin1String(fontFamilyKey), defaultFixedFontFamily()).toString(); m_fontSize = s->value(group + QLatin1String(fontSizeKey), m_fontSize).toInt(); m_fontZoom= s->value(group + QLatin1String(fontZoomKey), m_fontZoom).toInt(); m_antialias = s->value(group + QLatin1String(antialiasKey), DEFAULT_ANTIALIAS).toBool(); if (s->contains(group + QLatin1String(schemeFileNameKey))) { // Load the selected color scheme QString scheme = s->value(group + QLatin1String(schemeFileNameKey)).toString(); if (scheme.isEmpty() || !QFile::exists(scheme)) scheme = defaultSchemeFileName(QFileInfo(scheme).fileName()); loadColorScheme(scheme, descriptions); } else { // Load color scheme from ini file foreach (const FormatDescription &desc, descriptions) { const TextStyle id = desc.id(); const QString fmt = s->value(group + Constants::nameForStyle(id), QString()).toString(); Format format; if (fmt.isEmpty()) { format.setForeground(desc.foreground()); format.setBackground(desc.background()); format.setBold(desc.format().bold()); format.setItalic(desc.format().italic()); } else { format.fromString(fmt); } m_scheme.setFormatFor(id, format); } m_scheme.setDisplayName(QCoreApplication::translate("TextEditor::Internal::FontSettings", "Customized")); } return true; }
/*! Constructs the Configuration. */ Configuration::Configuration() { loadColorScheme(COLOR_SCHEME_LIGHT); // Cable colors does not change with the color scheme // so it is specified here instead mDigitalCableColors[0] = Qt::black; mDigitalCableColors[1] = QColor("#A0522D"); // sienna (brown) mDigitalCableColors[2] = Qt::red; mDigitalCableColors[3] = QColor("#FFA500"); // orange mDigitalCableColors[4] = Qt::yellow; mDigitalCableColors[5] = QColor("#32CD32"); // lime green mDigitalCableColors[6] = Qt::blue; mDigitalCableColors[7] = QColor("#DA70D6"); // orchid (purple) mDigitalCableColors[8] = Qt::gray; mDigitalCableColors[9] = Qt::white; mDigitalCableColors[10] = Qt::black; mAnalogInCableColors[0] = Qt::black; mAnalogInCableColors[1] = Qt::red; mAnalogOutCableColors[0] = Qt::blue; mAnalogOutCableColors[1] = Qt::gray; }