PYHistogramTip::PYHistogramTip(QWidget *parent) : QWidget(parent) { initVariables(); initSettings(); }
QString QMakeProperty::value(QString v, bool just_check) { if(v == "QT_INSTALL_PREFIX") return QLibraryInfo::location(QLibraryInfo::PrefixPath); else if(v == "QT_INSTALL_DATA") return QLibraryInfo::location(QLibraryInfo::DataPath); else if(v == "QT_INSTALL_DOCS") return QLibraryInfo::location(QLibraryInfo::DocumentationPath); else if(v == "QT_INSTALL_HEADERS") return QLibraryInfo::location(QLibraryInfo::HeadersPath); else if(v == "QT_INSTALL_LIBS") return QLibraryInfo::location(QLibraryInfo::LibrariesPath); else if(v == "QT_INSTALL_BINS") return QLibraryInfo::location(QLibraryInfo::BinariesPath); else if(v == "QT_INSTALL_PLUGINS") return QLibraryInfo::location(QLibraryInfo::PluginsPath); else if(v == "QT_INSTALL_IMPORTS") return QLibraryInfo::location(QLibraryInfo::ImportsPath); else if(v == "QT_INSTALL_TRANSLATIONS") return QLibraryInfo::location(QLibraryInfo::TranslationsPath); else if(v == "QT_INSTALL_CONFIGURATION") return QLibraryInfo::location(QLibraryInfo::SettingsPath); else if(v == "QT_INSTALL_EXAMPLES") return QLibraryInfo::location(QLibraryInfo::ExamplesPath); else if(v == "QT_INSTALL_DEMOS") return QLibraryInfo::location(QLibraryInfo::ExamplesPath); else if(v == "QMAKE_MKSPECS") return qmake_mkspec_paths().join(Option::dirlist_sep); else if(v == "QMAKE_VERSION") return qmake_version(); #ifdef QT_VERSION_STR else if(v == "QT_VERSION") return QT_VERSION_STR; #endif initSettings(); int slash = v.lastIndexOf('/'); QVariant var = settings->value(keyBase(slash == -1) + v); bool ok = var.isValid(); QString ret = var.toString(); if(!ok) { QString version = qmake_version(); if(slash != -1) { version = v.left(slash-1); v = v.mid(slash+1); } settings->beginGroup(keyBase(false)); QStringList subs = settings->childGroups(); settings->endGroup(); subs.sort(); for (int x = subs.count() - 1; x >= 0; x--) { QString s = subs[x]; if(s.isEmpty() || s > version) continue; var = settings->value(keyBase(false) + s + "/" + v); ok = var.isValid(); ret = var.toString(); if (ok) { if(!just_check) debug_msg(1, "Fell back from %s -> %s for '%s'.", version.toLatin1().constData(), s.toLatin1().constData(), v.toLatin1().constData()); return ret; } } } return ok ? ret : QString(); }
void QMakeProperty::remove(const QString &var) { initSettings(); settings->remove(var); }
void initAlgo(engine_configuration_s *engineConfiguration) { #if EFI_PROD_CODE || EFI_SIMULATOR initSettings(engineConfiguration); initSignalExecutor(); #endif }
void otPlatSettingsWipe(otInstance *aInstance) { initSettings(sSettingsBaseAddress, static_cast<uint32_t>(kSettingsInUse)); otPlatSettingsInit(aInstance); }
void FirmwarePreferencesDialog::on_fw_dnld_clicked() { MainWindow * mw = (MainWindow *)this->parent(); mw->dowloadLastFirmwareUpdate(); initSettings(); }
MAIN(httpMain, int argc, char **argv, char **envp) { MprTime start; double elapsed; if (mprCreate(argc, argv, MPR_USER_EVENTS_THREAD) == 0) { return MPR_ERR_MEMORY; } if ((app = mprAllocObj(App, manageApp)) == 0) { return MPR_ERR_MEMORY; } mprAddRoot(app); mprAddStandardSignals(); initSettings(); if (!parseArgs(argc, argv)) { showUsage(); return MPR_ERR_BAD_ARGS; } mprSetMaxWorkers(app->workers); #if BIT_FEATURE_SSL if (!mprLoadSsl(1)) { mprError("Can't load SSL"); exit(1); } if (app->insecure || app->cert) { app->ssl = mprCreateSsl(); mprVerifySslServers(app->ssl, !app->insecure); if (app->cert) { mprSetSslCertFile(app->ssl, app->cert); } } #endif if (mprStart() < 0) { mprError("Can't start MPR for %s", mprGetAppTitle()); exit(2); } start = mprGetTime(); app->http = httpCreate(); httpEaseLimits(app->http->clientLimits); processing(); mprServiceEvents(-1, 0); if (app->benchmark) { elapsed = (double) (mprGetTime() - start); if (app->fetchCount == 0) { elapsed = 0; app->fetchCount = 1; } mprPrintf("\nRequest Count: %13d\n", app->fetchCount); mprPrintf("Time elapsed: %13.4f sec\n", elapsed / 1000.0); mprPrintf("Time per request: %13.4f sec\n", elapsed / 1000.0 / app->fetchCount); mprPrintf("Requests per second: %13.4f\n", app->fetchCount * 1.0 / (elapsed / 1000.0)); mprPrintf("Load threads: %13d\n", app->loadThreads); mprPrintf("Worker threads: %13d\n", app->workers); } if (!app->success && app->verbose) { mprError("Request failed"); } return (app->success) ? 0 : 255; }
int main(int argc, char *argv[]) { qputenv("QTWEBENGINE_REMOTE_DEBUGGING", "19260"); #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif detectOpenGLEarly(); Application a(argc, argv); if (!a.parseArgs()) return 0; detectOpenGLLate(); // Print python error to console on Windows #ifdef Q_OS_WIN qputenv("PYTHONHOME", getAppPath().toUtf8()); qputenv("PYTHONPATH", getAppPath().toUtf8() + "/Lib;" + getAppPath().toUtf8() + "/DLLs"); bool win_debug = AttachConsole(ATTACH_PARENT_PROCESS); if (win_debug) { freopen("CON", "w", stdout); freopen("CON", "w", stderr); freopen("CON", "r", stdin); } #endif //for mpv setlocale(LC_NUMERIC, "C"); //init access_manager = new NetworkAccessManager(&a); printf("Initialize settings...\n"); initSettings(); printf("Initialize API for Python...\n"); initPython(); // Translate moonplayer printf("Initialize language support...\n"); QTranslator qtTranslator; if (qtTranslator.load("qt_" + QLocale::system().name(), getQtTranslationsPath())) a.installTranslator(&qtTranslator); QTranslator translator; if (translator.load("moonplayer_" + QLocale::system().name(), getAppPath() + "/translations")) a.installTranslator(&translator); // Create window PlayerView *player_view = new PlayerView; player_view->show(); // Create video parsers parser_ykdl = new ParserYkdl(&a); parser_youtubedl = new ParserYoutubeDL(&a); #ifdef MP_ENABLE_WEBENGINE parser_webcatch = new ParserWebCatch(&a); #endif a.exec(); Py_Finalize(); delete player_view; return 0; }
////////////////////////////////////////////////////////////////////// // Main initialization function // // // // This creates all items that are not saved in workspace files // ////////////////////////////////////////////////////////////////////// void App::init(QString openFile) { // // Default size // resize(maximumSize()); // // Settings has to be first // initSettings(); // // Menus, toolbar, statusbar // initMenuBar(); initStatusBar(); initToolBar(); // // The main view // initWorkspace(); // // Plugins // initPlugins(); // // Device classes // initDeviceClasses(); // // Submasters & values // initSubmasters(); initValues(); // // Function consumer // initFunctionConsumer(); // // Buses // Bus::init(); // // Document // initDoc(); // // Views // initDeviceManagerView(); initVirtualConsole(); // Trying to load workspace files // Either specified on command line or the last active workspace bool success = false; if (openFile != "") { success = doc()->loadWorkspaceAs(openFile); if (!success) { QString msg = "File: " + openFile + "\ncould'nt be opened. Please check path and spelling!\n"; msg += "We revert to the previously used workspace."; QMessageBox::warning(this, KApplicationNameShort, msg, QMessageBox::Ok, 0); } } // // Load the previous workspace // if (!success) { QString config; if (settings()->get(KEY_OPEN_LAST_WORKSPACE, config)) { if (config == Settings::trueValue()) { if (settings()->get(KEY_LAST_WORKSPACE_NAME, config)) { success = doc()->loadWorkspaceAs(config); if (!success) { QString msg = "Previously used workspace file: " + config + "\ncould'nt be opened."; msg += "We start over with a new workspace."; QMessageBox::warning(this, KApplicationNameShort, msg, QMessageBox::Ok, 0); } } } } } if (!success) { newDocument(); } }
OptionsWidget::OptionsWidget(QString productName,QWidget *parent) : QScrollArea(parent), m_productName(productName), m_settings(QSettings::SystemScope,"osll",m_productName) { m_widget = new QWidget(this); QVBoxLayout * layout = new QVBoxLayout(m_widget); layout->addWidget(new QLabel("Login", m_widget)); layout->addWidget(m_nameEdit = new QLineEdit(m_widget)); layout->addWidget(new QLabel("Password", m_widget)); layout->addWidget(m_passwordEdit = new QLineEdit(m_widget)); layout->addWidget(m_passwordCheckBox = new QCheckBox("Show password", m_widget)); layout->addWidget(new QLabel("Channel name", m_widget)); layout->addWidget(m_channelEdit = new QLineEdit(m_widget)); // NOTE if we use m_widget windget in tracker addition field for username will displayed if (m_productName == "tracker") { layout->addWidget(new QLabel("Name that will be displayed\non Observer map:", m_widget)); layout->addWidget(m_visibleNameEdit = new QLineEdit()); } m_passwordEdit->setEchoMode(QLineEdit::Password); m_passwordCheckBox->setChecked(false); layout->addWidget(new QLabel("Server", m_widget)); layout->addWidget(m_serverUrlEdit = new QLineEdit(m_widget)); layout->addWidget(new QLabel("Port", m_widget)); layout->addWidget(m_serverPortEdit = new QSpinBox(m_widget)); m_serverPortEdit->setMinimum(0); m_serverPortEdit->setMaximum(65535); layout->addWidget(new QLabel("Proxy type", m_widget)); layout->addWidget(m_proxyType = new QComboBox(m_widget)); layout->addWidget(new QLabel("Proxy host", m_widget)); layout->addWidget(m_proxyHostEdit = new QLineEdit(m_widget)); layout->addWidget(new QLabel("Proxy port", m_widget)); layout->addWidget(m_proxyPortEdit = new QSpinBox(m_widget)); m_proxyType->addItem("DefaultProxy", QNetworkProxy::DefaultProxy); m_proxyType->addItem("Socks5Proxy", QNetworkProxy::Socks5Proxy); m_proxyType->addItem("NoProxy", QNetworkProxy::NoProxy); m_proxyType->addItem("HttpProxy", QNetworkProxy::HttpProxy); m_proxyType->addItem("HttpCachingProxy", QNetworkProxy::HttpCachingProxy); m_proxyType->addItem("FtpCachingProxy", QNetworkProxy::FtpCachingProxy); m_proxyPortEdit->setMinimum(0); m_proxyPortEdit->setMaximum(65535); layout->addWidget(new QLabel("Cache type", m_widget)); layout->addWidget(m_cacheType = new QComboBox(m_widget)); layout->addWidget(new QLabel("Cache path", m_widget)); layout->addWidget(m_cachePath = new QLineEdit(m_widget)); layout->addWidget(m_cachePathButton = new QPushButton("Choose dir...", m_widget)); layout->addWidget(new QLabel("Max cache size", m_widget)); layout->addWidget(m_cacheMaxSize = new QSpinBox(m_widget)); m_cacheType->addItem("None", 0); m_cacheType->addItem("Network cache", 1); m_cacheType->addItem("Disk cache", 2); m_cacheType->setCurrentIndex(-1); layout->addWidget(m_doneButton = new QPushButton("Done", m_widget)); layout->addWidget(m_defaultButton = new QPushButton("Default settings", m_widget)); layout->addWidget(m_cancelButton = new QPushButton("Cancel", m_widget)); m_widget->setLayout(layout); this->setWidget(m_widget); this->setWidgetResizable(true); connect(m_doneButton, SIGNAL(clicked()), this, SLOT(onDoneClicked())); connect(m_cancelButton, SIGNAL(clicked()), this, SLOT(onCancelClicked())); connect(m_defaultButton,SIGNAL(clicked()), this, SLOT(setDefaultSettings())); connect(m_proxyType, SIGNAL(currentIndexChanged(int)), this, SLOT(onProxyTypeChanged(int))); connect(m_cacheType, SIGNAL(currentIndexChanged(int)), this, SLOT(onCacheTypeChanged(int))); connect(m_cachePathButton, SIGNAL(clicked()), this, SLOT(onCachePathButtonClick())); connect(m_passwordCheckBox, SIGNAL(clicked(bool)), this, SLOT(onShowPasswordChecked(bool))); onProxyTypeChanged(m_proxyType->currentIndex()); if( m_settings.value("magic").toString() != APP_MAGIC ) { setDefaultSettings(); createSettings(); } initSettings(); applyProxySettings(); }
void CAP3Worker::init() { input = ports.value(IN_PORT_DESCR); initSettings(); initPaths(); }
void OptionsWidget::onCancelClicked() { initSettings(); emit cancel(); }
MAIN(httpMain, int argc, char *argv[]) { MprTime start; double elapsed; /* * Explicit initialization of globals for re-entrancy on Vxworks */ activeLoadThreads = benchmark = continueOnErrors = fetchCount = iterations = isBinary = httpVersion = 0; success = loadThreads = nextArg = noout = nofollow = showHeaders = printable = workers = 0; retries = singleStep = timeout = verbose = 0; chunkSize = host = method = password = ranges = 0; username = 0; mpr = 0; headers = 0; formData = 0; mpr = mprCreate(argc, argv, NULL); initSettings(mpr); if (!parseArgs(mpr, argc, argv)) { showUsage(mpr); return MPR_ERR_BAD_ARGS; } #if BLD_FEATURE_MULTITHREAD mprSetMaxWorkers(mpr, workers); #endif #if BLD_FEATURE_SSL if (!mprLoadSsl(mpr, 1)) { mprError(mpr, "Can't load SSL"); exit(1); } #endif /* * Start the Timer, Socket and Worker services */ if (mprStart(mpr, 0) < 0) { mprError(mpr, "Can't start MPR for %s", mprGetAppTitle(mpr)); exit(2); } start = mprGetTime(mpr); processing(); /* * Wait for all the threads to complete (simple but effective). Keep servicing events as we wind down. */ while (activeLoadThreads > 0) { mprServiceEvents(mprGetDispatcher(mpr), 250, MPR_SERVICE_EVENTS | MPR_SERVICE_IO); } if (benchmark) { elapsed = (double) (mprGetTime(mpr) - start); if (fetchCount == 0) { elapsed = 0; fetchCount = 1; } mprPrintf(mpr, "\nRequest Count: %13d\n", fetchCount); mprPrintf(mpr, "Time elapsed: %13.4f sec\n", elapsed / 1000.0); mprPrintf(mpr, "Time per request: %13.4f sec\n", elapsed / 1000.0 / fetchCount); mprPrintf(mpr, "Requests per second: %13.4f\n", fetchCount * 1.0 / (elapsed / 1000.0)); mprPrintf(mpr, "Load threads: %13d\n", loadThreads); mprPrintf(mpr, "Worker threads: %13d\n", workers); } if (!success && verbose) { mprError(mpr, "Request failed"); } return (success) ? 0 : 255; }
void VConfigManager::initialize() { initSettings(); initThemes(); initEditorStyles(); initCssStyles(); initCodeBlockCssStyles(); m_theme = getConfigFromSettings("global", "theme").toString(); m_editorStyle = getConfigFromSettings("global", "editor_style").toString(); m_cssStyle = getConfigFromSettings("global", "css_style").toString(); m_codeBlockCssStyle = getConfigFromSettings("global", "code_block_css_style").toString(); m_defaultEditPalette = QTextEdit().palette(); welcomePagePath = getConfigFromSettings("global", "welcome_page_path").toString(); markdownExtensions = hoedown_extensions(HOEDOWN_EXT_TABLES | HOEDOWN_EXT_FENCED_CODE | HOEDOWN_EXT_HIGHLIGHT | HOEDOWN_EXT_AUTOLINK | HOEDOWN_EXT_QUOTE | HOEDOWN_EXT_MATH | HOEDOWN_EXT_MATH_EXPLICIT); mdConverterType = (MarkdownConverterType)getConfigFromSettings("global", "markdown_converter").toInt(); tabStopWidth = getConfigFromSettings("global", "tab_stop_width").toInt(); isExpandTab = getConfigFromSettings("global", "is_expand_tab").toBool(); m_highlightCursorLine = getConfigFromSettings("global", "highlight_cursor_line").toBool(); m_highlightSelectedWord = getConfigFromSettings("global", "highlight_selected_word").toBool(); m_highlightSearchedWord = getConfigFromSettings("global", "highlight_searched_word").toBool(); m_autoIndent = getConfigFromSettings("global", "auto_indent").toBool(); m_autoList = getConfigFromSettings("global", "auto_list").toBool(); readCustomColors(); curBackgroundColor = getConfigFromSettings("global", "current_background_color").toString(); updateEditStyle(); curRenderBackgroundColor = getConfigFromSettings("global", "current_render_background_color").toString(); m_toolsDockChecked = getConfigFromSettings("global", "tools_dock_checked").toBool(); m_findCaseSensitive = getConfigFromSettings("global", "find_case_sensitive").toBool(); m_findWholeWordOnly = getConfigFromSettings("global", "find_whole_word_only").toBool(); m_findRegularExpression = getConfigFromSettings("global", "find_regular_expression").toBool(); m_findIncrementalSearch = getConfigFromSettings("global", "find_incremental_search").toBool(); m_language = getConfigFromSettings("global", "language").toString(); m_enableMermaid = getConfigFromSettings("global", "enable_mermaid").toBool(); m_enableFlowchart = getConfigFromSettings("global", "enable_flowchart").toBool(); m_enableMathjax = getConfigFromSettings("global", "enable_mathjax").toBool(); m_webZoomFactor = getConfigFromSettings("global", "web_zoom_factor").toReal(); if (!isCustomWebZoomFactor()) { // Calculate the zoom factor based on DPI. m_webZoomFactor = VUtils::calculateScaleFactor(); qDebug() << "set WebZoomFactor to" << m_webZoomFactor; } m_enableCodeBlockHighlight = getConfigFromSettings("global", "enable_code_block_highlight").toBool(); m_enablePreviewImages = getConfigFromSettings("global", "enable_preview_images").toBool(); m_enablePreviewImageConstraint = getConfigFromSettings("global", "enable_preview_image_constraint").toBool(); m_enableImageConstraint = getConfigFromSettings("global", "enable_image_constraint").toBool(); m_enableImageCaption = getConfigFromSettings("global", "enable_image_caption").toBool(); m_imageFolder = getConfigFromSettings("global", "image_folder").toString(); m_imageFolderExt = getConfigFromSettings("global", "external_image_folder").toString(); m_attachmentFolder = getConfigFromSettings("global", "attachment_folder").toString(); if (m_attachmentFolder.isEmpty()) { // Reset the default folder. m_attachmentFolder = resetDefaultConfig("global", "attachment_folder").toString(); } m_enableTrailingSpaceHighlight = getConfigFromSettings("global", "enable_trailing_space_highlight").toBool(); m_enableVimMode = getConfigFromSettings("global", "enable_vim_mode").toBool(); m_enableSmartImInVimMode = getConfigFromSettings("global", "enable_smart_im_in_vim_mode").toBool(); m_editorLineNumber = getConfigFromSettings("global", "editor_line_number").toInt(); m_minimizeToSystemTray = getConfigFromSettings("global", "minimize_to_system_tray").toInt(); if (m_minimizeToSystemTray > 1 || m_minimizeToSystemTray < -1) { setMinimizeToSystemTray(0); } readShortcutsFromSettings(); readCaptainShortcutsFromSettings(); initDocSuffixes(); m_markdownHighlightInterval = getConfigFromSettings("global", "markdown_highlight_interval").toInt(); m_lineDistanceHeight = getConfigFromSettings("global", "line_distance_height").toInt(); m_insertTitleFromNoteName = getConfigFromSettings("global", "insert_title_from_note_name").toBool(); int openMode = getConfigFromSettings("global", "note_open_mode").toInt(); if (openMode == 1) { m_noteOpenMode = OpenFileMode::Edit; } else { m_noteOpenMode = OpenFileMode::Read; } int tmpHeadingSequenceType = getConfigFromSettings("global", "heading_sequence_type").toInt(); if (tmpHeadingSequenceType < (int)HeadingSequenceType::Invalid && tmpHeadingSequenceType >= (int)HeadingSequenceType::Disabled) { m_headingSequenceType = (HeadingSequenceType)tmpHeadingSequenceType; } else { m_headingSequenceType = HeadingSequenceType::Disabled; } m_headingSequenceBaseLevel = getConfigFromSettings("global", "heading_sequence_base_level").toInt(); m_colorColumn = getConfigFromSettings("global", "color_column").toInt(); m_enableCodeBlockLineNumber = getConfigFromSettings("global", "enable_code_block_line_number").toBool(); m_toolBarIconSize = getConfigFromSettings("global", "tool_bar_icon_size").toInt(); m_markdownitOptHtml = getConfigFromSettings("global", "markdownit_opt_html").toBool(); m_markdownitOptBreaks = getConfigFromSettings("global", "markdownit_opt_breaks").toBool(); m_markdownitOptLinkify = getConfigFromSettings("global", "markdownit_opt_linkify").toBool(); m_recycleBinFolder = getConfigFromSettings("global", "recycle_bin_folder").toString(); m_recycleBinFolderExt = getConfigFromSettings("global", "external_recycle_bin_folder").toString(); m_confirmImagesCleanUp = getConfigFromSettings("global", "confirm_images_clean_up").toBool(); m_confirmReloadFolder = getConfigFromSettings("global", "confirm_reload_folder").toBool(); m_mathjaxJavascript = getConfigFromSettings("web", "mathjax_javascript").toString(); m_doubleClickCloseTab = getConfigFromSettings("global", "double_click_close_tab").toBool(); m_enableCompactMode = getConfigFromSettings("global", "enable_compact_mode").toBool(); int tmpStartupPageMode = getConfigFromSettings("global", "startup_page_type").toInt(); if (tmpStartupPageMode < (int)StartupPageType::Invalid && tmpStartupPageMode >= (int)StartupPageType::None) { m_startupPageType = (StartupPageType)tmpStartupPageMode; } else { m_startupPageType = StartupPageType::None; } m_startupPages = getConfigFromSettings("global", "startup_pages").toStringList(); initFromSessionSettings(); m_fileTimerInterval = getConfigFromSettings("global", "file_timer_interval").toInt(); if (m_fileTimerInterval < 100) { m_fileTimerInterval = 100; } m_backupDirectory = getConfigFromSettings("global", "backup_directory").toString(); m_backupExtension = getConfigFromSettings("global", "backup_extension").toString(); if (m_backupExtension.isEmpty()) { m_backupExtension = "."; } m_enableBackupFile = getConfigFromSettings("global", "enable_backup_file").toBool(); m_vimExemptionKeys = getConfigFromSettings("global", "vim_exemption_keys").toString(); m_closeBeforeExternalEditor = getConfigFromSettings("global", "close_before_external_editor").toBool(); m_fixImageSrcInWebWhenCopied = getConfigFromSettings("web", "fix_img_src_when_copied").toBool(); m_stylesToRemoveWhenCopied = getConfigFromSettings("web", "styles_to_remove_when_copied").toStringList(); m_stylesToInlineWhenCopied = getConfigFromSettings("web", "styles_to_inline_when_copied").toStringList().join(","); }
XProcessTableHeader::XProcessTableHeader(QWidget *parent):QWidget(parent) { initVars(); initSettings(); }
static uint32_t swapSettingsBlock(otInstance *aInstance) { OT_UNUSED_VARIABLE(aInstance); uint32_t oldBase = sSettingsBaseAddress; uint32_t swapAddress = oldBase; uint32_t usedSize = sSettingsUsedSize; uint32_t settingsSize = SETTINGS_CONFIG_PAGE_SIZE * SETTINGS_CONFIG_PAGE_NUM / 2; sSettingsBaseAddress = (swapAddress == SETTINGS_CONFIG_BASE_ADDRESS) ? (swapAddress + settingsSize) : SETTINGS_CONFIG_BASE_ADDRESS; initSettings(sSettingsBaseAddress, (uint32_t)OT_SETTINGS_IN_SWAP); sSettingsUsedSize = OT_SETTINGS_FLAG_SIZE; swapAddress += OT_SETTINGS_FLAG_SIZE; while (swapAddress < (oldBase + usedSize)) { OT_TOOL_PACKED_BEGIN struct addSettingsBlock { struct settingsBlock block; uint8_t data[OT_SETTINGS_BLOCK_DATA_SIZE]; } OT_TOOL_PACKED_END addBlock; bool valid = true; utilsFlashRead(swapAddress, (uint8_t *)(&addBlock.block), sizeof(struct settingsBlock)); swapAddress += sizeof(struct settingsBlock); if (!(addBlock.block.flag & OT_FLASH_BLOCK_ADD_COMPLETE_FLAG) && (addBlock.block.flag & OT_FLASH_BLOCK_DELETE_FLAG)) { uint32_t address = swapAddress + getAlignLength(addBlock.block.length); while (address < (oldBase + usedSize)) { struct settingsBlock block; utilsFlashRead(address, (uint8_t *)(&block), sizeof(block)); if (!(block.flag & OT_FLASH_BLOCK_ADD_COMPLETE_FLAG) && (block.flag & OT_FLASH_BLOCK_DELETE_FLAG) && !(block.flag & OT_FLASH_BLOCK_INDEX_0_FLAG) && (block.key == addBlock.block.key)) { valid = false; break; } address += (getAlignLength(block.length) + sizeof(struct settingsBlock)); } if (valid) { utilsFlashRead(swapAddress, addBlock.data, getAlignLength(addBlock.block.length)); utilsFlashWrite(sSettingsBaseAddress + sSettingsUsedSize, (uint8_t *)(&addBlock), getAlignLength(addBlock.block.length) + sizeof(struct settingsBlock)); sSettingsUsedSize += (sizeof(struct settingsBlock) + getAlignLength(addBlock.block.length)); } } else if (addBlock.block.flag == 0xff) { break; } swapAddress += getAlignLength(addBlock.block.length); } setSettingsFlag(sSettingsBaseAddress, (uint32_t)OT_SETTINGS_IN_USE); setSettingsFlag(oldBase, (uint32_t)OT_SETTINGS_NOT_USED); return settingsSize - sSettingsUsedSize; }
void FirmwarePreferencesDialog::on_checkFWUpdates_clicked() { MainWindow * mw = (MainWindow *)this->parent(); mw->checkForFirmwareUpdate(); initSettings(); }
void otPlatSettingsWipe(otInstance *aInstance) { initSettings(sSettingsBaseAddress, (uint32_t)OT_SETTINGS_IN_USE); otPlatSettingsInit(aInstance); }
AppSettings::AppSettings() { initSettings(); }
MainForm::MainForm(QWidget *parent): QMainWindow(parent) { setupUi(this); ///!!!!! //alignButton->hide(); //unalignButton->hide(); setWindowTitle("YAGF"); spellChecker = new SpellChecker(textEdit); spellChecker->enumerateDicts(); selectLangsBox = new QComboBox(); QLabel *label = new QLabel(); label->setMargin(4); label->setText(trUtf8("Recognition language")); frame->show(); toolBar->addWidget(label); selectLangsBox->setFrame(true); toolBar->addWidget(selectLangsBox); graphicsInput = new QGraphicsInput(QRectF(0, 0, 2000, 2000), graphicsView) ; graphicsInput->addToolBarAction(actionHideShowTolbar); graphicsInput->addToolBarAction(this->actionTBLV); graphicsInput->addToolBarAction(this->actionSmaller_view); graphicsInput->addToolBarSeparator(); graphicsInput->addToolBarAction(actionRotate_90_CCW); graphicsInput->addToolBarAction(actionRotate_180); graphicsInput->addToolBarAction(actionRotate_90_CW); graphicsInput->addToolBarAction(actionDeskew); graphicsInput->addToolBarSeparator(); graphicsInput->addToolBarAction(actionSelect_Text_Area); graphicsInput->addToolBarAction(actionSelect_multiple_blocks); graphicsInput->addToolBarAction(ActionClearAllBlocks); statusBar()->show(); imageLoaded = false; useXSane = TRUE; textSaved = TRUE; hasCopy = false; //rotation = 0; m_menu = new QMenu(graphicsView); ifCounter = 0; connect(actionOpen, SIGNAL(triggered()), this, SLOT(loadImage())); connect(actionQuit, SIGNAL(triggered()), this, SLOT(close())); connect(this, SIGNAL(windowShown()), this, SLOT(onShowWindow()), Qt::QueuedConnection); connect(actionScan, SIGNAL(triggered()), this, SLOT(scanImage())); connect(actionPreviousPage, SIGNAL(triggered()), this, SLOT(loadPreviousPage())); connect(actionNextPage, SIGNAL(triggered()), this, SLOT(loadNextPage())); connect(actionRecognize, SIGNAL(triggered()), this, SLOT(recognize())); connect(action_Save, SIGNAL(triggered()), this, SLOT(saveText())); connect(actionAbout, SIGNAL(triggered()), this, SLOT(showAboutDlg())); connect(actionOnlineHelp, SIGNAL(triggered()), this, SLOT(showHelp())); connect(actionCopyToClipboard, SIGNAL(triggered()), this, SLOT(copyClipboard())); textEdit->setContextMenuPolicy(Qt::CustomContextMenu); connect(textEdit, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint))); connect(textEdit, SIGNAL(copyAvailable(bool)), this, SLOT(copyAvailable(bool))); connect(textEdit, SIGNAL(textChanged()), this, SLOT(textChanged())); connect(graphicsInput, SIGNAL(rightMouseClicked(int, int, bool)), this, SLOT(rightMouseClicked(int, int, bool))); tesMap = new TesMap(); fillLanguagesBox(); initSettings(); delTmpFiles(); scanProcess = new QProcess(this); QXtUnixSignalCatcher::connectUnixSignal(SIGUSR2); ba = new QByteArray(); connect(QXtUnixSignalCatcher::catcher(), SIGNAL(unixSignal(int)), this, SLOT(readyRead(int))); connect(textEdit->document(), SIGNAL(cursorPositionChanged(const QTextCursor &)), this, SLOT(updateSP())); //displayLabel->installEventFilter(this); textEdit->installEventFilter(this); QPixmap l_cursor; l_cursor.load(":/resize.png"); resizeCursor = new QCursor(l_cursor); graphicsInput->setMagnifierCursor(resizeCursor); l_cursor.load(":/resize_block.png"); resizeBlockCursor = new QCursor(l_cursor); // textEdit->setContextMenuPolicy(Qt::ActionsContextMenu); this->sideBar->show(); connect(sideBar, SIGNAL(fileSelected(const QString &)), this, SLOT(fileSelected(const QString &))); connect(actionRecognize_All_Pages, SIGNAL(triggered()), this, SLOT(recognizeAll())); graphicsInput->setSideBar(sideBar); QPixmap pm; pm.load(":/align.png"); //alignButton->setIcon(pm); pm.load(":/undo.png"); //unalignButton->setIcon(pm); //connect(unalignButton, SIGNAL(clicked()), this, SLOT(unalignButtonClicked())); //clearBlocksButton->setDefaultAction(ActionClearAllBlocks); loadFromCommandLine(); emit windowShown(); pdfx = NULL; if (findProgram("pdftoppm")) { pdfx = new PDF2PPT(); } else if (findProgram("gs")) { pdfx = new GhostScr(); } if (pdfx) { connect(pdfx, SIGNAL(addPage(QString)), this, SLOT(addPDFPage(QString)), Qt::QueuedConnection); connect (pdfx, SIGNAL(finished()), this, SLOT(finishedPDF())); } pdfPD.setWindowTitle("YAGF"); pdfPD.setLabelText(trUtf8("Importing pages from the PDF document...")); pdfPD.setCancelButtonText(trUtf8("Cancel")); pdfPD.setMinimum(-1); pdfPD.setMaximum(-1); pdfPD.setWindowIcon(QIcon(":/yagf.png")); if (pdfx) connect(&pdfPD, SIGNAL(canceled()), pdfx, SLOT(cancel())); }
/** Default Constructor */ RshareSettings::RshareSettings() { m_maxTimeBeforeIdle = -1; initSettings(); }
int main(int argc, char *argv[]) { initSettings(argc, argv); initMediaDetails(); if (DirectoryExists("/home/fpp")) loadSettings("/home/fpp/media/settings"); else loadSettings("/home/pi/media/settings"); wiringPiSetupGpio(); // would prefer wiringPiSetupSys(); // Parse our arguments first, override any defaults parseArguments(argc, argv); if (loggingToFile()) logVersionInfo(); printVersionInfo(); // Start functioning if (getDaemonize()) CreateDaemon(); scheduler = new Scheduler(); playlist = new Playlist(); sequence = new Sequence(); channelTester = new ChannelTester(); #ifndef NOROOT struct sched_param param; param.sched_priority = 99; if (sched_setscheduler(0, SCHED_FIFO, ¶m) != 0) { perror("sched_setscheduler"); exit(EXIT_FAILURE); } #endif MainLoop(); if (getFPPmode() != BRIDGE_MODE) { CleanupMediaOutput(); } if (getFPPmode() & PLAYER_MODE) { if (getFPPmode() == MASTER_MODE) ShutdownSync(); CloseChannelDataMemoryMap(); CloseEffects(); } CloseChannelOutputs(); delete channelTester; delete scheduler; delete playlist; delete sequence; return 0; }
static uint32_t swapSettingsBlock(otInstance *aInstance) { uint32_t oldBase = sSettingsBaseAddress; uint32_t swapAddress = oldBase; uint32_t usedSize = sSettingsUsedSize; uint8_t pageNum = SETTINGS_CONFIG_PAGE_NUM; uint32_t settingsSize = pageNum > 1 ? SETTINGS_CONFIG_PAGE_SIZE * pageNum / 2 : SETTINGS_CONFIG_PAGE_SIZE; (void)aInstance; otEXPECT(pageNum > 1); sSettingsBaseAddress = (swapAddress == SETTINGS_CONFIG_BASE_ADDRESS) ? (swapAddress + settingsSize) : SETTINGS_CONFIG_BASE_ADDRESS; initSettings(sSettingsBaseAddress, static_cast<uint32_t>(kSettingsInSwap)); sSettingsUsedSize = kSettingsFlagSize; swapAddress += kSettingsFlagSize; while (swapAddress < (oldBase + usedSize)) { OT_TOOL_PACKED_BEGIN struct addSettingsBlock { struct settingsBlock block; uint8_t data[kSettingsBlockDataSize]; } OT_TOOL_PACKED_END addBlock; bool valid = true; utilsFlashRead(swapAddress, reinterpret_cast<uint8_t *>(&addBlock.block), sizeof(struct settingsBlock)); swapAddress += sizeof(struct settingsBlock); if (!(addBlock.block.flag & kBlockAddCompleteFlag) && (addBlock.block.flag & kBlockDeleteFlag)) { uint32_t address = swapAddress + getAlignLength(addBlock.block.length); while (address < (oldBase + usedSize)) { struct settingsBlock block; utilsFlashRead(address, reinterpret_cast<uint8_t *>(&block), sizeof(block)); if (!(block.flag & kBlockAddCompleteFlag) && (block.flag & kBlockDeleteFlag) && !(block.flag & kBlockIndex0Flag) && (block.key == addBlock.block.key)) { valid = false; break; } address += (getAlignLength(block.length) + sizeof(struct settingsBlock)); } if (valid) { utilsFlashRead(swapAddress, addBlock.data, getAlignLength(addBlock.block.length)); utilsFlashWrite(sSettingsBaseAddress + sSettingsUsedSize, reinterpret_cast<uint8_t *>(&addBlock), getAlignLength(addBlock.block.length) + sizeof(struct settingsBlock)); sSettingsUsedSize += (sizeof(struct settingsBlock) + getAlignLength(addBlock.block.length)); } } else if (addBlock.block.flag == 0xff) { break; } swapAddress += getAlignLength(addBlock.block.length); } setSettingsFlag(sSettingsBaseAddress, static_cast<uint32_t>(kSettingsInUse)); setSettingsFlag(oldBase, static_cast<uint32_t>(kSettingsNotUse)); exit: return settingsSize - sSettingsUsedSize; }
int main(int argc, char *argv[]) { int doScale=0; // 0=Undefined, 1=320x240, -1=OpenGL, >1=SwScale char* dumpPack=NULL; int state=1; //Game, Menu, Editor, Quit int sdlVideoModeFlags = SDL_SWSURFACE; #ifdef PSP //Note to PSP porter, please test if HW is actually faster, Wizznic does a lot of memory-manipulation in the screen-surface, each call might initiate a full copy back/forth from video memory. Remove comment when read. :) sdlVideoModeFlags = (SDL_HWSURFACE | SDL_DOUBLEBUF |SDL_HWACCEL); SetupCallbacks();//Callbacks actifs scePowerSetClockFrequency(333,333,166); #endif // #ifdef WIN32 //Redirect stdout to console on windows, so we can see what's going in. // FILE *stream; // stream = freopen("CON", "w", stdout); // #endif //Print welcome message printf( "Wizznic "VERSION_STRING". GPLv3 or newer Copyleft 2010-2013\n\n"); //initialize path strings initUserPaths(); //Tell where stuff's at. printf("Directories:\n Settings: %s\n DLC: %s\n Highscores: %s\n Editorlevels: %s\n Datafiles: %s\n\n", \ getConfigDir(), getUsrPackDir(), getHighscoreDir(), getUserLevelDir(), (!strlen(DATADIR))?".":DATADIR); //Print the command line parameters printf("Command-line parameters:\n"STR_VID_OPTIONS); //Quit if user wants help if( argc > 1 && ( strcmp(argv[1], "-h")==0 || strcmp(argv[1], "--help")==0 || strcmp(argv[1], "-help")==0 )) { printf("Please see readme.txt or http://wizznic.org/ for more help.\n"); return(0); } //Read settings printf("Loading settings...\n"); initSettings(); #if defined(WITH_OPENGL) //We start by enabling glScaling if it was enabled in settings, it can then be overwritten by command line options. if( setting()->glEnable && doScale==0 ) doScale=-1; #endif //Set scaling setting()->scaleFactor=1.0; atexit(SDL_Quit); //Init SDL if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_TIMER ) <0 ) { printf("SDL_Init failed: %s\n",SDL_GetError()); return(-1); } //Setup display #if defined (GP2X) || defined (PSP) || defined (WIZ) SDL_Surface* screen = SDL_SetVideoMode(SCREENW,SCREENH,16, sdlVideoModeFlags); #else SDL_Surface* screen=NULL; int i; for( i=0; i < argc; i++ ) { if( strcmp( argv[i], "-sw" ) == 0 ) { setting()->glEnable=0; doScale=0; saveSettings(); } else if( strcmp( argv[i], "-gl" ) == 0 ) { setting()->glEnable=1; doScale=-1; saveSettings(); } else if( strcmp( argv[i], "-z" ) == 0 ) { if( i+1 < argc ) { doScale = atoi( argv[i+1] ); setting()->glEnable=0; i++; saveSettings(); } else { printf(" -z requires zoom level ( -z 2 for example ).\n"); return(1); } } else if( strcmp( argv[i], "-f" ) == 0 ) { setting()->fullScreen=1; saveSettings(); } else if( strcmp( argv[i], "-w" ) == 0 ) { setting()->fullScreen=0; saveSettings(); } else if( strcmp( argv[i], "-glheight" ) == 0 ) { if( i+1 < argc ) { setting()->glHeight = atoi( argv[i+1] ); setting()->glEnable=1; doScale=-1; i++; printf("Setting OpenGL window height to %i.\n", setting()->glHeight); saveSettings(); } else { printf(" -glheight requires an argument (-1 or size in pixels).\n"); return(1); } } else if( strcmp( argv[i], "-glwidth" ) == 0 ) { if( i+1 < argc ) { setting()->glWidth = atoi( argv[i+1] ); setting()->glEnable=1; doScale=-1; i++; printf("Setting OpenGL window width to %i.\n", setting()->glWidth); saveSettings(); } else { printf(" -glwidth requires an argument (-1 or size in pixels).\n"); return(1); } } else if( strcmp( argv[i], "-glfilter" ) == 0 ) { if( i+1 < argc ) { setting()->glFilter=atoi(argv[i+1]); printf("OpenGL texture filtering set to %s.\n", (setting()->glFilter)?"Smooth":"Off"); i++; saveSettings(); } else { printf("-glfilter requires 0 or 1 as argument.\n"); return(1); } } else if( strcmp( argv[i] , "-d" ) == 0 ) { if( argc == 3 && i < argc+1 ) { dumpPack = malloc( sizeof(char)*strlen(argv[i+1])+1 ); strcpy( dumpPack, argv[i+1] ); doScale=0; setting()->glEnable=0; i++; } else { printf("-d requires a packname, and must not be used with other parameters.\n"); return(1); } } else if( strcmp( argv[i], "-rift") == 0 ) { setting()->glWidth = 1280; setting()->glHeight = 800; setting()->glEnable=1; setting()->rift=1; doScale=-1; } else if( i > 0 ) { printf("\nError: Invalid argument '%s', quitting.\n", argv[i]); return(1); } } if( setting()->fullScreen ) { sdlVideoModeFlags |= SDL_FULLSCREEN; } if(doScale) { //Hardware accelerated scaling if( doScale == -1 ) { #ifdef HAVE_ACCELERATION printf("Enabling platform specific accelerated scaling.\n"); screen = platformInitAccel(sdlVideoModeFlags); if( !screen ) { printf("Failed to set platform accelerated scaling, falling back to software window.\n"); screen=swScreen(SDL_SWSURFACE); doScale=0; } #else printf("\nError:\n Not compiled with hardware-scaling support, don't give me -z -1\n Exiting...\n"); return(-1); #endif } else if( doScale > 0 ) { #ifdef WANT_SWSCALE //Set up software scaling printf("Enabling slow software-based scaling to %ix%i.\n",320*doScale, 240*doScale); screen = swScaleInit(sdlVideoModeFlags,doScale); #else printf("\nError:\n I don't support software scaling, don't give me any -z options\n Exiting...\n"); return(-1); #endif } } else { screen=swScreen(sdlVideoModeFlags); doScale=0; } printf("Scaling factor: %f\n", setting()->scaleFactor); if( screen == NULL ) { printf("ERROR: Couldn't init video.\n"); return(-1); } //Set window title SDL_WM_SetCaption("Wizznic!", "Wizznic!"); //Set window icon SDL_Surface* icon = IMG_Load( DATADIR"data/wmicon.png"); SDL_WM_SetIcon(icon, NULL); SDL_FreeSurface(icon); #endif setting()->bpp = screen->format->BytesPerPixel; setAlphaCol( setting()->bpp ); printf("Screen surface using %i bytes per pixel.\n",setting()->bpp); //Open Joysticks (for wiz) if (SDL_NumJoysticks() > 0) SDL_JoystickOpen(0); //Hide mouse cursor SDL_ShowCursor(SDL_DISABLE); //Load fonts txtInit(); //Load sounds if(!initSound()) { printf("Couldn't init sound.\n"); return(-1); } //Menu Graphics if(!initMenu(screen)) { printf("Couldn't load menu graphics.\n"); return(-1); } //Init controls initControls(); //Init stats statsInit(); //Init packs packInit(); //Scan userlevels dir makeUserLevelList(screen); //Init particles initParticles(screen); //Seed the pseudo random number generator (for particles 'n' stuff) srand( (int)time(NULL) ); #if defined(PC) //Need to dump level-screenshots? if(dumpPack) { printf("Dumping level-images for pack: %s\n", dumpPack); dumplevelimages(screen, dumpPack, 0); return(0); } #endif //init starfield initStars(screen); //Init pointer initPointer(screen); printf("Applying settings..\n"); //Apply settings (has to be done after packs are inited) applySettings(); //Set Pack packSetByPath( setting()->packDir ); #if defined( PLATFORM_SUPPORTS_STATSUPLOAD ) if( (setting()->uploadStats) && !(setting()->firstRun) ) { statsUpload(0,0,0,0,0,"check",1, &(setting()->session) ); statsUpload(0,0,0,0,0,"q_solved",1, &(setting()->solvedWorldWide) ); //DLC only works when stats-uploading is enabled so we can use the same nag-screen. dlcCheckOnline(); } #endif printf("Setting Music...\n"); //Start playing music (has to be done after readong settings) soundSetMusic(); //Initialize credits initCredits(screen); initTransition(); #if SCREENW != 320 || SCREENH != 240 SDL_Rect *borderSrcRect = malloc(sizeof(SDL_Rect)); SDL_Surface* border = loadImg( BORDER_IMAGE ); if( border ) { printf("Border image loaded.\n"); borderSrcRect->x=(border->w-SCREENW)/2; borderSrcRect->y=(border->h-SCREENH)/2; borderSrcRect->w=SCREENW; borderSrcRect->h=SCREENH; SDL_BlitSurface( border, borderSrcRect, screen, NULL ); SDL_FreeSurface(border); } else { printf("Could not load border image: %s\n", BORDER_IMAGE); SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0,0,0)); } free(borderSrcRect); borderSrcRect=NULL; #endif int lastTick; while(state!=STATEQUIT) { lastTick=SDL_GetTicks(); frameStart(); if(runControls()) state=STATEQUIT; switch(state) { case STATEPLAY: state = runGame(screen); break; case STATEMENU: state = runMenu(screen); break; case STATEEDIT: state=runEditor(screen); break; } drawPointer(screen); soundRun(screen,state); runTransition(screen); if(setting()->showFps) drawFPS(screen); switch( doScale ) { #if defined(HAVE_ACCELERATION) case -1: platformDrawScaled(screen); break; #endif case 0: SDL_Flip(screen); break; #if defined(WANT_SWSCALE) default: swScale(screen,doScale); break; #else default: state=STATEQUIT; break; #endif } #if defined(CRUDE_TIMING) //Oh how I loathe this, is there no better way? while(SDL_GetTicks()-lastTick <= PLATFORM_CRUDE_TIMING_TICKS) { //Burn, burn baby burn! } #else int t=SDL_GetTicks()-lastTick; if(t < 20) { SDL_Delay( 20 -t); } #endif } #if defined(PLATFORM_NEEDS_EXIT) platformExit(); #endif SDL_Quit(); return(0); }
bool QMakeProperty::exec() { bool ret = true; if(Option::qmake_mode == Option::QMAKE_QUERY_PROPERTY) { if(Option::prop::properties.isEmpty()) { initSettings(); settings->beginGroup(keyBase(false)); QStringList subs = settings->childGroups(); settings->endGroup(); subs.sort(); for(int x = subs.count() - 1; x >= 0; x--) { QString s = subs[x]; if(s.isEmpty()) continue; settings->beginGroup(keyBase(false) + s); QStringList keys = settings->childKeys(); settings->endGroup(); for(QStringList::ConstIterator it2 = keys.begin(); it2 != keys.end(); it2++) { QString ret = settings->value(keyBase(false) + s + "/" + (*it2)).toString(); if(s != qmake_version()) fprintf(stdout, "%s/", s.toLatin1().constData()); fprintf(stdout, "%s:%s\n", (*it2).toLatin1().constData(), ret.toLatin1().constData()); } } QStringList specialProps; specialProps.append("QT_INSTALL_PREFIX"); specialProps.append("QT_INSTALL_DATA"); specialProps.append("QT_INSTALL_DOCS"); specialProps.append("QT_INSTALL_HEADERS"); specialProps.append("QT_INSTALL_LIBS"); specialProps.append("QT_INSTALL_BINS"); specialProps.append("QT_INSTALL_PLUGINS"); specialProps.append("QT_INSTALL_IMPORTS"); specialProps.append("QT_INSTALL_TRANSLATIONS"); specialProps.append("QT_INSTALL_CONFIGURATION"); specialProps.append("QT_INSTALL_EXAMPLES"); specialProps.append("QT_INSTALL_DEMOS"); specialProps.append("QMAKE_MKSPECS"); specialProps.append("QMAKE_VERSION"); #ifdef QT_VERSION_STR specialProps.append("QT_VERSION"); #endif foreach (QString prop, specialProps) fprintf(stdout, "%s:%s\n", prop.toLatin1().constData(), value(prop).toLatin1().constData()); return true; } for(QStringList::ConstIterator it = Option::prop::properties.begin(); it != Option::prop::properties.end(); it++) { if(Option::prop::properties.count() > 1) fprintf(stdout, "%s:", (*it).toLatin1().constData()); if(!hasValue((*it))) { ret = false; fprintf(stdout, "**Unknown**\n"); } else { fprintf(stdout, "%s\n", value((*it)).toLatin1().constData()); } } } else if(Option::qmake_mode == Option::QMAKE_SET_PROPERTY) { for(QStringList::ConstIterator it = Option::prop::properties.begin(); it != Option::prop::properties.end(); it++) { QString var = (*it); it++; if(it == Option::prop::properties.end()) { ret = false; break; } if(!var.startsWith(".")) setValue(var, (*it)); } } else if(Option::qmake_mode == Option::QMAKE_UNSET_PROPERTY) { for(QStringList::ConstIterator it = Option::prop::properties.begin(); it != Option::prop::properties.end(); it++) { QString var = (*it); if(!var.startsWith(".")) remove(var); } } return ret; }
RTCORE_API void rtcInit(const char* cfg) { cout << "in rtcInit " << endl; Lock<MutexSys> lock(g_mutex); TRACE(rtcInit); CATCH_BEGIN; if (g_initialized) { g_mutex.unlock(); process_error(RTC_INVALID_OPERATION,"already initialized"); g_mutex.lock(); return; } g_initialized = true; /* reset global state */ initSettings(); if (cfg != NULL) { size_t pos = 0; do { std::string tok = parseIdentifier (cfg,pos); if (tok == "threads" && parseSymbol(cfg,'=',pos)) { g_numThreads = parseInt(cfg,pos); #if defined(__MIC__) if (!(g_numThreads == 1 || (g_numThreads % 4) == 0)) { g_mutex.unlock(); process_error(RTC_INVALID_OPERATION,"Xeon Phi supports only number of threads % 4 == 0, or threads == 1"); g_mutex.lock(); return; } #endif } else if (tok == "isa" && parseSymbol (cfg,'=',pos)) { std::string isa = parseIdentifier (cfg,pos); if (isa == "sse" ) cpu_features = SSE; else if (isa == "sse2") cpu_features = SSE2; else if (isa == "sse3") cpu_features = SSE3; else if (isa == "ssse3") cpu_features = SSSE3; else if (isa == "sse41") cpu_features = SSE41; else if (isa == "sse42") cpu_features = SSE42; else if (isa == "avx") cpu_features = AVX; else if (isa == "avxi") cpu_features = AVXI; else if (isa == "avx2") cpu_features = AVX2; } else if ((tok == "tri_accel" || tok == "accel") && parseSymbol (cfg,'=',pos)) g_tri_accel = parseIdentifier (cfg,pos); else if ((tok == "tri_builder" || tok == "builder") && parseSymbol (cfg,'=',pos)) g_tri_builder = parseIdentifier (cfg,pos); else if ((tok == "tri_traverser" || tok == "traverser") && parseSymbol (cfg,'=',pos)) g_tri_traverser = parseIdentifier (cfg,pos); else if ((tok == "tri_accel_mb" || tok == "accel_mb") && parseSymbol (cfg,'=',pos)) g_tri_accel = parseIdentifier (cfg,pos); else if ((tok == "tri_builder_mb" || tok == "builder_mb") && parseSymbol (cfg,'=',pos)) g_tri_builder = parseIdentifier (cfg,pos); else if ((tok == "tri_traverser_mb" || tok == "traverser_mb") && parseSymbol (cfg,'=',pos)) g_tri_traverser = parseIdentifier (cfg,pos); else if (tok == "hair_accel" && parseSymbol (cfg,'=',pos)) g_hair_accel = parseIdentifier (cfg,pos); else if (tok == "hair_builder" && parseSymbol (cfg,'=',pos)) g_hair_builder = parseIdentifier (cfg,pos); else if (tok == "hair_traverser" && parseSymbol (cfg,'=',pos)) g_hair_traverser = parseIdentifier (cfg,pos); else if (tok == "hair_builder_replication_factor" && parseSymbol (cfg,'=',pos)) g_hair_builder_replication_factor = parseInt (cfg,pos); else if (tok == "verbose" && parseSymbol (cfg,'=',pos)) g_verbose = parseInt (cfg,pos); else if (tok == "benchmark" && parseSymbol (cfg,'=',pos)) g_benchmark = parseInt (cfg,pos); else if (tok == "flags") { g_scene_flags = 0; if (parseSymbol (cfg,'=',pos)) { do { std::string flag = parseIdentifier (cfg,pos); if (flag == "static" ) g_scene_flags |= RTC_SCENE_STATIC; else if (flag == "dynamic") g_scene_flags |= RTC_SCENE_DYNAMIC; else if (flag == "compact") g_scene_flags |= RTC_SCENE_COMPACT; else if (flag == "coherent") g_scene_flags |= RTC_SCENE_COHERENT; else if (flag == "incoherent") g_scene_flags |= RTC_SCENE_INCOHERENT; else if (flag == "high_quality") g_scene_flags |= RTC_SCENE_HIGH_QUALITY; else if (flag == "robust") g_scene_flags |= RTC_SCENE_ROBUST; } while (parseSymbol (cfg,',',pos)); } } } while (findNext (cfg,',',pos)); } if (g_verbose >= 1) { std::cout << "Embree Ray Tracing Kernels " << __EMBREE_VERSION__ << " (" << __DATE__ << ")" << std::endl; std::cout << " Compiler : " << getCompilerName() << std::endl; std::cout << " Platform : " << getPlatformName() << std::endl; std::cout << " CPU : " << stringOfCPUFeatures(getCPUFeatures()) << std::endl; std::cout << " Features : "; #if defined(__USE_RAY_MASK__) std::cout << "raymasks "; #endif #if defined (__BACKFACE_CULLING__) std::cout << "backfaceculling "; #endif #if defined(__INTERSECTION_FILTER__) std::cout << "intersection_filter "; #endif #if defined(__BUFFER_STRIDE__) std::cout << "bufferstride "; #endif std::cout << std::endl; #if defined (__MIC__) #if defined(__BUFFER_STRIDE__) std::cout << " WARNING: enabled 'bufferstride' support will lower BVH build performance" << std::endl; #endif #endif } /* CPU has to support at least SSE2 */ #if !defined (__MIC__) if (!has_feature(SSE2)) { g_mutex.unlock(); process_error(RTC_UNSUPPORTED_CPU,"CPU does not support SSE2"); g_mutex.lock(); return; } #endif g_error = createTls(); g_error_function = NULL; init_globals(); cout << "in rtcInit(), BVH4Register() " << endl; #if !defined(__MIC__) cout << "BVH4Register()" << endl; BVH4Register(); #else cout << "BVH4iRegister() " << endl; BVH4iRegister(); #endif cout << "BVH4MBRegister() " << endl; BVH4MBRegister(); BVH4HairRegister(); #if defined(__TARGET_AVX__) cout << "BVH8Register() " << endl; if (has_feature(AVX)) { BVH8Register(); } #endif InstanceIntersectorsRegister(); //if (g_verbose >= 2) printSettings(); TaskScheduler::create(g_numThreads); cout << " end rtcInit " << endl; CATCH_END; }
void QMakeProperty::setValue(QString var, const QString &val) { initSettings(); settings->setValue(var, val); }
Daemon::Daemon(int argc, char *argv[]) : QCoreApplication(argc, argv) { initSettings(); char defaultLogFilename[] = DEFAULT_LOG_FILE; char* logFilename = defaultLogFilename; int port = DEFAULT_LOCAL_PORT; bool isDaemon = true; bool runWiFiScanner = true; bool runMovementDetector = true; bool recordScans = false; bool runAllAlgorithms = false; ////////////////////////////////////////////////////////// // Make sure no other arguments have been given QStringList args = QCoreApplication::arguments(); QStringListIterator argsIter(args); argsIter.next(); // moled while (argsIter.hasNext()) { QString arg = argsIter.next(); if (arg == "-h") { usage(); } else if (arg == "-v") { version(); } else if (arg == "-d") { debug = true; } else if (arg == "-n") { isDaemon = false; logFilename = NULL; } else if (arg == "-l") { logFilename = argsIter.next().toAscii().data(); } else if (arg == "-s") { mapServerURL = argsIter.next(); } else if (arg == "-f") { staticServerURL = argsIter.next(); } else if (arg == "-r") { rootPathname = argsIter.next(); } else if (arg == "-p") { port = argsIter.next().toInt(); } else if (arg == "--no-accelerometer") { runMovementDetector = false; } else if (arg == "--no-wifi") { runWiFiScanner = false; } else if (arg == "-S") { recordScans = true; } else if (arg == "-A") { runAllAlgorithms = true; } else if (arg == "-H") { SpeedSensor::HibernateWhenInactive = true; } else { usage(); } } // Seed rng QTime time = QTime::currentTime(); qsrand((uint)time.msec()); settings = new QSettings(QSettings::SystemScope, MOLE_ORGANIZATION, MOLE_APPLICATION, this); ////////////////////////////////////////////////////////// // Read default settings if (settings->contains("wifi_scanning")) { runWiFiScanner = settings->value("wifi_scanning").toBool(); } if (settings->contains("movement_detector")) { runMovementDetector = settings->value("movement_detector").toBool(); } if (settings->contains("map_server_url")) { mapServerURL = settings->value("map_server_url").toString(); } if (settings->contains("fingerprint_server_url")) { staticServerURL = settings->value("fingerprint_server_url").toString(); } if (settings->contains("port")) { port = settings->value("port").toInt(); } if (settings->contains("root_path")) { rootPathname = settings->value("root_path").toString(); } if (isDaemon) { daemonize(); } else { qDebug() << "not daemonizing"; } ////////////////////////////////////////////////////////// // check a few things before daemonizing initCommon(this, logFilename); qWarning() << "Starting mole daemon " << "debug=" << debug << "port=" << port << "wifi_scanning=" << runWiFiScanner << "movement_detector=" << runMovementDetector << "logFilename=" << logFilename << "map_server_url=" << mapServerURL << "fingerprint_server_url=" << staticServerURL << "rootPath=" << rootPathname; // start create map directory if (!rootDir.exists("map")) { bool ret = rootDir.mkdir("map"); if (!ret) { qFatal("Failed to create map directory. Exiting..."); exit(-1); } qDebug() << "created map dir"; } // end create map directory // reset session cookie on MOLEd restart resetSessionCookie(); m_localizer = new Localizer(this, runAllAlgorithms); if (runMovementDetector && SpeedSensor::haveAccelerometer()) { m_scanQueue = new ScanQueue(this, m_localizer, 0, recordScans); } else { // since we are not detecting motion, only use this many scans // for localization const int maxActiveQueueLength = 12; m_scanQueue = new ScanQueue(this, m_localizer, maxActiveQueueLength, recordScans); } m_binder = new Binder(this, m_localizer, m_scanQueue); m_proximity = new Proximity(this, m_localizer); m_localServer = new LocalServer(this, m_localizer, m_binder, port); m_scanner = 0; if (runWiFiScanner) { m_scanner = new Scanner(this); connect(m_scanner, SIGNAL(setWiFiDesc(QString)), m_binder, SLOT(setWiFiDesc(QString))); connect(m_scanner, SIGNAL(addReading(QString,QString,qint16,qint8)), m_scanQueue, SLOT(addReading(QString,QString,qint16,qint8))); connect(m_scanner, SIGNAL(scanCompleted()), m_scanQueue, SLOT(scanCompleted())); } m_speedSensor = 0; if (runMovementDetector && SpeedSensor::haveAccelerometer()) { m_speedSensor = new SpeedSensor(this); connect(m_speedSensor, SIGNAL(hibernate(bool)), m_scanner, SLOT(handleHibernate(bool))); connect(m_speedSensor, SIGNAL(hibernate(bool)), m_localizer, SLOT(handleHibernate(bool))); connect(m_speedSensor, SIGNAL(motionChange(Motion)), m_localizer, SLOT(handleMotionChange(Motion))); connect(m_speedSensor, SIGNAL(motionChange(Motion)), m_scanQueue, SLOT(handleMotionChange(Motion))); } connect(this, SIGNAL(aboutToQuit()), SLOT(handle_quit())); if (runWiFiScanner) { m_scanner->start(); } }
MainWindow::MainWindow(QApplication* app) : main_page_(nullptr) , login_page_(nullptr) #ifdef __APPLE__ , accounts_page_(nullptr) #endif //_APPLE__ , app_(app) , event_filter_(new TitleWidgetEventFilter(this)) , tray_icon_(new TrayIcon(this)) , backgroundPixmap_(QPixmap()) , Shadow_(0) , SkipRead_(false) , TaskBarIconHidden_(false) , liveChats_(new LiveChats(this)) { Utils::InterConnector::instance().setMainWindow(this); #ifdef _WIN32 Utils::init_crash_handlers_in_core(); core::dump::crash_handler chandler; chandler.set_process_exception_handlers(); chandler.set_thread_exception_handlers(); #endif //_WIN32 setStyleSheet(Utils::LoadStyle(":/main_window/main_window.qss", Utils::get_scale_coefficient(), true)); #ifdef __APPLE__ mac_support_ = new MacSupport(this); mac_support_->enableMacCrashReport(); #endif app_->installNativeEventFilter(this); if (this->objectName().isEmpty()) this->setObjectName(QStringLiteral("main_window")); this->resize(329, 331); QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth()); this->setSizePolicy(sizePolicy); this->setLayoutDirection(Qt::LeftToRight); this->setAutoFillBackground(false); main_widget_ = new QWidget(this); main_widget_->setObjectName(QStringLiteral("main_widget")); sizePolicy.setHeightForWidth(main_widget_->sizePolicy().hasHeightForWidth()); main_widget_->setSizePolicy(sizePolicy); vertical_layout_ = new QVBoxLayout(main_widget_); vertical_layout_->setSpacing(0); vertical_layout_->setObjectName(QStringLiteral("verticalLayout_9")); vertical_layout_->setSizeConstraint(QLayout::SetDefaultConstraint); vertical_layout_->setContentsMargins(0, 0, 0, 0); title_widget_ = new QWidget(main_widget_); title_widget_->setObjectName(QStringLiteral("title_widget")); QSizePolicy sizePolicy1(QSizePolicy::Preferred, QSizePolicy::Fixed); sizePolicy1.setHorizontalStretch(0); sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(title_widget_->sizePolicy().hasHeightForWidth()); title_widget_->setSizePolicy(sizePolicy1); title_widget_->setProperty("TitleWidget", QVariant(true)); horizontal_layout_ = new QHBoxLayout(title_widget_); horizontal_layout_->setSpacing(0); horizontal_layout_->setObjectName(QStringLiteral("horizontalLayout")); horizontal_layout_->setContentsMargins(0, 0, 0, 0); logo_ = new QPushButton(title_widget_); logo_->setObjectName(QStringLiteral("logo")); QSizePolicy sizePolicy2(QSizePolicy::Fixed, QSizePolicy::Fixed); sizePolicy2.setHorizontalStretch(0); sizePolicy2.setVerticalStretch(0); sizePolicy2.setHeightForWidth(logo_->sizePolicy().hasHeightForWidth()); logo_->setSizePolicy(sizePolicy2); logo_->setProperty("WindowIcon", QVariant(true)); horizontal_layout_->addWidget(logo_); title_ = new QLabel(title_widget_); title_->setObjectName(QStringLiteral("title")); title_->setProperty("Title", QVariant(true)); horizontal_layout_->addWidget(title_); horizontal_spacer_ = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); horizontal_layout_->addItem(horizontal_spacer_); hide_button_ = new QPushButton(title_widget_); hide_button_->setObjectName(QStringLiteral("hide_button")); hide_button_->setProperty("HideButton", QVariant(true)); horizontal_layout_->addWidget(hide_button_); maximize_button_ = new QPushButton(title_widget_); maximize_button_->setObjectName(QStringLiteral("maximize_button")); sizePolicy2.setHeightForWidth(maximize_button_->sizePolicy().hasHeightForWidth()); maximize_button_->setSizePolicy(sizePolicy2); maximize_button_->setProperty("MaximizeButton", QVariant(true)); horizontal_layout_->addWidget(maximize_button_); close_button_ = new QPushButton(title_widget_); close_button_->setObjectName(QStringLiteral("close_button")); sizePolicy2.setHeightForWidth(close_button_->sizePolicy().hasHeightForWidth()); close_button_->setSizePolicy(sizePolicy2); close_button_->setProperty("CloseButton", QVariant(true)); horizontal_layout_->addWidget(close_button_); vertical_layout_->addWidget(title_widget_); stacked_widget_ = new BackgroundWidget(main_widget_, ""); stacked_widget_->setObjectName(QStringLiteral("stacked_widget")); QPixmap p(":/resources/main_window/pat_100.png"); setBackgroundPixmap(p, true); //Utils::InterConnector::instance().setMainWindow(this); get_qt_theme_settings()->setOrLoadDefaultTheme(); vertical_layout_->addWidget(stacked_widget_); this->setCentralWidget(main_widget_); logo_->setText(QString()); hide_button_->setText(QString()); maximize_button_->setText(QString()); close_button_->setText(QString()); stacked_widget_->setCurrentIndex(-1); QMetaObject::connectSlotsByName(this); if (!get_gui_settings()->get_value(settings_keep_logged_in, true))// || !get_gui_settings()->contains_value(settings_keep_logged_in)) { showLoginPage(); } else { showMainPage(); } title_widget_->installEventFilter(event_filter_); title_->setText("ICQ"); title_->setAttribute(Qt::WA_TransparentForMouseEvents); logo_->setAttribute(Qt::WA_TransparentForMouseEvents); setWindowTitle("ICQ"); #ifdef _WIN32 setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint | Qt::WindowMinimizeButtonHint); fake_parent_window_ = Utils::create_fake_parent_window(); #else title_widget_->hide(); #endif title_->setMouseTracking(true); connect(hide_button_, SIGNAL(clicked()), this, SLOT(minimize()), Qt::QueuedConnection); connect(maximize_button_, SIGNAL(clicked()), this, SLOT(maximize()), Qt::QueuedConnection); connect(close_button_, SIGNAL(clicked()), this, SLOT(hideWindow()), Qt::QueuedConnection); hide_button_->setCursor(Qt::PointingHandCursor); maximize_button_->setCursor(Qt::PointingHandCursor); close_button_->setCursor(Qt::PointingHandCursor); connect(event_filter_, SIGNAL(doubleClick()), this, SLOT(maximize()), Qt::QueuedConnection); connect(event_filter_, SIGNAL(moveRequest(QPoint)), this, SLOT(moveRequest(QPoint)), Qt::QueuedConnection); connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipResetComplete()), this, SLOT(onVoipResetComplete()), Qt::QueuedConnection); connect(Ui::GetDispatcher(), SIGNAL(needLogin()), this, SLOT(showLoginPage()), Qt::DirectConnection); connect(&Utils::InterConnector::instance(), SIGNAL(showIconInTaskbar(bool)), this, SLOT(showIconInTaskbar(bool)), Qt::QueuedConnection); connect(this, SIGNAL(needActivate()), this, SLOT(activate()), Qt::QueuedConnection); connect(get_gui_settings(), SIGNAL(changed(QString)), this, SLOT(guiSettingsChanged(QString)), Qt::QueuedConnection); QFont f = QApplication::font(); f.setStyleStrategy(QFont::PreferAntialias); QApplication::setFont(f); if (platform::is_windows()) { int shadowWidth = get_gui_settings()->get_shadow_width(); QBrush b = stacked_widget_->palette().background(); QMatrix m; m.translate(shadowWidth, title_widget_->height() + shadowWidth); b.setMatrix(m); Shadow_ = new ShadowWindow(b, shadowWidth); QPoint pos = mapToGlobal(QPoint(rect().x(), rect().y())); Shadow_->move(pos.x(), pos.y()); Shadow_->resize(rect().width(), rect().height()); Shadow_->setActive(true); Shadow_->show(); } initSettings(); #ifdef _WIN32 DragAcceptFiles((HWND)winId(), TRUE); #endif //_WIN32 if (!get_gui_settings()->get_value<bool>(settings_show_in_taskbar, true)) hide_taskbar_icon(); #ifdef __APPLE__ mac_support_->enableMacUpdater(); mac_support_->enableMacPreview(this->winId()); #endif }
int main(int argc, char **argv) { bool listDrivers = false; struct option long_options[] = { {"directory", required_argument, 0,'d'}, {"flatten", no_argument, 0,'f'}, {"help", no_argument, 0,'h'}, {"quiet", no_argument, 0,'q'}, {"test", no_argument, 0,'t'}, {"verbose", no_argument, 0,'v'}, {"driver", required_argument, 0, OPT_DRIVER}, {"list-drivers", no_argument, 0, OPT_LIST_DRIVERS}, {0, 0, 0, 0} }; while (1) { // getopt_long stores the option index here. int option_index = 0; int c = getopt_long(argc, argv, "d:fhtvq", long_options, &option_index); if (c == -1) break; switch (c) { case 0: break; case 'd': opt.dir = optarg; break; case 'v': opt.verbose++; break; case 'q': opt.verbose--; break; case 'h': usage(0); break; case OPT_DRIVER: opt.driverName = optarg; break; case OPT_LIST_DRIVERS: listDrivers = true; break; default: usage("Unknown argument"); break; } } initCrash(); initLog(); initDevice(); initSettings(); UiFactory *driver = 0; for (unsigned int i = 0; i < drivers.size(); ++i) { UiFactory *factory = (UiFactory*)drivers.get(i); if (listDrivers) { printf("\t%s\n", factory->getName()); } else if (opt.driverName) { if (strcmp(factory->getName(), opt.driverName) == 0) { if (!factory->init()) { return 1; } driver = factory; break; } } else { if (factory->init()) { driver = factory; break; } } } if (listDrivers) { return 0; } if (! driver) { printf("No suitable output driver found\n"); return 1; } // TODO: error messages after this point must go to the driver, not stderr while (optind < argc) { // TODO list opt.file = argv[optind++]; } if (!opt.file && !opt.dir) { usage("Please specify an epub file or directory."); } Controller c(driver); c.run(); driver->deinit(); return 0; }