void Canvas::initializeGL() { initializeOpenGLFunctions(); glEnable(GL_TEXTURE_2D); //image = new Texture{}; //image->loadBMP("tex2D.bmp"); refetch(); QColor bg{QWidget::palette().color(QPalette::Background)}; glClearColor(bg.redF(), bg.greenF(), bg.blueF(), 1.0f); }
SelfAvatarFetcher::SelfAvatarFetcher (QObject *parent) : QObject (parent) , Timer_ (new QTimer (this)) { connect (Timer_, SIGNAL (timeout ()), this, SLOT (refetch ())); Timer_->setInterval (120 * 60 * 1000); }
SelfAvatarFetcher::SelfAvatarFetcher (QNetworkAccessManager *nam, const QString& full, QObject *parent) : QObject { parent } , NAM_ { nam } , Timer_ { new QTimer { this } } , FullAddress_ { full } , Urls_ { full } , PreviousDateTime_ { AvatarsTimestampStorage {}.GetTimestamp (full).value_or (QDateTime {}) } { if (!IsValid ()) return; connect (Timer_, SIGNAL (timeout ()), this, SLOT (refetch ())); Timer_->setInterval (120 * 60 * 1000); Timer_->start (); QTimer::singleShot (2000, this, SLOT (refetch ())); }
void SelfAvatarFetcher::Restart (const QString& full) { const QStringList& split = full.split ('@', QString::SkipEmptyParts); Name_ = split.value (0); Domain_ = split.value (1); if (Domain_.endsWith (".ru")) Domain_.chop (3); if (Timer_->isActive ()) Timer_->stop (); Timer_->start (); QTimer::singleShot (2000, this, SLOT (refetch ())); }
// // inserts or updates a trashItem object in the database // bool TrashItem::store() { QSqlDatabase db = DatabaseService::getNoteFolderDatabase(); QSqlQuery query(db); if (fileName.isEmpty()) { return false; } if (id > 0) { query.prepare("UPDATE trashItem SET " "file_name = :file_name," "file_size = :file_size," "note_sub_folder_path_data = " ":note_sub_folder_path_data " "WHERE id = :id"); query.bindValue(":id", id); } else { query.prepare("INSERT INTO trashItem" "(file_name, file_size," "note_sub_folder_path_data) " "VALUES (:file_name, :file_size," ":note_sub_folder_path_data)"); } query.bindValue(":file_name", fileName); query.bindValue(":file_size", fileSize); query.bindValue(":note_sub_folder_path_data", noteSubFolderPathData); // on error if (!query.exec()) { qWarning() << __func__ << ": " << query.lastError(); DatabaseService::closeDatabaseConnection(db, query); return false; } else if (id == 0) { // on insert id = query.lastInsertId().toInt(); // to get the created date refetch(); } DatabaseService::closeDatabaseConnection(db, query); return true; }