void ConfigQml::setstandbyscreen(bool c) { ConfigQml::Config::Standbyscreen(c); if (!c && (QFile::exists("/home/user/.cache/com.meecast.omweather/logo.png"))) QFile::remove("/home/user/.cache/com.meecast.omweather/logo.png"); MGConfItem standbyItem("/desktop/meego/screen_lock/low_power_mode/operator_logo"); standbyItem.set("/home/user/.cache/com.meecast.omweather/nologo.png"); saveConfig(); refreshconfig(); }
void drawstandby(QHash <QString, QString> hash){ QString temperature_hi = hash["temperature_hi"]; QString temperature = hash["temperature"]; QString temperature_low = hash["temperature_low"]; QString lastupdate = hash["lastupdate"]; QString stationname = hash["stationname"]; QString iconpath = hash["iconpath"]; QSettings *standby_settings; QColor color_font_station_name_standby; /* Init qsettings */ standby_settings = new QSettings("/home/user/.config/com.meecast.omweather/standby.conf",QSettings::NativeFormat); QVariant v = standby_settings->value("color_font_stationname", QColor(Qt::white)); color_font_station_name_standby = v.value<QColor>(); QImage *image; image = new QImage (QSize(120, 120), QImage::Format_RGB32); /* Left corner */ int x = 0; int y = 0; QPainter paint; image->fill(Qt::black); paint.begin(image); QPen pen; /* set color for station name */ QColor myPenColor = QColor(color_font_station_name_standby); pen.setColor(myPenColor); paint.setPen(pen); MGConfItem standbyItem("/desktop/meego/screen_lock/low_power_mode/operator_logo"); standbyItem.set("/home/user/.cache/com.meecast.omweather/nologo.png"); /* Station */ paint.setFont(QFont("Nokia Pure", 12)); // paint.setFont(QFont("Nokia Pure Light", 14)); paint.drawText( x , y, 127, 21, Qt::AlignHCenter, stationname.mid(0,18)); /* Icon */ QPoint point(x + 50, y + 19); QImage icon; iconpath = "/opt/com.meecast.omweather/share/images/smallcontour/" + iconpath.right(iconpath.length() - iconpath.lastIndexOf("/") - 1); icon.load(iconpath); icon = icon.scaled(72, 72); paint.drawImage(point, icon); /* Temperature */ paint.setFont(QFont("Nokia Pure", 20)); if (temperature == "N/A" || temperature == ""){ QString temp_string = temperature_hi + QString::fromUtf8("°"); paint.drawText(x, y + 20, 60, 50, Qt::AlignHCenter, temp_string); temp_string = temperature_low + QString::fromUtf8("°"); paint.drawText(x, y + 55, 60, 50, Qt::AlignHCenter, temp_string); }else{ if (hash["current"] == "TRUE"){ paint.setFont(QFont("Nokia Pure Bold", 21)); myPenColor = QColor(0, 255, 0, 255);// set default color pen.setColor(myPenColor); paint.setPen(pen); } QString temp_string = temperature + QString::fromUtf8("°"); paint.drawText(x, y + 35, 60, 48, Qt::AlignHCenter, temp_string); } paint.end(); image->save("/home/user/.cache/com.meecast.omweather/logo.png"); delete image; standbyItem.set("/home/user/.cache/com.meecast.omweather/logo.png"); }