void Appearance::applySettings(SettingsWidget* gui) { const auto mine = dynamic_cast<MySettings*>(gui); const auto name = mine->getStyleName(); current_style_name_ = name; if (current_style_name_ == "Default") return; QStyle* style = QApplication::setStyle(current_style_name_); QApplication::setPalette(style->standardPalette()); }
static const char* getStyleName (const int styleFlags) noexcept { return getStyleName ((styleFlags & Font::bold) != 0, (styleFlags & Font::italic) != 0); }
/** * Main Application. Currently, drawing styles are hardcoded in this method. * Future work may entail reading the styles from a .properties file. */ int main( int argc, const char* argv[] ) { FILE *pfile; LWGEOM *lwgeom; char line [2048]; char *filename; int layerCount; int styleNumber; LAYERSTYLE *styles; getStyles(&styles); if ( argc != 2 ) { lwerror("You must specifiy a wkt filename to convert.\n"); return -1; } if ( (pfile = fopen(argv[1], "r")) == NULL) { perror ( argv[1] ); return -1; } filename = malloc( strlen(argv[1])+11 ); strncpy( filename, "../images/", 10 ); strncat( filename, argv[1], strlen(argv[1])-3 ); strncat( filename, "png", 3 ); printf( "generating %s\n", filename ); layerCount = 0; while ( fgets ( line, sizeof line, pfile ) != NULL && !isspace(*line) ) { char output[2048]; char *ptr = output; char *styleName; int useDefaultStyle; ptr += sprintf( ptr, "convert -size %s xc:none ", imageSize ); useDefaultStyle = getStyleName(&styleName, line); LWDEBUGF( 4, "%s", styleName ); if (useDefaultStyle) { printf(" Warning: using Default style for layer %d\n", layerCount); lwgeom = lwgeom_from_ewkt( line, PARSER_CHECK_NONE ); } else lwgeom = lwgeom_from_ewkt( line+strlen(styleName)+1, PARSER_CHECK_NONE ); LWDEBUGF( 4, "geom = %s", lwgeom_to_ewkt((LWGEOM*)lwgeom,0) ); styleNumber = layerCount % length(styles); ptr += drawGeometry( ptr, lwgeom, getStyle(styles, styleName) ); ptr += sprintf( ptr, "-flip tmp%d.png", layerCount ); lwfree( lwgeom ); LWDEBUGF( 4, "%s", output ); system(output); addHighlight( layerCount ); addDropShadow( layerCount ); layerCount++; free(styleName); } flattenLayers(filename); optimizeImage(filename); fclose(pfile); free(filename); freeStyles(&styles); return 0; }