void Widgets::updateStyle(QAction* act) { if (m_actDefaultStyle == act) { if (!m_styleName.isEmpty()) { qApp->setStyle(QStyleFactory::create(m_styleName)); m_groupThemesActions->setEnabled(false); m_officeStyle = Q_NULL; } } else if (m_actOffice2007Style == act) { m_officeStyle = new Qtitan::OfficeStyle(); m_officeStyle->setDialogsIgnored(false); qApp->setStyle(m_officeStyle); m_groupThemesActions->setEnabled(true); updateTheme(m_groupThemesActions->checkedAction()); } else if (m_actRibbonStyle == act) { m_officeStyle = new Qtitan::RibbonStyle(); m_officeStyle->setDialogsIgnored(false); qApp->setStyle(m_officeStyle); m_groupThemesActions->setEnabled(true); updateTheme(m_groupThemesActions->checkedAction()); } act->setChecked(true); }
WindowPreview::WindowPreview( TaskManager::TaskItem *task, int index, SmoothToolTip *toolTip) : QWidget(), m_background(new Plasma::FrameSvg(this)), m_iconSpace(NULL), m_previewSpace(NULL), m_highlite(), m_task(new Task(task, this)), m_toolTip(toolTip), m_previewSize(0, 0), m_hover(false), m_index(index), m_activateTimer(NULL), m_didPress(false), m_dragStartPosition() { setMouseTracking(true); setAcceptDrops(true); // m_background->setImagePath("widgets/button"); m_background->setImagePath("widgets/tasks"); m_background->setElementPrefix(NORMAL); m_background->setCacheAllRenderedFrames(true); setPreviewSize(); // placeholder for preview: if (toolTip->previewsAvailable()) { m_previewSpace = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Minimum); } switch (m_toolTip->applet()->previewLayout()) { case Applet::NewPreviewLayout: setNewLayout(); break; case Applet::ClassicPreviewLayout: default: setClassicLayout(); } setMaximumWidth(260); updateTheme(); connect(m_background, SIGNAL(repaintNeeded()), this, SLOT(updateTheme())); connect( task, SIGNAL(changed(::TaskManager::TaskChanges)), this, SLOT(updateTask(::TaskManager::TaskChanges))); connect(&m_highlite, SIGNAL(animate(qreal)), this, SLOT(repaint())); }
SmoothToolTip::SmoothToolTip(Applet *applet) : DelayedToolTip(applet), m_widget(new ToolTipWidget(this)), m_previews(), m_previewsAvailable(false), m_background(new Plasma::FrameSvg(this)), m_hover(false), m_menuShown(false), m_previewsUpdated(false), m_hoverPreview(NULL), m_highlightDelay(new QTimer(this)), m_highlighting(false), m_scrollAnimation(0), m_dx(0), m_xStart(0), m_dy(0), m_yStart(0), m_moveAnimation(false), m_moveAnimationUpdated(false), m_position(0), m_size(0, 0), m_closeIcon(), m_hoverCloseIcon() { connect( Plasma::Animator::self(), SIGNAL(customAnimationFinished(int)), this, SLOT(animationFinished(int))); connect( applet, SIGNAL(mouseEnter()), this, SLOT(stopEffect())); previewLayoutChanged(m_applet->previewLayout()); m_background->setImagePath("widgets/tooltip"); m_background->setEnabledBorders(Plasma::FrameSvg::AllBorders); updateTheme(); m_highlightDelay->setInterval(m_applet->highlightDelay()); m_highlightDelay->setSingleShot(true); connect(m_highlightDelay, SIGNAL(timeout()), this, SLOT(highlightDelayTimeout())); connect(m_background, SIGNAL(repaintNeeded()), this, SLOT(updateTheme())); connect( m_applet, SIGNAL(previewLayoutChanged(Applet::PreviewLayoutType)), this, SLOT(previewLayoutChanged(Applet::PreviewLayoutType))); }
void HWMapContainer::setRandomTheme() { if(!m_themeModel->rowCount()) return; quint32 themeNum = rand() % m_themeModel->rowCount(); updateTheme(m_themeModel->index(themeNum)); emit themeChanged(m_theme); }
/* Widgets */ Widgets::Widgets(QWidget* parent) : QMainWindow(parent) { m_officeStyle = Q_NULL; setWindowTitle(tr("Qtitan Widgets Sample")); m_styleName = qApp->style()->objectName(); m_mdiArea = new QMdiArea; m_mdiArea->setViewMode(QMdiArea::TabbedView); m_mdiArea->setLineWidth(3); m_mdiArea->setFrameShape(QFrame::Panel); m_mdiArea->setFrameShadow(QFrame::Sunken); setCentralWidget(m_mdiArea); setIconSize(QSize(16, 16)); createActions(); createDockWindows(); createMenubar(); createToolbar(); statusBar(); createMdiChild(); QRect geom = QApplication::desktop()->availableGeometry(); resize(2 * geom.width() / 3, 2 * geom.height() / 3); updateStyle(m_actOffice2007Style); updateTheme(m_actBlueTheme); readSettings(); }
void GuiGameList::setSystemId(int id) { if(SystemData::sSystemVector.size() == 0) { LOG(LogError) << "Error - no systems found!"; return; } //make sure the id is within range if(id >= (int)SystemData::sSystemVector.size()) id -= SystemData::sSystemVector.size(); if(id < 0) id += SystemData::sSystemVector.size(); mSystemId = id; mSystem = SystemData::sSystemVector.at(mSystemId); //clear the folder stack while(mFolderStack.size()){ mFolderStack.pop(); } mFolder = mSystem->getRootFolder(); updateTheme(); updateList(); updateDetailData(); }
// Constructor for the theme manager ThemeManager::ThemeManager(const QString &themefile, QObject* parent, int initialSize) : QObject(parent), mRenderer(0), mConfig( 0 ) { mScale = initialSize; mAspectRatio = 1.0; mThemeFileChanged = false; updateTheme(themefile); }
void HWMapContainer::setTheme(const QString & theme) { QModelIndexList mdl = m_themeModel->match(m_themeModel->index(0), ThemeModel::ActualNameRole, theme); if(mdl.size()) updateTheme(mdl.at(0)); else intSetIconlessTheme(theme); }
void HWMapContainer::showThemePrompt() { ThemePrompt prompt(m_themeID, this); int theme = prompt.exec() - 1; // Since 0 means canceled, so all indexes are +1'd if (theme < 0) return; QModelIndex current = m_themeModel->index(theme, 0); updateTheme(current); emit themeChanged(m_theme); }
void ChessBoard::on_actionCustom_triggered() { updateTheme(Theme::custom); for (int i = 0; i < 8; i++) for (int j = 0; j < 8; j++) board[i][j]->setEnabled(false); themeEditor->saveTheme(); themeEditor->show(); }
void Theme::loadTheme(const QSettings &settings) { resetTheme(); for ( const auto &key : m_theme.keys() ) { const auto value = settings.value(key); if ( value.isValid() ) m_theme[key].setValue(value); } updateTheme(); }
ToolTip::ToolTip(QWidget *parent) : QWidget(parent), d(new ToolTipPrivate()) { setAttribute(Qt::WA_TranslucentBackground); setWindowFlags(Qt::ToolTip); d->preview = new WindowPreview(this); d->text = new TipTextWidget(this); d->imageLabel = new QLabel(this); d->imageLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft); d->animation = new QPropertyAnimation(this, "pos", this); d->animation->setEasingCurve(QEasingCurve::InOutQuad); d->animation->setDuration(250); d->background = new FrameSvg(this); d->background->setImagePath("widgets/tooltip"); d->background->setEnabledBorders(FrameSvg::AllBorders); updateTheme(); connect(d->background, SIGNAL(repaintNeeded()), this, SLOT(updateTheme())); connect(d->preview, SIGNAL(windowPreviewClicked(WId,Qt::MouseButtons,Qt::KeyboardModifiers,QPoint)), this, SIGNAL(activateWindowByWId(WId,Qt::MouseButtons,Qt::KeyboardModifiers,QPoint))); QHBoxLayout *previewHBoxLayout = new QHBoxLayout; previewHBoxLayout->addWidget(d->preview); QHBoxLayout *iconTextHBoxLayout = new QHBoxLayout; iconTextHBoxLayout->addWidget(d->imageLabel); iconTextHBoxLayout->setAlignment(d->imageLabel, Qt::AlignTop | Qt::AlignHCenter); iconTextHBoxLayout->addWidget(d->text); iconTextHBoxLayout->setAlignment(d->text, Qt::AlignLeft | Qt::AlignVCenter); iconTextHBoxLayout->setStretchFactor(d->text, 1); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(previewHBoxLayout); mainLayout->addLayout(iconTextHBoxLayout); setLayout(mainLayout); }
cardMap::cardMap() : QObject() { d = new cardMapPrivate(); Q_ASSERT(!_self); #ifndef Q_OS_SYMBIAN kDebug(11111) << "cardMap\n"; KSharedConfig::Ptr config = KGlobal::config(); KConfigGroup cs(config, settings_group ); #endif #ifndef Q_OS_SYMBIAN updateTheme(cs); setWantedCardWidth( cs.readEntry( "CardWidth", 100 ) ); #else updateTheme(); // TODO read setting from some config file setWantedCardWidth( 100 ); #endif suits[AbstractCard::Clubs] = KCardInfo::Club; suits[AbstractCard::Spades] = KCardInfo::Spade; suits[AbstractCard::Diamonds] = KCardInfo::Diamond; suits[AbstractCard::Hearts] = KCardInfo::Heart; ranks[AbstractCard::Two] = KCardInfo::Two; ranks[AbstractCard::Three] = KCardInfo::Three; ranks[AbstractCard::Four] = KCardInfo::Four; ranks[AbstractCard::Five] = KCardInfo::Five; ranks[AbstractCard::Six] = KCardInfo::Six; ranks[AbstractCard::Seven] = KCardInfo::Seven; ranks[AbstractCard::Eight] = KCardInfo::Eight; ranks[AbstractCard::Nine] = KCardInfo::Nine; ranks[AbstractCard::Ten] = KCardInfo::Ten; ranks[AbstractCard::Jack] = KCardInfo::Jack; ranks[AbstractCard::Queen] = KCardInfo::Queen; ranks[AbstractCard::King] = KCardInfo::King; ranks[AbstractCard::Ace] = KCardInfo::Ace; _self = this; }
void WindowPreview::updateTask(::TaskManager::TaskChanges changes) { bool doUpdate = false; QSize oldSize = size(); if (changes & TaskManager::IconChanged) { const KIcon icon(m_task->icon()); if (m_toolTip->previewsAvailable() && (m_task->type() == Task::StartupItem || m_task->type() == Task::LauncherItem)) { m_previewSize = icon.pixmap(BIG_ICON_SIZE).size(); } switch (m_toolTip->applet()->previewLayout()) { case Applet::NewPreviewLayout: m_icon = icon.pixmap(BIG_ICON_SIZE); break; case Applet::ClassicPreviewLayout: default: m_icon = icon.pixmap(SMALL_ICON_SIZE); } doUpdate = true; } if (changes & TaskManager::NameChanged) { m_taskNameLabel->setText(m_task->text()); doUpdate = true; } if (changes & TaskManager::GeometryChanged) { setPreviewSize(); doUpdate = true; } if (changes & TaskManager::NameChanged) { m_taskNameLabel->setText(m_task->text()); doUpdate = true; } if (doUpdate) { updateTheme(); if (size() != oldSize) { emit sizeChanged(); } } }
void HWMapContainer::updateModelViews() { // restore theme selection // do this before map selection restore, because map may overwrite theme if (!m_theme.isEmpty()) { QModelIndexList mdl = m_themeModel->match(m_themeModel->index(0), Qt::DisplayRole, m_theme); if (mdl.size() > 0) updateTheme(mdl.at(0)); else setRandomTheme(); } // restore map selection if (!m_curMap.isEmpty()) intSetMap(m_curMap); else updatePreview(); }
void PreferencesDialog::load() { static bool firstLoad = true; //Direcotry PATH ui->m_translationFileEdit->setMode(false); ui->m_translationFileEdit->setFilter("Translation File: (*.qm)"); ui->m_musicDirGM->setPath(m_preferences->value("MusicDirectoryGM",QDir::homePath()).toString()); ui->m_musicDirPlayer->setPath(m_preferences->value("MusicDirectoryPlayer",QDir::homePath()).toString()); ui->m_pictureDir->setPath(m_preferences->value("ImageDirectory",QDir::homePath()).toString()); ui->m_mapDir->setPath(m_preferences->value("MapDirectory",QDir::homePath()).toString()); ui->m_scenarioDir->setPath(m_preferences->value("SessionDirectory",QDir::homePath()).toString()); ui->m_minuteDir->setPath(m_preferences->value("MinutesDirectory",QDir::homePath()).toString()); ui->m_chatDir->setPath(m_preferences->value("ChatDirectory",QDir::homePath()).toString()); ui->m_translationFileEdit->setPath(m_preferences->value("currentTranslationFile","").toString()); ui->m_checkUpdate->setChecked(m_preferences->value("MainWindow_MustBeChecked",true).toBool()); //////////////////////// //MAP /////////////////////// //Fog of WAR QColor fog=m_preferences->value("Fog_color",QColor(Qt::black)).value<QColor>(); ui->m_opacitySlider->setValue(m_preferences->value("Fog_opacity",fog.red()).toInt()); ui->m_opacitySpin->setValue(m_preferences->value("Fog_opacity",fog.red()).toInt()); ui->m_fogColor->setColor(m_preferences->value("Mask_color",QColor(Qt::darkMagenta)).value<QColor>()); ui->m_fullScreenCheckbox->setChecked(m_preferences->value("FullScreenAtStarting",true).toBool()); //Default Permission ui->m_defaultMapModeCombo->setCurrentIndex(m_preferences->value("defaultPermissionMap",0).toInt()); ui->m_pictureAdjust->setChecked(m_preferences->value("PictureAdjust",true).toBool()); //theme //initializeStyle(); ui->m_backgroundImage->setMode(false); ui->m_backgroundImage->setFilter(tr("Images (*.png *.xpm *.jpg *.gif *.bmp)")); updateTheme(); }
void ChessBoard::on_actionBlue_triggered() { updateTheme(Theme::blue); }
void ChessBoard::on_actionLight_triggered() { updateTheme(Theme::light); }
void ChessBoard::on_actionClassic_triggered() { updateTheme(Theme::classic); }
void ChessBoard::on_actionSlate_triggered() { updateTheme(Theme::slate); }
void Widgets::triggeredThemes(QAction* action) { updateTheme(action); }