kweather::kweather(const TQString& configFile, Type t, int actions, TQWidget *parent, const char *name): KPanelApplet(configFile, t, actions, parent, name), weatherIface(), mFirstRun( false ), mReport( 0 ), mClient( 0 ), mContextMenu( 0 ), mWeatherService( 0 ), settingsDialog( 0 ), mTextColor(TQt::black) { kdDebug(12004) << "Constructor " << endl; setObjId("weatherIface"); setBackgroundOrigin( TQWidget::AncestorOrigin ); loadPrefs(); initContextMenu(); initDCOP(); dockWidget = new dockwidget(reportLocation, this, "dockwidget"); connect(dockWidget, TQT_SIGNAL(buttonClicked()), TQT_SLOT(doReport())); dockWidget->setViewMode(mViewMode); setLabelColor(); timeOut = new TQTimer(this, "timeOut" ); connect(timeOut, TQT_SIGNAL(timeout()), TQT_SLOT(timeout())); timeOut->start(10*60*1000); if(mFirstRun) preferences(); else timeout(); }
void StarMgr::setStelStyle(const QString& section) { // Load colors from config file QSettings* conf = StelApp::getInstance().getSettings(); QString defaultColor = conf->value(section+"/default_color").toString(); setLabelColor(StelUtils::strToVec3f(conf->value(section+"/star_label_color", defaultColor).toString())); }
void OverrideLabelTab::setFontSpecsIfDefault(const QFont &font, const qreal scale, const QColor &color) { if (_useDefault->isChecked()) { _fontDirty = false; setLabelFontScale(scale); setLabelFont(font); setLabelColor(color); } }
Label *TDDHelper::createLabel(const std::string &text, const int fontSize, const Color3B &color) { Label *label = Label::createWithSystemFont(text, TDD_FONT_NAME, fontSize); setLabelColor(label, color); return label; }
MenuItem *TDDHelper::createMenuItemWithFont(const char *name, const char *font, const ccMenuCallback& callback) { int fontSize = (int)(getBestScale() * TDD_FONT_SIZE1); Label *label = Label::createWithSystemFont(name, font, fontSize); setLabelColor(label, TDD_COLOR_BLUE2); return MenuItemLabel::create(label, callback); }
void IndicatorDisplay::createSettings(QGridLayout *layout) { DisplayInstrument::createSettings(layout); // Presets // Warning: do not change the order layout->addWidget(new QLabel("Load Preset", layout->parentWidget())); QComboBox *combobox = new QComboBox(layout->parentWidget()); combobox->addItem(""); // On/off types combobox->addItem("Brakes"); combobox->addItem("Gear"); combobox->addItem("Battery"); combobox->addItem("Engine Fire"); combobox->addItem("Fuel Pressure"); combobox->addItem("Oil Pressure"); combobox->addItem("Oil Temperature"); combobox->addItem("Fuel Low"); combobox->addItem("Ice Detected"); combobox->addItem("Beacon Lights"); combobox->addItem("Landing Lights"); combobox->addItem("Navigation Lights"); combobox->addItem("Taxi Lights"); combobox->addItem("Strobe Lights"); // Custom types combobox->addItem(""); combobox->addItem("Custom Dataref"); combobox->addItem("Custom Label"); // Value types combobox->addItem(""); combobox->addItem("Cabin Alt"); combobox->addItem("Total Fuel"); combobox->addItem("Outside Temp"); combobox->addItem("Cabin Pressure Rate"); combobox->addItem("Cabin AP Rate"); // Add to layout and connect layout->addWidget(combobox); connect(combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(loadPreset(int))); connect(combobox, SIGNAL(currentIndexChanged(int)), layout->parentWidget()->window(), SLOT(close())); // This is kindof a hack, but we need to close the window to reflect the changes to the gui // Standard settings createLineEditSetting(layout,"DataRef",_datarefName,SLOT(setDataRefName(QString))); createNumberInputSetting(layout,"Threshold",_threshold,SLOT(setThreshold(float))); createSliderSetting(layout,"Strength On",0,100,_strengthOn,SLOT(setStrengthOn(int))); createSliderSetting(layout,"Strength Off",0,100,_strengthOff,SLOT(setStrengthOff(int))); createLineEditSetting(layout,"Label On",_labelOn,SLOT(setLabelOn(QString))); createLineEditSetting(layout,"Label Off",_labelOff,SLOT(setLabelOff(QString))); createColorSetting(layout,"Label Color",_labelColor,SLOT(setLabelColor(QColor))); createCheckboxSetting(layout,"Show Value",_showValue,SLOT(setShowValue(bool))); createColorSetting(layout,"Value Color",_valueColor,SLOT(setValueColor(QColor))); createNumberInputSetting(layout,"Value Divisor",_valueDivisor,SLOT(setValueDivisor(float))); }
void KPropColor::getConfig() { // debug("kpropcolor::getConfig()"); if( ConfigObject ) { //debug printf("Group:"); ConfigObject->setGroup( Group.data() ); // debug("kpropcolor: group set."); QColor c = ConfigObject->readColorEntry( Key.data(), &defaultColor ); //debug("kpropcolor: reading config %s = %s",Key.data(), s.data() ); setLabelColor( c ); } }
void IndicatorLight::loadSettings(QSettings &settings) { PanelItem::loadSettings(settings); setDataRefName(settings.value("datarefname","sim/cockpit/misc/compass_indicated").toString()); setThreshold(settings.value("threshold","0.1").toDouble()); setStrengthOn(settings.value("strengthon","100").toInt()); setStrengthOff(settings.value("strengthoff","20").toInt()); setLabelOn(settings.value("labelon","BRAKES").toString()); setLabelOff(settings.value("labeloff","BRAKES").toString()); setLabelColor(QColor(settings.value("labelcolor","red").toString())); setGlowStrength(settings.value("glowstrength","80").toInt()); DEBUG << _datarefName; }
void IndicatorDisplay::loadSettings(QSettings &settings) { PanelItem::loadSettings(settings); setDataRefName(settings.value("datarefname","sim/cockpit/misc/compass_indicated").toString()); setThreshold(settings.value("threshold","0.1").toDouble()); setStrengthOn(settings.value("strengthon","100").toInt()); setStrengthOff(settings.value("strengthoff","20").toInt()); setLabelOn(settings.value("labelon","BRAKES").toString()); setLabelOff(settings.value("labeloff","BRAKES").toString()); setLabelColor(QColor(settings.value("labelcolor","white").toString())); setValueColor(QColor(settings.value("valuecolor","white").toString())); setShowValue(settings.value("showvalue","false").toString()=="true"); setValueDivisor(settings.value("valuedivisor","1").toInt()); DEBUG << _datarefName; }
MenuItem *TDDHelper::createMenuItemWithFont(const char *name, const char *font, Color3B color, const ccMenuCallback& callback) { // Label *label = Label::createWithSystemFont(value, _fontName, _fontSize); // if (MenuItemLabel::initWithLabel(label, callback)) // LabelTTF *label = LabelTTF::create(name, kDefaultFont, kDefaultFontSize); float scale = getBestScale(); int fontSize = (int)(getBestScale() * TDD_FONT_SIZE1); Label *label = Label::createWithSystemFont(name, font, fontSize ); setLabelColor(label, color); return MenuItemLabel::create(label, callback); }
void kweather::slotPrefsAccepted() { // Preferences have been saved in the config file by the TDECModule, // so read them out. loadPrefs(); dockWidget->setLocationCode(reportLocation); dockWidget->setViewMode(mViewMode); setLabelColor(); emit updateLayout(); if (logOn && !fileName.isEmpty()) { TQFile logFile(fileName); // Open the file, create it if not already exists if (logFile.open(IO_ReadWrite)) { if (logFile.size() == 0) { // Empty file, put the header TQTextStream logFileStream(&logFile); logFileStream << "Date,Wind Speed & Direction,Temperature,Pressure,Cover,Visibility,Current Weather" << endl; } logFile.close(); } else { kdDebug(12004) << "There was an error opening the file...." << endl; KMessageBox::sorry( this, i18n("For some reason a new log file could not be opened.\n" "Please check to see if your disk is full or if you have " "write access to the location you are trying to write to."), i18n("KWeather Error")); } } timeout(); }
void IndicatorLight::createSettings(QGridLayout *layout) { PanelItem::createSettings(layout); // Standard settings createLineEditSetting(layout,"DataRef",_datarefName,SLOT(setDataRefName(QString))); createNumberInputSetting(layout,"Threshold",_threshold,SLOT(setThreshold(float))); createSliderSetting(layout,"Strength On",0,100,_strengthOn,SLOT(setStrengthOn(int))); createSliderSetting(layout,"Strength Off",0,100,_strengthOff,SLOT(setStrengthOff(int))); createLineEditSetting(layout,"Label On",_labelOn,SLOT(setLabelOn(QString))); createLineEditSetting(layout,"Label Off",_labelOff,SLOT(setLabelOff(QString))); createColorSetting(layout,"Label Color",_labelColor,SLOT(setLabelColor(QColor))); createSliderSetting(layout,"Label Glow",0,100,_glowStrength,SLOT(setGlowStrength(int))); // Presets layout->addWidget(new QLabel("Load Preset", layout->parentWidget())); QComboBox *combobox = new QComboBox(layout->parentWidget()); combobox->addItem(""); combobox->addItem("Brakes"); combobox->addItem("Gear"); combobox->addItem("Battery"); combobox->addItem("Engine Fire"); combobox->addItem("Fuel Pressure"); combobox->addItem("Oil Pressure"); combobox->addItem("Oil Temperature"); combobox->addItem("Fuel Low"); combobox->addItem("Ice Detected"); combobox->addItem("Beacon Lights"); combobox->addItem("Landing Lights"); combobox->addItem("Navigation Lights"); combobox->addItem("Taxi Lights"); combobox->addItem("Strobe Lights"); layout->addWidget(combobox); connect(combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(loadPreset(int))); connect(combobox, SIGNAL(currentIndexChanged(int)), layout->parentWidget()->window(), SLOT(close())); // This is kindof a hack, but we need to close the window to reflect the changes to the gui }
void LabelItem::setFont(const QFont &f, const QColor &c) { setLabelColor(c); setLabelFont(f); setLabelScale(f.pointSize()); }
medAlgorithmPaintToolbox::medAlgorithmPaintToolbox(QWidget *parent ) : medSegmentationAbstractToolBox( parent), m_MinValueImage(0), m_MaxValueImage(500), m_strokeRadius(4), m_strokeLabel(1), m_paintState(PaintState::None) { QWidget *displayWidget = new QWidget(this); this->addWidget(displayWidget); this->setTitle(this->name()); QVBoxLayout * layout = new QVBoxLayout(displayWidget); m_strokeButton = new QPushButton( tr("Paint / Erase") , displayWidget); m_strokeButton->setToolTip(tr("Left-click: Start painting with specified label.\nRight-click: Erase painted voxels.")); m_strokeButton->setCheckable(true); m_magicWandButton = new QPushButton(tr("Magic Wand"), displayWidget); QPixmap pixmap(":medSegmentation/pixmaps/magic_wand.png"); QIcon buttonIcon(pixmap); m_magicWandButton->setIcon(buttonIcon); m_magicWandButton->setToolTip(tr("Magic wand to automatically paint similar voxels.")); m_magicWandButton->setCheckable(true); QHBoxLayout * addRemoveButtonLayout = new QHBoxLayout(); addRemoveButtonLayout->addWidget( m_strokeButton ); addRemoveButtonLayout->addWidget( m_magicWandButton ); layout->addLayout( addRemoveButtonLayout ); QHBoxLayout * brushSizeLayout = new QHBoxLayout(); m_brushSizeSlider = new QSlider(Qt::Horizontal, displayWidget); m_brushSizeSlider->setToolTip(tr("Changes the brush radius.")); m_brushSizeSlider->setValue(this->m_strokeRadius); m_brushSizeSlider->setRange(1, 10); m_brushSizeSlider->hide(); m_brushSizeSpinBox = new QSpinBox(displayWidget); m_brushSizeSpinBox->setToolTip(tr("Changes the brush radius.")); m_brushSizeSpinBox->setValue(this->m_strokeRadius); m_brushSizeSpinBox->setMinimum(1); m_brushSizeSpinBox->setMaximum(10); m_brushSizeSpinBox->hide(); m_brushRadiusLabel = new QLabel(tr("Brush Radius"), displayWidget); m_brushRadiusLabel->hide(); connect(m_brushSizeSpinBox, SIGNAL(valueChanged(int)),m_brushSizeSlider,SLOT(setValue(int)) ); connect(m_brushSizeSlider,SIGNAL(valueChanged(int)),m_brushSizeSpinBox,SLOT(setValue(int)) ); brushSizeLayout->addWidget(m_brushRadiusLabel); brushSizeLayout->addWidget( m_brushSizeSlider ); brushSizeLayout->addWidget( m_brushSizeSpinBox ); layout->addLayout( brushSizeLayout ); QHBoxLayout * magicWandLayout = new QHBoxLayout(); m_wandThresholdSizeSlider = new QSlider(Qt::Horizontal, displayWidget); m_wandThresholdSizeSlider->setValue(100); m_wandThresholdSizeSlider->setMinimum(0); m_wandThresholdSizeSlider->setMaximum(1000); m_wandThresholdSizeSlider->hide(); m_wandThresholdSizeSpinBox = new QDoubleSpinBox(displayWidget); m_wandThresholdSizeSpinBox->setMinimum(0); m_wandThresholdSizeSpinBox->setMaximum(1000000); m_wandThresholdSizeSpinBox->setDecimals(2); m_wandThresholdSizeSpinBox->hide(); this->setWandSpinBoxValue(100); connect(m_wandThresholdSizeSpinBox, SIGNAL(valueChanged(double)),this,SLOT(setWandSliderValue(double)) ); connect(m_wandThresholdSizeSlider,SIGNAL(valueChanged(int)),this,SLOT(setWandSpinBoxValue(int)) ); m_wand3DCheckbox = new QCheckBox (tr("3D"), displayWidget); m_wand3DCheckbox->setCheckState(Qt::Unchecked); m_wand3DCheckbox->hide(); magicWandLayout->addWidget( m_wand3DCheckbox ); magicWandLayout->addWidget( m_wandThresholdSizeSlider ); magicWandLayout->addWidget( m_wandThresholdSizeSpinBox ); layout->addLayout( magicWandLayout ); this->generateLabelColorMap(24); QHBoxLayout * labelSelectionLayout = new QHBoxLayout(); m_strokeLabelSpinBox = new QSpinBox(displayWidget); m_strokeLabelSpinBox->setToolTip(tr("Changes the painted label.")); m_strokeLabelSpinBox->setValue(this->m_strokeLabel); m_strokeLabelSpinBox->setMinimum(1); m_strokeLabelSpinBox->setMaximum(24); m_strokeLabelSpinBox->hide(); connect (m_strokeLabelSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setLabel(int))); m_labelColorWidget = new QPushButton(displayWidget); m_labelColorWidget->setToolTip(tr("Current label color")); m_labelColorWidget->setStyleSheet("background-color: rgb(255, 0, 0);border:0;border-radius: 0px;width:20px;height:20px;"); m_labelColorWidget->setCheckable(false); m_labelColorWidget->setText(""); m_labelColorWidget->hide(); connect(m_labelColorWidget, SIGNAL(clicked()), this, SLOT(setLabelColor())); m_colorLabel = new QLabel(tr("Label:"), displayWidget); m_colorLabel->hide(); labelSelectionLayout->addStretch(); labelSelectionLayout->addWidget(m_colorLabel ); labelSelectionLayout->addWidget( m_labelColorWidget ); labelSelectionLayout->addWidget( m_strokeLabelSpinBox ); layout->addLayout( labelSelectionLayout ); m_clearMaskButton = new QPushButton( tr("Clear Mask") , displayWidget); m_clearMaskButton->setToolTip(tr("Resets the mask.")); QHBoxLayout * dataButtonsLayout = new QHBoxLayout(); dataButtonsLayout->addWidget(m_clearMaskButton); layout->addLayout(dataButtonsLayout); connect (m_strokeButton, SIGNAL(pressed()), this, SLOT(activateStroke ())); connect (m_magicWandButton, SIGNAL(pressed()),this,SLOT(activateMagicWand())); connect (m_clearMaskButton, SIGNAL(pressed()), this, SLOT(clearMask())); connect(this->segmentationToolBox(), SIGNAL(inputChanged()), this, SLOT(updateMouseInteraction())); showButtons(false); }
void kweather::paletteChange(const TQPalette &) { setLabelColor(); }