/* + style layout name ?spec? */ static int StyleLayoutCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *layoutName; Ttk_LayoutTemplate layoutTemplate; if (objc < 3 || objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "name ?spec?"); return TCL_ERROR; } layoutName = Tcl_GetString(objv[2]); if (objc == 3) { layoutTemplate = Ttk_FindLayoutTemplate(theme, layoutName); if (!layoutTemplate) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Layout %s not found", layoutName)); Tcl_SetErrorCode(interp, "TTK", "LOOKUP", "LAYOUT", layoutName, NULL); return TCL_ERROR; } Tcl_SetObjResult(interp, Ttk_UnparseLayoutTemplate(layoutTemplate)); } else { layoutTemplate = Ttk_ParseLayoutTemplate(interp, objv[3]); if (!layoutTemplate) { return TCL_ERROR; } Ttk_RegisterLayoutTemplate(theme, layoutName, layoutTemplate); ThemeChanged(pkgPtr); } return TCL_OK; }
/* + style configure $style -option ?value... */ static int StyleConfigureCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *styleName; Style *stylePtr; int i; if (objc < 3) { usage: Tcl_WrongNumArgs(interp,2,objv,"style ?-option ?value...??"); return TCL_ERROR; } styleName = Tcl_GetString(objv[2]); stylePtr = Ttk_GetStyle(theme, styleName); if (objc == 3) { /* style default $styleName */ Tcl_SetObjResult(interp, HashTableToDict(&stylePtr->defaultsTable)); return TCL_OK; } else if (objc == 4) { /* style default $styleName -option */ const char *optionName = Tcl_GetString(objv[3]); Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&stylePtr->defaultsTable, optionName); if (entryPtr) { Tcl_SetObjResult(interp, (Tcl_Obj*)Tcl_GetHashValue(entryPtr)); } return TCL_OK; } else if (objc % 2 != 1) { goto usage; } for (i = 3; i < objc; i += 2) { const char *optionName = Tcl_GetString(objv[i]); Tcl_Obj *value = objv[i+1]; Tcl_HashEntry *entryPtr; int newEntry; entryPtr = Tcl_CreateHashEntry( &stylePtr->defaultsTable,optionName,&newEntry); Tcl_IncrRefCount(value); if (!newEntry) { Tcl_DecrRefCount((Tcl_Obj*)Tcl_GetHashValue(entryPtr)); } Tcl_SetHashValue(entryPtr, value); } ThemeChanged(pkgPtr); return TCL_OK; }
/* * Ttk_UseTheme -- * Set the current theme, notify all widgets that the theme has changed. */ int Ttk_UseTheme(Tcl_Interp *interp, Ttk_Theme theme) { StylePackageData *pkgPtr = GetStylePackageData(interp); /* * Check if selected theme is enabled: */ while (theme && !theme->enabledProc(theme, theme->enabledData)) { theme = theme->parentPtr; } if (!theme) { /* This shouldn't happen -- default theme should always work */ Tcl_Panic("No themes available?"); return TCL_ERROR; } pkgPtr->currentTheme = theme; ThemeChanged(pkgPtr); return TCL_OK; }
Ouroboros::Ouroboros(QWidget *parent) : QMainWindow(parent), PlayStatus(PLAYSTATUS_STOPPED), AnimeProgressStyle(this), //assign this as parent so that stylesheet get inherited ui(new Ui::Ouroboros) { ui->setupUi(this);\ setMouseTracking(true); //setup main window QString Title = QString(APP_NAME) + " " + QString::number(APP_MAJOR_VERSION) + "." + QString::number(APP_MINOR_VERSION); if(APP_DEBUG) Title.append(" Debug"); this->setWindowTitle(Title); //Generate a random seed for other classes QTime CurrentTime = QTime::currentTime(); qsrand((uint)CurrentTime.msec()); //setup views SetViewLayouts(); //setup tray icon SetupTrayIcon(); //Load settings Settings.Load(); //Load the style Theme_Manager.LoadThemeList(); Theme_Manager.LoadTheme(Settings.Application.Stylesheet); this->setStyleSheet(QString(Theme_Manager.GetTheme())); //Set the ui for the manager GUI_Manager.SetMainWindow(this); //Setup Detection //Only detects on windows currently #ifdef WIN32 File_Manager.SaveMedia(); //Load Media File_Manager.LoadMedia(); if(Media_Manager.MediaListLoaded) { DetectionTimer.setInterval(RECOGNITION_TIMEDELAY); connect(&DetectionTimer,SIGNAL(timeout()),&Media_Manager,SLOT(DetectAnime())); connect(this,SIGNAL(StopDetectionTimer()),&DetectionTimer,SLOT(stop())); DetectionTimer.start(); } #endif //Setup a timer to run the queue every 5 minutes QTimer *RunTimer = new QTimer(this); connect(RunTimer,SIGNAL(timeout()),&Queue_Manager,SLOT(Run())); connect(RunTimer,SIGNAL(timeout()),&Theme_Manager,SLOT(LoadThemeList())); RunTimer->start(30000); //Connect signals and slots connect(RunTimer,SIGNAL(timeout()),&Queue_Manager,SLOT(StartRunning())); connect(&Api_Manager,SIGNAL(ChangeStatus(QString,int)),this,SLOT(ChangeStatus(QString,int))); connect(&GUI_Manager,SIGNAL(ShowTrayMessage(QString,QString,int)),this,SLOT(ShowTrayMessage(QString,QString,int))); connect(&Media_Manager,SIGNAL(ShowTrayMessage(QString,QString,int)),this,SLOT(ShowTrayMessage(QString,QString,int))); connect(&Theme_Manager,SIGNAL(ThemeChanged(QString)),this,SLOT(setStyleSheet(QString))); //Load user info File_Manager.LoadUserInformation(); //Load history File_Manager.LoadHistory(); //Load local database File_Manager.LoadAnimeDatabase(); GUI_Manager.PopulateModel(); //Sync anime if(CurrentUser.isValid()) { emit ChangeStatus("Syncing ...", 3000); Queue_Manager.Sync(true); } }
void Settings::SetThemeName(const QString& theme_name) { SConfig::GetInstance().theme_name = theme_name.toStdString(); emit ThemeChanged(); }
nsNativeThemeQt::nsNativeThemeQt() { mNoBackgroundPalette.setColor(QPalette::Window, Qt::transparent); ThemeChanged(); }
/* + style map $style ? -resource statemap ... ? * * Note that resource names are unconstrained; the Style * doesn't know what resources individual elements may use. */ static int StyleMapCmd( ClientData clientData, /* Master StylePackageData pointer */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ { StylePackageData *pkgPtr = clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *styleName; Style *stylePtr; int i; if (objc < 3) { usage: Tcl_WrongNumArgs(interp,2,objv,"style ?-option ?value...??"); return TCL_ERROR; } styleName = Tcl_GetString(objv[2]); stylePtr = Ttk_GetStyle(theme, styleName); /* NOTE: StateMaps are actually Tcl_Obj *s, so HashTableToDict works * for settingsTable. */ if (objc == 3) { /* style map $styleName */ Tcl_SetObjResult(interp, HashTableToDict(&stylePtr->settingsTable)); return TCL_OK; } else if (objc == 4) { /* style map $styleName -option */ const char *optionName = Tcl_GetString(objv[3]); Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&stylePtr->settingsTable, optionName); if (entryPtr) { Tcl_SetObjResult(interp, (Tcl_Obj*)Tcl_GetHashValue(entryPtr)); } return TCL_OK; } else if (objc % 2 != 1) { goto usage; } for (i = 3; i < objc; i += 2) { const char *optionName = Tcl_GetString(objv[i]); Tcl_Obj *stateMap = objv[i+1]; Tcl_HashEntry *entryPtr; int newEntry; /* Make sure 'stateMap' is legal: * (@@@ SHOULD: check for valid resource values as well, * but we don't know what types they should be at this level.) */ if (!Ttk_GetStateMapFromObj(interp, stateMap)) return TCL_ERROR; entryPtr = Tcl_CreateHashEntry( &stylePtr->settingsTable,optionName,&newEntry); Tcl_IncrRefCount(stateMap); if (!newEntry) { Tcl_DecrRefCount((Tcl_Obj*)Tcl_GetHashValue(entryPtr)); } Tcl_SetHashValue(entryPtr, stateMap); } ThemeChanged(pkgPtr); return TCL_OK; }