int main(int argc, char* argv[]) { std::string ostFile; std::string ossFile; if (argc!=3) { std::cerr << "DumpOSS <OST file> <OSS file>" << std::endl; return 1; } ostFile=argv[1]; ossFile=argv[2]; osmscout::TypeConfigRef typeConfig(new osmscout::TypeConfig()); if (!typeConfig->LoadFromOSTFile(ostFile)) { std::cerr << "Cannot load OST file '" << ostFile << "'" << std::endl; return 1; } osmscout::StyleConfigRef styleConfig(new osmscout::StyleConfig(typeConfig)); if (!styleConfig->Load(ossFile)) { std::cerr << "Cannot load OSS file '" << ostFile << "'" << std::endl; return 1; } DumpOSSFile(typeConfig, styleConfig); styleConfig=NULL; typeConfig=NULL; return 0; }
int main(int argc, char* argv[]) { std::string map; std::string style; double latTop,latBottom,lonLeft,lonRight; unsigned long xTileStart,xTileEnd,xTileCount,yTileStart,yTileEnd,yTileCount; unsigned long startZoom; unsigned long endZoom; unsigned long tileWidth; unsigned long tileHeight; std::string driver; if (argc!=12) { std::cerr << "DrawMap "; std::cerr << "<map directory> <style-file> "; std::cerr << "<lat_top> <lon_left> <lat_bottom> <lon_right> "; std::cerr << "<start zoom>" << std::endl; std::cerr << "<end zoom>" << std::endl; std::cerr << "<tile width>" << std::endl; std::cerr << "<tile height>" << std::endl; std::cerr << "<driver>" << std::endl; return 1; } map=argv[1]; style=argv[2]; if (sscanf(argv[3],"%lf",&latTop)!=1) { std::cerr << "lon is not numeric!" << std::endl; return 1; } if (sscanf(argv[4],"%lf",&lonLeft)!=1) { std::cerr << "lat is not numeric!" << std::endl; return 1; } if (sscanf(argv[5],"%lf",&latBottom)!=1) { std::cerr << "lon is not numeric!" << std::endl; return 1; } if (sscanf(argv[6],"%lf",&lonRight)!=1) { std::cerr << "lat is not numeric!" << std::endl; return 1; } if (sscanf(argv[7],"%lu",&startZoom)!=1) { std::cerr << "start zoom is not numeric!" << std::endl; return 1; } if (sscanf(argv[8],"%lu",&endZoom)!=1) { std::cerr << "end zoom is not numeric!" << std::endl; return 1; } if (sscanf(argv[9],"%lu",&tileWidth)!=1) { std::cerr << "tile width is not numeric!" << std::endl; return 1; } if (sscanf(argv[10],"%lu",&tileHeight)!=1) { std::cerr << "tile height is not numeric!" << std::endl; return 1; } driver=argv[11]; #if defined(HAVE_LIB_OSMSCOUTMAPCAIRO) cairo_surface_t *surface=NULL; cairo_t *cairo=NULL; #endif if (driver=="cairo") { std::cout << "Using driver 'cairo'..." << std::endl; #if defined(HAVE_LIB_OSMSCOUTMAPCAIRO) surface=cairo_image_surface_create(CAIRO_FORMAT_RGB24,tileWidth,tileHeight); if (surface==NULL) { std::cerr << "Cannot create cairo image surface" << std::endl; return 1; } cairo=cairo_create(surface); if (cairo==NULL) { std::cerr << "Cannot create cairo_t for image surface" << std::endl; return 1; } #else std::cerr << "Driver 'cairo' is not enabled" << std::endl; return 1; #endif } else { std::cerr << "Unsupported driver '" << driver << "'" << std::endl; return 1; } osmscout::DatabaseParameter databaseParameter; //databaseParameter.SetDebugPerformance(true); osmscout::DatabaseRef database(new osmscout::Database(databaseParameter)); osmscout::MapServiceRef mapService(new osmscout::MapService(database)); if (!database->Open(map.c_str())) { std::cerr << "Cannot open database" << std::endl; return 1; } osmscout::StyleConfigRef styleConfig(new osmscout::StyleConfig(database->GetTypeConfig())); if (!styleConfig->Load(style)) { std::cerr << "Cannot open style" << std::endl; } osmscout::TileProjection projection; osmscout::MapParameter drawParameter; osmscout::AreaSearchParameter searchParameter; for (size_t zoom=std::min(startZoom,endZoom); zoom<=std::max(startZoom,endZoom); zoom++) { xTileStart=osmscout::LonToTileX(std::min(lonLeft,lonRight),zoom); xTileEnd=osmscout::LonToTileX(std::max(lonLeft,lonRight),zoom); xTileCount=xTileEnd-xTileStart+1; yTileStart=osmscout::LatToTileY(std::max(latTop,latBottom),zoom); yTileEnd=osmscout::LatToTileY(std::min(latTop,latBottom),zoom); yTileCount=yTileEnd-yTileStart+1; std::cout << "Drawing zoom " << zoom; //<< ", " << (xTileCount)*(yTileCount) << " tiles [" << xTileStart << "," << yTileStart << " - " << xTileEnd << "," << yTileEnd << "]"; std::cout << std::endl; #if defined(HAVE_LIB_OSMSCOUTMAPCAIRO) osmscout::MapPainterCairo cairoPainter(styleConfig); #endif osmscout::Magnification magnification; magnification.SetLevel(zoom); double dbMinTime=std::numeric_limits<double>::max(); double dbMaxTime=0.0; double dbTotalTime=0.0; double drawMinTime=std::numeric_limits<double>::max(); double drawMaxTime=0.0; double drawTotalTime=0.0; for (size_t y=yTileStart; y<=yTileEnd; y++) { for (size_t x=xTileStart; x<=xTileEnd; x++) { double lat,lon; osmscout::MapData data; lat=(osmscout::TileYToLat(y,zoom)+osmscout::TileYToLat(y+1,zoom))/2; lon=(osmscout::TileXToLon(x,zoom)+osmscout::TileXToLon(x+1,zoom))/2; //std::cout << "Drawing tile at " << lat << "," << lon << "/"; //std::cout << x << "," << y << "/"; //std::cout << x-xTileStart << "," << y-yTileStart << std::endl; projection.Set(lon, lat, magnification, DPI, tileWidth, tileHeight); osmscout::StopClock dbTimer; mapService->GetObjects(searchParameter, styleConfig, projection, data); dbTimer.Stop(); double dbTime=dbTimer.GetMilliseconds(); dbMinTime=std::min(dbMinTime,dbTime); dbMaxTime=std::max(dbMaxTime,dbTime); dbTotalTime+=dbTime; osmscout::StopClock drawTimer; #if defined(HAVE_LIB_OSMSCOUTMAPCAIRO) if (driver=="cairo") { //std::cout << data.nodes.size() << " " << data.ways.size() << " " << data.areas.size() << std::endl; cairoPainter.DrawMap(projection, drawParameter, data, cairo); } #endif drawTimer.Stop(); double drawTime=drawTimer.GetMilliseconds(); drawMinTime=std::min(drawMinTime,drawTime); drawMaxTime=std::max(drawMaxTime,drawTime); drawTotalTime+=drawTime; } } std::cout << "GetObjects: "; std::cout << "total: " << dbTotalTime << " msec "; std::cout << "min: " << dbMinTime << " msec "; std::cout << "avg: " << dbTotalTime/(xTileCount*yTileCount) << " msec "; std::cout << "max: " << dbMaxTime << " msec" << std::endl; std::cout << "DrawMap: "; std::cout << "total: " << drawTotalTime << " msec "; std::cout << "min: " << drawMinTime << " msec "; std::cout << "avg: " << drawTotalTime/(xTileCount*yTileCount) << " msec "; std::cout << "max: " << drawMaxTime << " msec" << std::endl; } database->Close(); #if defined(HAVE_LIB_OSMSCOUTMAPCAIRO) if (driver=="cairo") { cairo_destroy(cairo); cairo_surface_destroy(surface); } #endif return 0; }
int main(int argc, char* argv[]) { std::string map; std::string style; std::string output; size_t width,height; double lon,lat,zoom; if (argc!=9) { std::cerr << "DrawMap <map directory> <style-file> <width> <height> <lon> <lat> <zoom> <output>" << std::endl; return 1; } map=argv[1]; style=argv[2]; if (!osmscout::StringToNumber(argv[3],width)) { std::cerr << "width is not numeric!" << std::endl; return 1; } if (!osmscout::StringToNumber(argv[4],height)) { std::cerr << "height is not numeric!" << std::endl; return 1; } if (sscanf(argv[5],"%lf",&lon)!=1) { std::cerr << "lon is not numeric!" << std::endl; return 1; } if (sscanf(argv[6],"%lf",&lat)!=1) { std::cerr << "lat is not numeric!" << std::endl; return 1; } if (sscanf(argv[7],"%lf",&zoom)!=1) { std::cerr << "zoom is not numeric!" << std::endl; return 1; } output=argv[8]; osmscout::DatabaseParameter databaseParameter; osmscout::DatabaseRef database(new osmscout::Database(databaseParameter)); osmscout::MapServiceRef mapService(new osmscout::MapService(database)); if (!database->Open(map.c_str())) { std::cerr << "Cannot open database" << std::endl; return 1; } osmscout::StyleConfigRef styleConfig(new osmscout::StyleConfig(database->GetTypeConfig())); if (!styleConfig->Load(style)) { std::cerr << "Cannot open style" << std::endl; } cairo_surface_t *surface; cairo_t *cairo; surface=cairo_image_surface_create(CAIRO_FORMAT_RGB24,width,height); if (surface!=NULL) { cairo=cairo_create(surface); if (cairo!=NULL) { osmscout::MercatorProjection projection; osmscout::MapParameter drawParameter; osmscout::AreaSearchParameter searchParameter; osmscout::MapData data; osmscout::MapPainterCairo painter(styleConfig); drawParameter.SetFontSize(3.0); projection.Set(lon, lat, zoom, width, height); osmscout::TypeSet nodeTypes; std::vector<osmscout::TypeSet> wayTypes; osmscout::TypeSet areaTypes; styleConfig->GetNodeTypesWithMaxMag(projection.GetMagnification(), nodeTypes); styleConfig->GetWayTypesByPrioWithMaxMag(projection.GetMagnification(), wayTypes); styleConfig->GetAreaTypesWithMaxMag(projection.GetMagnification(), areaTypes); mapService->GetObjects(nodeTypes, wayTypes, areaTypes, projection.GetLonMin(), projection.GetLatMin(), projection.GetLonMax(), projection.GetLatMax(), projection.GetMagnification(), searchParameter, data.nodes, data.ways, data.areas); if (painter.DrawMap(projection, drawParameter, data, cairo)) { if (cairo_surface_write_to_png(surface,output.c_str())!=CAIRO_STATUS_SUCCESS) { std::cerr << "Cannot write PNG" << std::endl; } } cairo_destroy(cairo); } else { std::cerr << "Cannot create cairo cairo" << std::endl; } cairo_surface_destroy(surface); } else { std::cerr << "Cannot create cairo surface" << std::endl; } return 0; }
int main(int argc, char* argv[]) { std::string map; std::string style; size_t width,height; std::vector<Action> actions; if (argc<5) { DumpHelp(); return 1; } if ((argc-5)%3!=0) { DumpHelp(); return 1; } map=argv[1]; style=argv[2]; if (!osmscout::StringToNumber(argv[3],width)) { std::cerr << "width is not numeric!" << std::endl; return 1; } if (!osmscout::StringToNumber(argv[4],height)) { std::cerr << "height is not numeric!" << std::endl; return 1; } int arg=5; while (arg<argc) { Action action; if (sscanf(argv[arg],"%lf",&action.lat)!=1) { std::cerr << "lat is not numeric!" << std::endl; return 1; } arg++; if (sscanf(argv[arg],"%lf",&action.lon)!=1) { std::cerr << "lon is not numeric!" << std::endl; return 1; } arg++; if (sscanf(argv[arg],"%lf",&action.magnification)!=1) { std::cerr << "zoom is not numeric!" << std::endl; return 1; } arg++; actions.push_back(action); } std::cout << "# General program resources initialized, press return to start rendering emulation!" << std::endl; std::cin.get(); { osmscout::DatabaseParameter databaseParameter; databaseParameter.SetAreaAreaIndexCacheSize(0); databaseParameter.SetAreaNodeIndexCacheSize(0); osmscout::DatabaseRef database(new osmscout::Database(databaseParameter)); osmscout::MapServiceRef mapService(new osmscout::MapService(database)); if (!database->Open(map.c_str())) { std::cerr << "Cannot open database" << std::endl; return 1; } database->DumpStatistics(); osmscout::StyleConfigRef styleConfig(new osmscout::StyleConfig(database->GetTypeConfig())); if (!styleConfig->Load(style)) { std::cerr << "Cannot open style" << std::endl; } for (std::vector<Action>::const_iterator action=actions.begin(); action!=actions.end(); ++action) { std::cout << "-------------------" << std::endl; std::cout << "# Rendering " << action->lat << "," << action->lon << " with zoom " << action->magnification << " and size " << width << "x" << height << std::endl; osmscout::MercatorProjection projection; osmscout::AreaSearchParameter searchParameter; osmscout::MapData data; projection.Set(osmscout::GeoCoord(action->lat, action->lon), osmscout::Magnification(action->magnification), 96.0, width, height); osmscout::StopClock dbTimer; std::list<osmscout::TileRef> tiles; mapService->LookupTiles(projection,tiles); mapService->LoadMissingTileData(searchParameter,*styleConfig,tiles); mapService->ConvertTilesToMapData(tiles,data); dbTimer.Stop(); std::cout << "# DB access time " << dbTimer << std::endl; database->DumpStatistics(); } std::cout << "# Press return to close database" << std::endl; std::cin.get(); database->Close(); } std::cout << "# Press return to end application" << std::endl; std::cin.get(); return 0; }
int main(int argc, char* argv[]) { std::string map; std::string style; size_t width,height; std::vector<Action> actions; if (argc<5) { DumpHelp(); return 1; } if ((argc-5)%3!=0) { DumpHelp(); return 1; } map=argv[1]; style=argv[2]; if (!osmscout::StringToNumber(argv[3],width)) { std::cerr << "width is not numeric!" << std::endl; return 1; } if (!osmscout::StringToNumber(argv[4],height)) { std::cerr << "height is not numeric!" << std::endl; return 1; } int arg=5; while (arg<argc) { Action action; if (sscanf(argv[arg],"%lf",&action.lat)!=1) { std::cerr << "lat is not numeric!" << std::endl; return 1; } arg++; if (sscanf(argv[arg],"%lf",&action.lon)!=1) { std::cerr << "lon is not numeric!" << std::endl; return 1; } arg++; if (sscanf(argv[arg],"%lf",&action.magnification)!=1) { std::cerr << "zoom is not numeric!" << std::endl; return 1; } arg++; actions.push_back(action); } std::cout << "# General program resources initialized, press return to start rendering emulation!" << std::endl; std::cin.get(); { osmscout::DatabaseParameter databaseParameter; databaseParameter.SetAreaAreaIndexCacheSize(0); databaseParameter.SetAreaNodeIndexCacheSize(0); databaseParameter.SetNodeCacheSize(0); databaseParameter.SetWayCacheSize(0); databaseParameter.SetAreaCacheSize(0); osmscout::DatabaseRef database(new osmscout::Database(databaseParameter)); osmscout::MapServiceRef mapService(new osmscout::MapService(database)); if (!database->Open(map.c_str())) { std::cerr << "Cannot open database" << std::endl; return 1; } database->DumpStatistics(); osmscout::StyleConfigRef styleConfig(new osmscout::StyleConfig(database->GetTypeConfig())); if (!styleConfig->Load(style)) { std::cerr << "Cannot open style" << std::endl; } for (std::vector<Action>::const_iterator action=actions.begin(); action!=actions.end(); ++action) { std::cout << "-------------------" << std::endl; std::cout << "# Rendering " << action->lat << "," << action->lon << " with zoom " << action->magnification << " and size " << width << "x" << height << std::endl; osmscout::MercatorProjection projection; osmscout::AreaSearchParameter searchParameter; osmscout::MapData data; projection.Set(action->lon, action->lat, action->magnification, width, height); osmscout::TypeSet nodeTypes; std::vector<osmscout::TypeSet> wayTypes; osmscout::TypeSet areaTypes; styleConfig->GetNodeTypesWithMaxMag(projection.GetMagnification(), nodeTypes); styleConfig->GetWayTypesByPrioWithMaxMag(projection.GetMagnification(), wayTypes); styleConfig->GetAreaTypesWithMaxMag(projection.GetMagnification(), areaTypes); osmscout::StopClock dbTimer; mapService->GetObjects(nodeTypes, wayTypes, areaTypes, projection.GetLonMin(), projection.GetLatMin(), projection.GetLonMax(), projection.GetLatMax(), projection.GetMagnification(), searchParameter, data.nodes, data.ways, data.areas); dbTimer.Stop(); std::cout << "# DB access time " << dbTimer << std::endl; database->DumpStatistics(); } std::cout << "# Press return to flush caches" << std::endl; std::cin.get(); database->FlushCache(); std::cout << "# Press return to close database" << std::endl; std::cin.get(); } std::cout << "# Press return to end application" << std::endl; std::cin.get(); return 0; }
int main(int argc, char* argv[]) { std::string map; std::string style; std::string output; size_t width,height; double lon,lat,zoom; if (argc!=9) { std::cerr << "DrawMap <map directory> <style-file> <width> <height> <lon> <lat> <zoom> <output>" << std::endl; return 1; } map=argv[1]; style=argv[2]; if (!osmscout::StringToNumber(argv[3],width)) { std::cerr << "width is not numeric!" << std::endl; return 1; } if (!osmscout::StringToNumber(argv[4],height)) { std::cerr << "height is not numeric!" << std::endl; return 1; } if (sscanf(argv[5],"%lf",&lon)!=1) { std::cerr << "lon is not numeric!" << std::endl; return 1; } if (sscanf(argv[6],"%lf",&lat)!=1) { std::cerr << "lat is not numeric!" << std::endl; return 1; } if (sscanf(argv[7],"%lf",&zoom)!=1) { std::cerr << "zoom is not numeric!" << std::endl; return 1; } output=argv[8]; osmscout::DatabaseParameter databaseParameter; osmscout::DatabaseRef database(new osmscout::Database(databaseParameter)); osmscout::MapServiceRef mapService(new osmscout::MapService(database)); if (!database->Open(map.c_str())) { std::cerr << "Cannot open database" << std::endl; return 1; } osmscout::StyleConfigRef styleConfig(new osmscout::StyleConfig(database->GetTypeConfig())); if (!styleConfig->Load(style)) { std::cerr << "Cannot open style" << std::endl; } cairo_surface_t *surface; cairo_t *cairo; surface=cairo_image_surface_create(CAIRO_FORMAT_RGB24,width,height); if (surface!=NULL) { cairo=cairo_create(surface); if (cairo!=NULL) { osmscout::MercatorProjection projection; osmscout::MapParameter drawParameter; osmscout::AreaSearchParameter searchParameter; osmscout::MapData data; osmscout::MapPainterCairo painter(styleConfig); drawParameter.SetFontSize(3.0); projection.Set(osmscout::GeoCoord(lat,lon), osmscout::Magnification(zoom), DPI, width, height); std::list<osmscout::TileRef> tiles; mapService->LookupTiles(projection,tiles); mapService->LoadMissingTileData(searchParameter,*styleConfig,tiles); mapService->ConvertTilesToMapData(tiles,data); if (painter.DrawMap(projection, drawParameter, data, cairo)) { if (cairo_surface_write_to_png(surface,output.c_str())!=CAIRO_STATUS_SUCCESS) { std::cerr << "Cannot write PNG" << std::endl; } } cairo_destroy(cairo); } else { std::cerr << "Cannot create cairo cairo" << std::endl; } cairo_surface_destroy(surface); } else { std::cerr << "Cannot create cairo surface" << std::endl; } return 0; }
void KDecorationOptionsPrivate::updateSettings(KConfig* config) { KConfigGroup wmConfig(config, "WM"); // SettingColors QColor old_colors[NUM_COLORS*2]; for (int i = 0; i < NUM_COLORS * 2; ++i) old_colors[ i ] = colors[ i ]; QPalette appPal = QApplication::palette(); // normal colors colors[ColorFrame] = appPal.color(QPalette::Active, QPalette::Background); colors[ColorFrame] = wmConfig.readEntry("frame", colors[ColorFrame]); colors[ColorHandle] = colors[ColorFrame]; colors[ColorHandle] = wmConfig.readEntry("handle", colors[ColorHandle]); // full button configuration (background, blend, and foreground if (QPixmap::defaultDepth() > 8) colors[ColorButtonBg] = colors[ColorFrame].light(130); else colors[ColorButtonBg] = colors[ColorFrame]; colors[ColorButtonBg] = wmConfig.readEntry("activeTitleBtnBg", colors[ColorFrame]); colors[ColorTitleBar] = appPal.color(QPalette::Active, QPalette::Highlight); colors[ColorTitleBar] = wmConfig.readEntry("activeBackground", colors[ColorTitleBar]); if (QPixmap::defaultDepth() > 8) colors[ColorTitleBlend] = colors[ ColorTitleBar ].dark(110); else colors[ColorTitleBlend] = colors[ ColorTitleBar ]; colors[ColorTitleBlend] = wmConfig.readEntry("activeBlend", colors[ColorTitleBlend]); colors[ColorFont] = appPal.color(QPalette::Active, QPalette::HighlightedText); colors[ColorFont] = wmConfig.readEntry("activeForeground", colors[ColorFont]); // inactive colors[ColorFrame+NUM_COLORS] = wmConfig.readEntry("inactiveFrame", colors[ColorFrame]); colors[ColorTitleBar+NUM_COLORS] = colors[ColorFrame]; colors[ColorTitleBar+NUM_COLORS] = wmConfig. readEntry("inactiveBackground", colors[ColorTitleBar+NUM_COLORS]); if (QPixmap::defaultDepth() > 8) colors[ColorTitleBlend+NUM_COLORS] = colors[ ColorTitleBar+NUM_COLORS ].dark(110); else colors[ColorTitleBlend+NUM_COLORS] = colors[ ColorTitleBar+NUM_COLORS ]; colors[ColorTitleBlend+NUM_COLORS] = wmConfig.readEntry("inactiveBlend", colors[ColorTitleBlend+NUM_COLORS]); // full button configuration if (QPixmap::defaultDepth() > 8) colors[ColorButtonBg+NUM_COLORS] = colors[ColorFrame+NUM_COLORS].light(130); else colors[ColorButtonBg+NUM_COLORS] = colors[ColorFrame+NUM_COLORS]; colors[ColorButtonBg+NUM_COLORS] = wmConfig.readEntry("inactiveTitleBtnBg", colors[ColorButtonBg]); colors[ColorHandle+NUM_COLORS] = wmConfig.readEntry("inactiveHandle", colors[ColorHandle]); colors[ColorFont+NUM_COLORS] = colors[ColorFrame].dark(); colors[ColorFont+NUM_COLORS] = wmConfig.readEntry("inactiveForeground", colors[ColorFont+NUM_COLORS]); bool colorsChanged = false; for (int i = 0; i < NUM_COLORS * 2; ++i) if (old_colors[ i ] != colors[ i ]) { colorsChanged = true; break; } if (colorsChanged) { emit q->colorsChanged(); } // SettingFont QFont old_activeFont = activeFont; QFont old_inactiveFont = inactiveFont; QFont old_activeFontSmall = activeFontSmall; QFont old_inactiveFontSmall = inactiveFontSmall; QFont activeFontGuess = QFontDatabase::systemFont(QFontDatabase::TitleFont); activeFont = wmConfig.readEntry("activeFont", activeFontGuess); if (activeFont != old_activeFont) { emit q->activeFontChanged(); } inactiveFont = wmConfig.readEntry("inactiveFont", activeFont); if (inactiveFont != old_inactiveFont) { emit q->inactiveFontChanged(); } activeFontSmall = activeFont; // TODO: Is it useful ? (Temporary hack) //activeFontSmall.setPointSize(activeFont.pointSize() - 2 > 0 ? activeFont.pointSize() - 2 : activeFont.pointSize()+1 ); activeFontSmall = wmConfig.readEntry("activeFontSmall", activeFontSmall); if (activeFontSmall != old_activeFontSmall) { emit q->smallActiveFontChanged(); } inactiveFontSmall = wmConfig.readEntry("inactiveFontSmall", activeFontSmall); if (inactiveFontSmall != old_inactiveFontSmall) { emit q->smallInactiveFontChanged(); } KConfigGroup styleConfig(config, "Style"); // SettingsButtons const auto old_title_buttons_left = title_buttons_left; const auto old_title_buttons_right = title_buttons_right; bool old_custom_button_positions = custom_button_positions; custom_button_positions = styleConfig.readEntry("CustomButtonPositions", false); if (custom_button_positions) { title_buttons_left = q->readDecorationButtons(styleConfig, "ButtonsOnLeft", KDecorationOptions::defaultTitleButtonsLeft()); title_buttons_right = q->readDecorationButtons(styleConfig, "ButtonsOnRight", KDecorationOptions::defaultTitleButtonsRight()); } else { title_buttons_left = KDecorationOptions::defaultTitleButtonsLeft(); title_buttons_right = KDecorationOptions::defaultTitleButtonsRight(); } if (old_custom_button_positions != custom_button_positions) { emit q->customButtonPositionsChanged(); } if (old_title_buttons_left != title_buttons_left) { emit q->leftButtonsChanged(); } if (old_title_buttons_right != title_buttons_right) { emit q->rightButtonsChanged(); } // SettingTooltips bool old_show_tooltips = show_tooltips; show_tooltips = styleConfig.readEntry("ShowToolTips", true); if (old_show_tooltips != show_tooltips) { emit q->showTooltipsChanged(); } // SettingBorder BorderSize old_border_size = border_size; int border_size_num = styleConfig.readEntry("BorderSize", (int)BorderNormal); if (border_size_num >= 0 && border_size_num < BordersCount) border_size = static_cast< BorderSize >(border_size_num); else border_size = BorderNormal; if (old_border_size != border_size) { emit q->borderSizeChanged(); } cached_border_size = BordersCount; // invalid // destroy cached values int i; for (i = 0; i < NUM_COLORS * 2; ++i) { if (pal[i]) { delete pal[i]; pal[i] = nullptr; } } emit q->configChanged(); }