예제 #1
0
void MyMWidget::refreshstandby(){

    QHash <QString, QString> hash;
    hash["temperature"] = _temperature;
    hash["temperature_low"] = _temperature_low;
    hash["temperature_hi"] = _temperature_high;
    hash["iconpath"] = _iconpath;
    hash["stationname"] = _stationname;
    hash["lastupdate"] = lastupdate();
    if (_current)
        hash["current"] = "TRUE";
    else
        hash["current"] = "FALSE";
    QFuture<void> f1 =  QtConcurrent::run(drawstandby, QHash <QString, QString> (hash));

}
예제 #2
0
void MyMWidget::refreshwallpaper(bool new_wallpaper){

#if 0	    
	    // Debug begin
        QFile file("/tmp/1.log");
        if (file.open(QIODevice::Append | QIODevice::WriteOnly | QIODevice::Text)){
            QTextStream out(&file);
            out <<  "Start refreshwallpaper"<< " \n";
            file.close();
        }
#endif
        QDir dir("/home/user/.cache/com.meecast.omweather");
        
        if (!dir.exists())
            dir.mkpath("/home/user/.cache/com.meecast.omweather");


#if 0	    
	    // Debug begin
        if (file.open(QIODevice::Append | QIODevice::WriteOnly | QIODevice::Text)){
            QTextStream out(&file);
            out <<  "Refreshwallpaper "<<_wallpaper_path<< " \n";
            file.close();
        }
#endif
        if (new_wallpaper){
            delete _image;
            _image = new QImage;
            _image->load(_wallpaper_path);
            if (_image->dotsPerMeterX() != 3780 || _image->dotsPerMeterY() != 3780 ){
                _image->setDotsPerMeterX(3780);
                _image->setDotsPerMeterY(3780);
            }
            _image->save("/home/user/.cache/com.meecast.omweather/wallpaper_MeeCast_original.png");
#if 0
            // Debug begin
            if (file.open(QIODevice::Append | QIODevice::WriteOnly | QIODevice::Text)){
                QTextStream out(&file);
                out <<  "Refreshwallpaper saved "<<_wallpaper_path<< " to original\n";
                file.close();
            }
#endif
        }

        if (!lockscreen())
            return;
#if 0
        // Debug begin
        if (file.open(QIODevice::Append | QIODevice::WriteOnly | QIODevice::Text)){
            QTextStream out(&file);
            out <<  "Refreshwallpaper paint has been started\n";
            file.close();
        }
#endif
        QHash <QString, QString> hash;
        hash["temperature"] = _temperature;
        hash["temperature_low"] = _temperature_low;
        hash["temperature_hi"] = _temperature_high;
        hash["iconpath"] = _iconpath;
        hash["stationname"] = _stationname;
        hash["lastupdate"] = lastupdate();
        if (_current)
            hash["current"] = "TRUE";
        else
            hash["current"] = "FALSE";
        QFuture<void> f1 =  QtConcurrent::run(drawwallpaper, QImage(_image->copy()), QHash <QString, QString> (hash));
    }
예제 #3
0
int stat_file_manager::update(date ctime){

   date lastupdate(get_lastupdate_date());

#ifdef DEBUG
   std::cout << "ctime: " <<std::endl;
   std::cout << ctime.get_stime() << std::endl;
   std::cout << "lastupdate: " << std::endl;
   std::cout << lastupdate.get_stime() << std::endl;
#endif


   if(ctime.s_year() == lastupdate.s_year()){
      if(ctime.s_month() == lastupdate.s_month()){
         if(ctime.s_day() == lastupdate.s_day()){
            if(ctime.s_hour() == lastupdate.s_hour()){
               if(ctime.s_min() == lastupdate.s_min()){
                  std::cout << "entry already exists" << std::endl;
                  return -1;
               }
            }else{
               std::cout << "stat_file_manager::update(): merge hour" << std::endl;
               lastupdate.get_time().tm_min = -1;
               if(merge(lastupdate) < 0){
                  std::cout << "merge() failed" << std::endl;
                  return -1;
               }
            }
         }else{
            std::cout << "stat_file_manager::update(): merge day" << std::endl;
            lastupdate.get_time().tm_min = -1;
            if(merge(lastupdate) < 0){
               std::cout << "merge() failed" << std::endl;
               return -1;
            }

            lastupdate.get_time().tm_hour = -1;
            if(merge(lastupdate) < 0){
               std::cout << "merge() failed" << std::endl;
               return -1;
            }
         }
      }else{
         std::cout << "stat_file_manager::update(): merge month" << std::endl;
         lastupdate.get_time().tm_min = -1;
         if(merge(lastupdate) < 0){
            std::cout << "merge() failed" << std::endl;
            return -1;
         }
         lastupdate.get_time().tm_hour = -1;
         if(merge(lastupdate) < 0){
            std::cout << "merge() failed" << std::endl;
            return -1;
         }
         lastupdate.get_time().tm_mday = -1;
         if(merge(lastupdate) < 0){
            std::cout << "merge() failed" << std::endl;
            return -1;
         }

      }
   }else{
      std::cout << "stat_file_manager::update(): merge year" << std::endl;
      lastupdate.get_time().tm_min = -1;
      if(merge(lastupdate) < 0){
         std::cout << "merge() failed" << std::endl;
         return -1;
      }
      lastupdate.get_time().tm_hour = -1;
      if(merge(lastupdate) < 0){
         std::cout << "merge() failed" << std::endl;
         return -1;
      }
      lastupdate.get_time().tm_mday = -1;
      if(merge(lastupdate) < 0){
         std::cout << "merge() failed" << std::endl;
         return -1;
      }
      lastupdate.get_time().tm_mon = -1;
      if(merge(lastupdate) < 0){
         std::cout << "merge() failed" <<std::endl;
         return -1;
      }
   }

   return 0;
}