/** * @brief Set the information of the current local data file. */ void QDialogUI::set_info() { std::map<QString, QString> info; info = redata_->get_info(); QString ver = info["Version"]; cur_ver_ = ver; set_label_text(ui->labelVersionData, ver); QString build = info["Buildtime"]; build = CommonUtil::timestamp_to_date(build); set_label_text(ui->labelReleaseData, build); }
/** * @brief Refresh the elements on the main dialog after change languages. */ void QDialogDaemon::refresh_main() { if(update_.size() != 0){ set_label_text(ui->labelLatestData, update_["version"].toString()); } this->set_platform_label(); //Read data file and set function list try{ RetrieveData::Destroy(); redata_ = RetrieveData::Instance(); redata_->unpack(); redata_->connect_db(); this->set_func_list(1); this->refresh_func_list(); this->set_info(); }catch(QString &a){ if(a == "io"){ this->warning_no_datafile(); }else{ this->warning_incorrect_datafile(); } } }
/** * @brief Retrieve the metadata of the latest data file from a server. */ void QDialogDaemon::check_update() { set_update_start_btns(); set_label_text(ui->labelLatestData, QApplication::translate("Util", "Checking...")); QSubChkUpdate *thread = new QSubChkUpdate(this); connect(thread, SIGNAL(trigger(QJsonObject)), this, SLOT(finish_update(QJsonObject)) ); thread->start(); }
void buttonbar_set_label (WButtonBar * bb, int idx, const char *text, const struct global_keymap_t *keymap, const Widget * receiver) { if ((bb != NULL) && (idx >= 1) && (idx <= BUTTONBAR_LABELS_NUM)) { unsigned long command = CK_IgnoreKey; if (keymap != NULL) command = keybind_lookup_keymap_command (keymap, KEY_F (idx)); if ((text == NULL) || (text[0] == '\0')) set_label_text (bb, idx, ""); else set_label_text (bb, idx, text); bb->labels[idx - 1].command = command; bb->labels[idx - 1].receiver = WIDGET (receiver); } }
/** *@brief Set the information of the label indicating current operating system platform. */ void QDialogUI::set_platform_label() { QString color; if(this->plat_flag_){ color = "GREEN"; }else{ color = "RED"; } set_label_color(ui->labelOSStat, color); set_label_text(ui->labelOSStat, QString("[%1]").arg(platform_)); }
/** * @brief Set the information of connection status to the current server selected. */ void QDialogUI::set_conn_status(int status, int mirror_id) { QString color,stat; if(this->mirror_id_ == mirror_id || mirror_id == -1){ if(status == -1){ set_label_color(ui->labelConnStat, "BLACK"); set_label_text(ui->labelConnStat, QApplication::translate("Util", "Checking...")); }else if(status == 0 || status == 1){ if(status){ color = "GREEN"; stat = QApplication::translate("Util", "[OK]"); }else{ color = "RED"; stat = QApplication::translate("Util", "[Failed]"); } set_label_color(ui->labelConnStat, color); set_label_text(ui->labelConnStat, stat); } } }
/** * @brief Start operations after checking update. * @param update Metadata of the latest hosts data file on the server. */ void QDialogDaemon::finish_update(QJsonObject update) { update_ = update; set_label_text(ui->labelLatestData, update["version"].toString()); if(update["version"].toString() == QApplication::translate("Util", "[Error]")){ set_conn_status(0); }else{ set_conn_status(1); } if(down_flag_){ fetch_update_after_check(); }else{ set_update_finish_btns(); } }
bool MouseCoordinatesTracker::eventFilter(QObject* object, QEvent* event) { assert(object == m_widget); switch (event->type()) { case QEvent::MouseMove: set_label_text(static_cast<QMouseEvent*>(event)->pos()); break; case QEvent::Leave: m_label->clear(); break; } return QObject::eventFilter(object, event); }
/** * @brief Set the version. */ void QDialogUI::set_version() { QString version = QString("v") + QString(__version__) + QString(" ") + QString(__release__); set_label_text(ui->VersionLabel, version.toStdString().c_str()); }