Example #1
0
void loadSettings(void){
  char *dataPath, *bitmapName, *finalPath;
  pghandle bitmapHandle;

  pgAppMessage(pglToolbar, pglBuildMessage(PGL_GETPREF, 
					   "PGL-Keyboard", 
					   "dataPath", 
					   ""));
  recieveMessage(pgGetEvent());
  dataPath = strdup(pglToolbarResponse);
  pgAppMessage(pglToolbar, pglBuildMessage(PGL_GETPREF, "PGL-Keyboard", "kbIcon", ""));
  recieveMessage(pgGetEvent());
  bitmapName = strdup(pglToolbarResponse);
  
  finalPath = malloc(strlen(dataPath)+strlen(bitmapName)+1);
  strcpy(finalPath, dataPath);
  strcat(finalPath, bitmapName);

  printf("%s\n", finalPath);

  bitmapHandle = pgNewBitmap(pgFromFile(finalPath));

  printf("%d\n", pglButton);

  pgSetWidget(pglButton,
	      PG_WP_BITMAP, bitmapHandle,
	      0);
}
Example #2
0
void loadSettings(void){
  
  pgAppMessage(pglToolbar, pglBuildMessage(PGL_GETPREF, "PGL-Clock", "flashColon", ""));
  recieveMessage(pgGetEvent());
  currentClock.flashColon ^= !strcmp(pglToolbarResponse, "Y") ? 1 : 0;

  pgAppMessage(pglToolbar, pglBuildMessage(PGL_GETPREF, "PGL-Clock", "enable24Hour", ""));
  recieveMessage(pgGetEvent());
  currentClock.enable24hour ^= !strcmp(pglToolbarResponse, "Y") ? 1 : 0;
  
  pgAppMessage(pglToolbar, pglBuildMessage(PGL_GETPREF, "PGL-Clock", "enableSeconds", ""));
  recieveMessage(pgGetEvent());
  currentClock.enableSeconds ^= !strcmp(pglToolbarResponse, "Y") ? 1 : 0;
  
  pgAppMessage(pglToolbar, pglBuildMessage(PGL_GETPREF, "PGL-Clock", "enableWeekday", ""));
  recieveMessage(pgGetEvent());
  currentClock.enableWeekDay ^= !strcmp(pglToolbarResponse, "Y") ? 1 : 0;

  pgAppMessage(pglToolbar, pglBuildMessage(PGL_GETPREF, "PGL-Clock", "enableDay", ""));
  recieveMessage(pgGetEvent());
  currentClock.enableDay ^= !strcmp(pglToolbarResponse, "Y") ? 1 : 0;

  pgAppMessage(pglToolbar, pglBuildMessage(PGL_GETPREF, "PGL-Clock", "enableMonth", ""));
  recieveMessage(pgGetEvent());
  currentClock.enableMonth ^= !strcmp(pglToolbarResponse, "Y") ? 1 : 0;

  pgAppMessage(pglToolbar, pglBuildMessage(PGL_GETPREF, "PGL-Clock", "enableYear", ""));
  recieveMessage(pgGetEvent());
  currentClock.enableYear ^= !strcmp(pglToolbarResponse, "Y") ? 1 : 0;
  
  mungeSettings();
}
void NetworkHandler::threadedFunction(){
    while(isThreadRunning()!=0)
    {
        if(lock())
        {
            recieveMessage();
            unlock();
            ofSleepMillis(100);
        }
    }
}
Example #4
0
void MainWindow::loadImage() {
    if(ui->operationsStack->currentIndex() == 0) {
        //Инициализация изображения
        QString imgUrl = QString::fromStdString(qobject_cast<DataModel*>(sender())->getNextImageData().first);

        recieveMessage(Errors::NoError, "Загрузка изображения");

        //Попытка загрузить изображение
        QNetworkReply* repl = imageNam->get(QNetworkRequest(QUrl(imgUrl)));
        connect(repl, &QNetworkReply::downloadProgress, this, &MainWindow::downloadProgress);
    }
}
Example #5
0
void MainWindow::imageLoaded(QNetworkReply *reply) {
    disconnect(reply, &QNetworkReply::downloadProgress, this, &MainWindow::downloadProgress);
    progress->setValue(0);

    ui->appendVote->setEnabled(true);

    if(ui->operationsStack->currentIndex() == 0) {
        if(QNetworkReply::NoError == reply->error()) {
            //Данные
            QImage img;
            QImageReader reader(reply);

            reader.read(&img);

            //Чтение изображения
            currentPixmap = QPixmap::fromImage(img);

            imageResize();
            recieveMessage(Errors::NoError, "Изображение загружено");
        } else {
            recieveMessage(Errors::Error, "Не удалось загрузить изображение");
        }
    }
}