void ofxSimpleGuiToo::setup() { config = &defaultSimpleGuiConfig; // guiFocus = 0; // xmlFilename = OFX_SIMPLEGUITOO_XML_NAME; doSave = false; // doSaveBackup = false; changePage = false; titleButton = NULL; headerPage = &addPage("Header"); headerPage->height = config->buttonHeight * 2; headerPage->width = 0; titleButton = &headerPage->addButton("title", changePage); headerPage->addToggle("Auto Save", doAutoSave); headerPage->addButton("Save Settings", doSave); // headerPage->addButton("Backup XML", doSaveBackup); headerPage->addFPSCounter(); addPage(); setAutoSave(true); setAlignRight(false); setDraw(false); setPage(1); ofAddListener(ofEvents.keyPressed, this, &ofxSimpleGuiToo::keyPressed); }
// set default values void Config::setDefaultSettings() { setSaveDir(getDirNameDefault()); setSaveFileName(DEF_SAVE_NAME); setSaveFormat(DEF_SAVE_FORMAT); setDefDelay(DEF_DELAY); setImageQuality(DEF_IMG_QUALITY); setDateTimeInFilename(DEF_DATETIME_FILENAME); setDateTimeTpl(DEF_DATETIME_TPL); setAutoCopyFilenameOnSaving(DEF_FILENAME_TO_CLB); setAutoSave(DEF_AUTO_SAVE); setAutoSaveFirst(DEF_AUTO_SAVE_FIRST); setTrayMessages(DEF_TRAY_MESS_TYPE); setIncludeCursor(DEF_INCLUDE_CURSOR); setZoomAroundMouse(DEF_ZOOM_AROUND_MOUSE); setCloseInTray(DEF_CLOSE_IN_TRAY); setTimeTrayMess(DEF_TIME_TRAY_MESS); setAllowMultipleInstance(DEF_ALLOW_COPIES); // TODO - make set windows size without hardcode values // setRestoredWndSize(DEF_WND_WIDTH, DEF_WND_HEIGHT); setShowTrayIcon(DEF_SHOW_TRAY); setEnableExtView(DEF_ENABLE_EXT_VIEWER); _shortcuts->setDefaultSettings(); setNoDecoration(DEF_X11_NODECOR); setDelay(DEF_DELAY); quint8 countModules = Core::instance()->modules()->count(); for (int i = 0; i < countModules; ++i) Core::instance()->modules()->getModule(i)->defaultSettings(); }
// load all settings from conf file void Config::loadSettings() { _settings->beginGroup("Base"); setSaveDir(_settings->value(KEY_SAVEDIR, getDirNameDefault()).toString() ); setSaveFileName(_settings->value(KEY_SAVENAME,DEF_SAVE_NAME).toString()); setSaveFormat(_settings->value(KEY_SAVEFORMAT, DEF_SAVE_FORMAT).toString()); setDefDelay(_settings->value(KEY_DELAY, DEF_DELAY).toInt()); setDefScreenshotType(screenshotTypeFromString(_settings->value(QLatin1String(KEY_SCREENSHOT_TYPE_DEF)).toString())); setAutoCopyFilenameOnSaving(_settings->value(KEY_FILENAME_TO_CLB, DEF_FILENAME_TO_CLB).toInt()); setDateTimeInFilename(_settings->value(KEY_FILENAMEDATE, DEF_DATETIME_FILENAME).toBool()); setDateTimeTpl(_settings->value(KEY_DATETIME_TPL, DEF_DATETIME_TPL).toString()); setAutoSave(_settings->value(KEY_AUTOSAVE, DEF_AUTO_SAVE).toBool()); setAutoSaveFirst(_settings->value(KEY_AUTOSAVE_FIRST, DEF_AUTO_SAVE_FIRST).toBool()); setNoDecoration(_settings->value(KEY_NODECOR, DEF_X11_NODECOR).toBool()); setImageQuality(_settings->value(KEY_IMG_QUALITY, DEF_IMG_QUALITY).toInt()); setIncludeCursor(_settings->value(KEY_INCLUDE_CURSOR, DEF_INCLUDE_CURSOR).toBool()); _settings->endGroup(); _settings->beginGroup("Display"); setTrayMessages(_settings->value(KEY_TRAYMESSAGES, DEF_TRAY_MESS_TYPE).toInt()); setTimeTrayMess(_settings->value(KEY_TIME_NOTIFY, DEF_TIME_TRAY_MESS).toInt( )); setZoomAroundMouse(_settings->value(KEY_ZOOMBOX, DEF_ZOOM_AROUND_MOUSE).toBool()); // TODO - make set windows size without hardcode values setRestoredWndSize(_settings->value(KEY_WND_WIDTH, DEF_WND_WIDTH).toInt(), _settings->value(KEY_WND_HEIGHT, DEF_WND_HEIGHT).toInt()); setShowTrayIcon(_settings->value(KEY_SHOW_TRAY, DEF_SHOW_TRAY).toBool()); _settings->endGroup(); _settings->beginGroup("System"); setCloseInTray(_settings->value(KEY_CLOSE_INTRAY, DEF_CLOSE_IN_TRAY).toBool()); setAllowMultipleInstance(_settings->value(KEY_ALLOW_COPIES, DEF_ALLOW_COPIES).toBool()); setEnableExtView(_settings->value(KEY_ENABLE_EXT_VIEWER, DEF_ENABLE_EXT_VIEWER).toBool()); _settings->endGroup(); setDelay(getDefDelay()); _shortcuts->loadSettings(); }
void ofxSimpleGuiToo::setup() { config = &defaultSimpleGuiConfig; doSave = false; changePage = false; titleButton = NULL; headerPage = &addPage("Header"); headerPage->height = config->buttonHeight * 2; headerPage->width = 0; titleButton = &headerPage->addButton("title", changePage); headerPage->addToggle("Auto Save", doAutoSave); headerPage->addButton("Save Settings", doSave); headerPage->addFPSCounter(); addPage(); setAutoSave(true); setAlignRight(false); setDraw(false); setPage(1); ofAddListener(ofEvents.keyPressed, this, &ofxSimpleGuiToo::keyPressed); }
void ofxSimpleGuiToo::setup() { config = &defaultSimpleGuiConfig; doSave = false; changePage = false; titleButton = NULL; keyboardShortcutsEnabled = true; doDrawPageBoundary = false; headerPage = &addPage("Header"); headerPage->height = config->buttonHeight * 2; headerPage->width = 0; titleButton = &headerPage->addButton("title", changePage); headerPage->addToggle("Auto Save", doAutoSave); headerPage->addButton("Save Settings", doSave); headerPage->addFPSCounter(); cols = ceilf(ofGetWidth() / config->gridSize.x); rows = ceilf(ofGetHeight() / config->gridSize.y); addPage(); // default settings page addFPSCounter(); setAutoSave(true); setAlignRight(false); setDraw(false); //addToggle("", <#bool value#>) //addControl(*titleButton); page(1).addPageShortcut(addPage("Keyboard Shortcuts")); page(1).addPageShortcut(addPage("GUI")); //setPage("GUI"); addButton("save settings", doSave); addToggle("auto save", doAutoSave); //gui.addTitle("gui display"); gui.addTitle("controls"); string choices[] = {"simple","advanced","all"}; gui.addComboBox("display priority", ofxSimpleGuiPage::mainPriority, 3, choices); gui.addButton("collapse all", 't', this, &ofxSimpleGuiToo::closeAllTitles); gui.addButton("open all", 'T', this, &ofxSimpleGuiToo::openAllTitles); gui.addTitle("display mode"); string displayModeChoices[GUI_MODE_COUNT] = {"fixed","floating"}; addComboBox("display mode", displayMode, GUI_MODE_COUNT, displayModeChoices); gui.addTitle("floating parameters"); gui.addSlider("x", displayRect.x, 0, ofGetWidth()); gui.addSlider("y", displayRect.y, 0, ofGetHeight()); gui.addSlider("columns", cols, 1, 10); gui.addSlider("rows", rows, 5, 30); gui.addButton("reset", this, &ofxSimpleGuiToo::setDefaultDimensions); gui.addToggle("draw boundaries", doDrawPageBoundary); //gui.addSlider("gui width", displayRect.width, 256, ofGetWidth()); //gui.addSlider("gui height", displayRect.height, 256, ofGetHeight()); setPage(1); //addSlider("advanced gui", ofxSimpleGuiControl::mainPriority, 0, 2); ofAddListener(ofEvents.keyPressed, this, &ofxSimpleGuiToo::keyPressed); }