void ScreenManager::setScreenSize(float aWidth, float aHeight) { m_ScreenWidth = aWidth; m_ScreenHeight = aHeight; if(m_ScreensLoaded == false) { loadScreens(); m_ScreensLoaded = true; } }
ScreensModel::ScreensModel(QObject *parent) : QAbstractListModel(parent) { loadScreens(); QDesktopWidget *dw = QApplication::desktop(); connect(dw, SIGNAL(screenCountChanged(int)), SLOT(onScreenCountChanged(int))); connect(dw, SIGNAL(resized(int)), SLOT(onScreenResized(int))); QHash<int, QByteArray> roles; roles[Qt::UserRole] = "geometry"; setRoleNames(roles); }
Weather::Weather(MythScreenStack *parent, const QString &name, SourceManager *srcMan) : MythScreenType(parent, name), m_weatherStack(new MythScreenStack(GetMythMainWindow(), "weather stack")), m_firstRun(true), m_nextpageInterval(gCoreContext->GetNumSetting("weatherTimeout", 10)), m_nextpage_Timer(new QTimer(this)), m_firstSetup(true), m_createdSrcMan(false), m_srcMan(NULL), m_cur_screen(0), m_currScreen(NULL), m_paused(false), m_pauseText(NULL), m_headerText(NULL), m_updatedText(NULL) { if (!srcMan) { m_srcMan = new SourceManager(); // No point in doing this as the very first thing we are going to do // is destroy the sources and reload them. #if 0 m_srcMan->startTimers(); m_srcMan->doUpdate(); #endif m_createdSrcMan = true; } else { m_srcMan = srcMan; m_createdSrcMan = false; } connect(m_nextpage_Timer, SIGNAL(timeout()), SLOT(nextpage_timeout()) ); m_allScreens = loadScreens(); }
void ScreenSetup::loadData() { ScreenListInfo *si; QStringList types; ScreenListMap screenListMap = loadScreens(); // Fill the inactive screen button list. ScreenListMap::const_iterator i = screenListMap.constBegin(); while (i != screenListMap.constEnd()) { si = &screenListMap[i.key()]; types = si->dataTypes; si->units = ENG_UNITS; QStringList type_strs; for (int typei = 0; typei < types.size(); ++typei) { TypeListInfo ti(types[typei]); si->types.insert(types[typei], ti); type_strs << types[typei]; } QList<ScriptInfo *> scriptList; // Only add a screen to the list if we have a source // available to satisfy the requirements. if (m_sourceManager->findPossibleSources(type_strs, scriptList)) { ScriptInfo *script; for (int x = 0; x < scriptList.size(); x++) { script = scriptList.at(x); si->sources.append(script->name); } MythUIButtonListItem *item = new MythUIButtonListItem(m_inactiveList, si->title); item->SetData(qVariantFromValue(new ScreenListInfo(*si))); } ++i; } QMap<long, ScreenListInfo*> active_screens; MSqlQuery db(MSqlQuery::InitCon()); QString query = "SELECT weatherscreens.container, weatherscreens.units, " "weatherdatalayout.dataitem, weatherdatalayout.location, " "weathersourcesettings.source_name, weatherscreens.draworder " "FROM weatherscreens, weatherdatalayout, weathersourcesettings " "WHERE weatherscreens.hostname = :HOST " "AND weatherscreens.screen_id = weatherdatalayout.weatherscreens_screen_id " "AND weathersourcesettings.sourceid = weatherdatalayout.weathersourcesettings_sourceid " "ORDER BY weatherscreens.draworder;"; db.prepare(query); db.bindValue(":HOST", gCoreContext->GetHostName()); if (!db.exec()) { LOG(VB_GENERAL, LOG_ERR, db.lastError().text()); return; } // Fill the active screen button list. while (db.next()) { QString name = db.value(0).toString(); units_t units = db.value(1).toUInt(); QString dataitem = db.value(2).toString(); QString location = db.value(3).toString(); QString src = db.value(4).toString(); uint draworder = db.value(5).toUInt(); types = screenListMap[name].dataTypes; TypeListInfo ti(dataitem, location, m_sourceManager->getSourceByName(src)); if (active_screens.find(draworder) == active_screens.end()) { si = new ScreenListInfo(screenListMap[name]); // Clear types first as we will re-insert the values from the database si->types.clear(); si->units = units; MythUIButtonListItem *item = new MythUIButtonListItem(m_activeList, si->title); // Only insert types meant for this screen for (QStringList::Iterator type_i = types.begin(); type_i != types.end(); ++type_i ) { if (*type_i == dataitem) si->types.insert(dataitem, ti); } item->SetData(qVariantFromValue(si)); active_screens.insert(draworder, si); } else { si = active_screens[draworder]; for (QStringList::Iterator type_i = types.begin(); type_i != types.end(); ++type_i ) { if (*type_i == dataitem) { si->types.insert(dataitem, ti); } } } } }
/* - Fill / update dialog with known information (from HASH table) ---------- */ void fill_dialog() { gint listID; gchar *licence_path = NULL; DIR *licence_dir = NULL; GList *licence_list = NULL; /* -- Fill in values for 'General' tab ---------------------------------- */ if(SHASH("hostname") != NULL) { #ifdef _DEBUG_ g_warning("Hostname to be set active: %s", SHASH("hostname")); #endif listID = g_list_index(hostnames, SHASH("hostname")); gtk_combo_box_set_active(GTK_COMBO_BOX(combo_host), listID); gtk_combo_box_set_active(GTK_COMBO_BOX(combo_host2), listID); } if(SHASH("username") != NULL) gtk_entry_set_text(GTK_ENTRY(input_username), SHASH("username")); if(SHASH("password") != NULL) gtk_entry_set_text(GTK_ENTRY(input_password), SHASH("password")); if(SHASH("domain") != NULL) gtk_entry_set_text(GTK_ENTRY(input_domain), SHASH("domain")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_savepw), iSHASH("savepw")); loadRdpProtocols(combo_rdp_proto); /* Set RDP version */ /* -- Fill in values for 'Display' tab ---------------------------------- */ loadScreens(combo_screen_size); sig_screensize(combo_screen_size, NULL); loadColors(menu_colorsize); sig_colchange(NULL, NULL); /* -- Fill in values for 'Resources' tab -------------------------------- */ loadSoundOptions(menu_sound); sig_sound(NULL, NULL); /* -- Fill in values for 'Program' tab ---------------------------------- */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_prog), iSHASH("runprog")); if(SHASH("program") != NULL) gtk_entry_set_text(GTK_ENTRY(input_program), SHASH("program")); if(SHASH("ppath") != NULL) gtk_entry_set_text(GTK_ENTRY(input_ppath), SHASH("ppath")); gtk_widget_set_sensitive(input_program, iSHASH("runprog")); gtk_widget_set_sensitive(input_ppath, iSHASH("runprog")); /* -- Fill in values for 'Extended' tab --------------------------------- */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_bitmapupd), iSHASH("bitmapupd")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_motionevt), iSHASH("motionevt")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_hidewmdecoration), iSHASH("hidewmdecoration")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_noencr), iSHASH("noencryption")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_wmkeybindings), iSHASH("wmkeybindings")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_attconsole), iSHASH("attconsole")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_sshopts), iSHASH("usessh")); gtk_widget_set_sensitive(btn_sshopts, iSHASH("usessh")); // TODO MKA 2015-09-02 What is this? Licenses to remote servers... // licence_path = gnome_util_prepend_user_home(".rdesktop"); licence_path = g_strconcat(g_get_home_dir(), ".rdesktop", NULL); #ifdef _DEBUG_ g_warning("Licence path: %s", licence_path); #endif licence_dir = opendir(licence_path); if(licence_dir != NULL) { struct dirent *entry = NULL; const gchar *prefix = "licence."; while((entry = readdir(licence_dir)) != NULL) { gchar *fullname = NULL; gchar *hostname = &entry->d_name[strlen(prefix)]; struct stat sts; fullname = g_strdup_printf("%s/%s", licence_path, entry->d_name); if(stat(fullname, &sts) == -1) continue; if(!S_ISREG(sts.st_mode)) continue; if(strlen(entry->d_name) <= strlen(prefix)) continue; licence_list = g_list_append(licence_list, g_strdup(hostname)); } closedir(licence_dir); if (licence_list != NULL) { fill_combo_with_list(combo_clientname, licence_list); } } if ((SHASH("clientname") != NULL) && (licence_list != NULL)) { listID = g_list_index(licence_list, SHASH("clientname")); gtk_combo_box_set_active(GTK_COMBO_BOX(combo_clientname), listID); } /* MKA -- Fill in values for 'Redirect' tab ----------------------------- */ if(SHASH("redirect") != NULL) { gtk_entry_set_text(GTK_ENTRY(entryOutput), SHASH("redirect")); } /* finally, we deactivate all rdp unsupported widgets */ sig_rdp_protocol(NULL, NULL); }
void ScreensModel::onScreenCountChanged(int newCount) { Q_UNUSED(newCount); loadScreens(); }