static int _autosave_timer_tick(void *data) { autosave(); return 1; }
//------------------------------------------------------------------------------ Command::Status Reset::execute(Game*& board, std::vector<std::string>& params) { if (params.size()) { return WRONG_PARAMETER_COUNT_; } if (!board) { return NO_MAZE_LOADED_; } board->reset(); if (Saver::isAutosaveActive()) { std::vector<std::string> autosave_params = Saver::getAutosaveParams(); Save autosave("autosave"); Command::Status autosave_status = autosave.execute(board, autosave_params); if (autosave_status) { Message::outputByCode(autosave_status); } } return OK_; }
void QFEHelpEditorWidget::autosave() { if (isVisible()) { QDir d(QFPluginServices::getInstance()->getConfigFileDirectory()); QString ffn= d.absoluteFilePath(QString("helpeditor%1_autosave.html").arg(m_winID)); if (!getScript().isEmpty() && !qfFileEqualsString(ffn, ui->edtScript->getEditor()->toPlainText().toUtf8())) { d.mkpath(d.absolutePath()); // copy _autosave_old.html --> _autosave_older.html QString fn= d.absoluteFilePath(QString("helpeditor%1_autosave_old.html").arg(m_winID)); QString newfn= d.absoluteFilePath(QString("helpeditor%1_autosave_older.html").arg(m_winID)); if (QFile::exists(fn)) { if (QFile::exists(newfn)) QFile::remove(newfn); QFile::copy(fn, newfn); } // copy _autosave.html --> _autosave_old.html fn= ffn; newfn= d.absoluteFilePath(QString("helpeditor%1_autosave_old.html").arg(m_winID)); if (QFile::exists(fn)) { if (QFile::exists(newfn)) QFile::remove(newfn); QFile::copy(fn, newfn); } saveFile(fn, false); } else { qDebug()<<"QFEHelpEditorWidget::autosave(): file contents didn't change!"; } } QTimer::singleShot(AUTOSAVE_INTERVAL_MSEC, this, SLOT(autosave())); }
void init_cron() { mixed *local; local = localtime(time()); if ( !((local[1])%30)) autosave(); if (random(5))TASK_D->init_dynamic_quest(); else TASK_D->init_dynamic_quest(1); call_out("init_cron", 120); }
void FastQSPWindow::openFile(const QString &filename) { qspFilePath = filename; builder.clear(); if (gameIsOpen) autosave(); gameDirectory = QFileInfo(filename).absolutePath() + "/"; if (!QSPLoadGameWorld(filename.toStdWString().c_str(), &gameDirectory)) qCritical() << QString("Could not open file: ") << filename; if (QSPRestartGame(QSP_TRUE)) { gameMenu->setEnabled(true); builder.setGameDir(gameDirectory); netManager.setGameDirectory(gameDirectory); loadFonts(); QFile configFile(gameDirectory + QLatin1String("config.xml")); if (configFile.open(QFile::ReadOnly)) { QTextStream stream(&configFile); QString config = stream.readLine(); configFile.close(); QRegExp re; re.setMinimal(true); re.setPattern("width=\"(\\d+)\""); if (re.indexIn(config)) gameWidth = re.cap(1).toInt(); else gameWidth = 800; re.setPattern("height=\"(\\d+)\""); if (re.indexIn(config) > 0) gameHeight = re.cap(1).toInt(); else gameHeight = 600; aspectRatio = qreal(gameWidth) / qreal(gameHeight); re.setPattern("title=\"(.+)\""); if (re.indexIn(config) >= 0) setWindowTitle(re.cap(1)); else setWindowTitle("FastQSP"); re.setPattern("icon=\"(.+)\""); if (re.indexIn(config) >= 0) QApplication::setWindowIcon(QIcon(gameDirectory + re.cap(1))); } aspectRatio = qreal(gameWidth) / qreal(gameHeight); loadPage(); webView->resize(gameWidth, gameHeight); resize(gameWidth, gameHeight); gameIsOpen = true; saveDir = gameDirectory + "save/"; if (!saveDir.exists()) { saveDir.mkpath("."); } timer.restart(); } }
void Document::markDirty() { bool wasDirty = m_dirty; m_dirty = true; if(m_autosave) autosave(); if(!wasDirty) emit dirtyCanvas(m_dirty); }
void MainWindow::update() { updateStatus(); if (updateImage) updateCurrentImage(); unsigned int goodMuts = imageMutator.getGoodMutationCount(); if (goodMuts - lastUpdate > (unsigned int)Constants::C_AUTOSAVE_SPEED) { lastUpdate = goodMuts; autosave(); } }
void interface (gint argc, gchar *argv[]) { GtkWidget *MenuBar; GtkWidget *VBox; GtkWidget *HandleBox; gtk_set_locale(); gtk_init (&argc, &argv); Settings = init_settings (); MainWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW(MainWindow), g_strconcat (WELCOME_MSG, " ", APP_NAME, " ", VERSION_NUMBER, NULL)); gtk_window_set_policy (GTK_WINDOW(MainWindow), TRUE, TRUE, FALSE); gtk_widget_set_usize (MainWindow, MAIN_WINDOW_WIDTH, MAIN_WINDOW_HEIGHT); gtk_signal_connect (GTK_OBJECT(MainWindow), "delete_event", (GtkSignalFunc) quit, NULL); gtk_signal_connect (GTK_OBJECT(MainWindow), "destroy", (GtkSignalFunc) quit, NULL); FileProperties = g_array_new (TRUE, FALSE, sizeof(t_fprops)); VBox = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER(MainWindow), VBox); HandleBox = gtk_handle_box_new(); gtk_container_set_border_width (GTK_CONTAINER(HandleBox), 2); gtk_box_pack_start (GTK_BOX(VBox), HandleBox, FALSE, FALSE, 0); init_toolbar (GTK_BOX(VBox)); MainNotebook = gtk_notebook_new (); read_uedit_wordfile (WORDFILE); editor_init(); MenuBar = menubar_new (MainWindow); gtk_container_add (GTK_CONTAINER(HandleBox), MenuBar); gtk_notebook_popup_enable (GTK_NOTEBOOK(MainNotebook)); gtk_notebook_set_homogeneous_tabs (GTK_NOTEBOOK(MainNotebook), TRUE); gtk_notebook_set_scrollable (GTK_NOTEBOOK(MainNotebook), TRUE); gtk_box_pack_start (GTK_BOX(VBox), MainNotebook, TRUE, TRUE, 0); gtk_signal_connect (GTK_OBJECT(MainNotebook), "switch_page", (GtkSignalFunc) set_title, NULL); init_msgbar (GTK_BOX(VBox)); print_msg ("You're the welcome..."); command_line (argc, argv); autosave (AUTOSAVE_DELAY); gtk_widget_show_all (MainWindow); if (!MSGBAR_DISPLAY) hide_msgbar (); if (!TOOLBAR_DISPLAY) hide_toolbar (); gtk_timeout_add (80, (GtkFunction)display_line_column, NULL); gtk_main (); set_preferences_to_disk (&Settings, NULL); gtk_item_factory_dump_rc (g_strconcat (g_get_home_dir (), PATH_SEP_STRING, CONF_DIR, PATH_SEP_STRING, "AccelRC", NULL), NULL, FALSE); }
// read in a new mission file from disk BOOL CFREDDoc::OnOpenDocument(LPCTSTR pathname) { char name[1024]; int i, len; if (pathname) strcpy(mission_pathname, pathname); if (Briefing_dialog) Briefing_dialog->icon_select(-1); // clean things up first len = strlen(mission_pathname); strcpy(name, mission_pathname); if (name[len - 4] == '.') len -= 4; name[len] = 0; // drop extension i = len; while (i--) if ((name[i] == '\\') || (name[i] == ':')) break; strcpy(Mission_filename, name + i + 1); // for (i=1; i<=BACKUP_DEPTH; i++) { // sprintf(name + len, ".%.3d", i); // unlink(name); // } if (load_mission(mission_pathname)) { *Mission_filename = 0; return FALSE; } Fred_view_wnd->global_error_check(); autosave("nothing"); Undo_count = 0; AddToRecentFileList(pathname); return TRUE; }
void FastQSPWindow::loadPage() { QString html = builder.getHTML(); QStringList urlmatches = scanHTMLForImages(html); if(replaceHTML) { replaceHTML = false; choseRandomImageFromArray(urlmatches); } if(builder.thereIsAMessage == false) maybePlayVideo(html, urlmatches); if(newImage != "") html.replace(origImage, newImage); webView->setHtml(html, QUrl("http://qspgame.local")); if (autosaveAction->isChecked()) autosave(); }
void init_cron() { mixed *local; local = localtime(time()); // every 45 mins, autosave every player if ( !((local[1])%45)) autosave(); // On average tasks get renewed every 30 mins if ( !random(30)) TASK_D->init_dynamic_quest(); //How long the system will refresh all tasks. Added by FY@SH-Morrison //-------------------------------------------------------------------- if ( !((local[1])%60)) { message("system",HIR "重新分布所有使命。。。" NOR,users()); TASK_D->init_dynamic_quest(1); message("system",HIG "。。。所有使命分布完毕\n" NOR,users()); } //-------------------------------------------------------------------- //修改以上第一行中百分号后的数字(现在设的60代表1小时)就可以修改task重新分布的时间间间隔了。 //above is add by Morrison // Check pets that's lost heartbeat if( !(local[1]%5)) if(!find_object(VOID_OB)) call_other(VOID_OB,"???"); check_pets(); // if dns_master not working, every 15 mins re-initalize it if ( !(local[1]%15)) { check_dns(); // if WHO_D,NATURE_D dies restart them check_whonature(); STATUS_D->write_list(); } call_out("init_cron", 60); }
static int project_cb(Quark *pr, int etype, void *data) { if (etype == QUARK_ETYPE_DELETE) { GraceApp *gapp = gapp_from_quark(pr); if (pr == gproject_get_top(gapp->gp)) { gapp->gp = NULL; } } else if (etype == QUARK_ETYPE_MODIFY) { #if 0 /* TODO: */ if ((dirtystate > SOME_LIMIT) || (current_time - autosave_time > ANOTHER_LIMIT) ) { autosave(); } #endif } #ifndef NONE_GUI clean_graph_selectors(pr, etype, data); clean_frame_selectors(pr, etype, data); #endif return RETURN_SUCCESS; }
void init_cron() { mixed *local; local = localtime(time()); // every 45 mins, autosave every player if ( !((local[1])%45)) autosave(); // On average tasks get renewed every 30 mins if ( !random(30)) TASK_D->init_dynamic_quest(); // Check pets that's lost heartbeat if( !(local[1]%5)) if(!find_object(VOID_OB)) call_other(VOID_OB,"???"); check_pets(); // if dns_master not working, every 15 mins re-initalize it if ( !(local[1]%15)) { check_dns(); // if WHO_D,NATURE_D dies restart them check_whonature(); STATUS_D->write_list(); } call_out("init_cron", 60); }
int main(int argc, char **argv) { int ch, i, loop; struct utsname ubuf; const char *str, *dstr; /* This function runs all the setup for startup, and then * proceeds into the primary event loop at the end. */ /* Init state variable struct */ memset(&Mode, 0, sizeof(EMode)); Mode.wm.master = 1; Mode.wm.pid = getpid(); Mode.wm.exec_name = argv[0]; Mode.wm.startup = 1; Mode.mode = MODE_NONE; EXInit(); Dpy.screen = -1; str = getenv("EDEBUG"); if (str) EDebugInit(str); str = getenv("EDEBUG_COREDUMP"); if (str) Mode.wm.coredump = 1; str = getenv("EDEBUG_EXIT"); if (str) Mode.debug_exit = atoi(str); str = getenv("ECONFNAME"); if (str) EConfNameSet(str); str = getenv("ECONFDIR"); if (str) EDirUserSet(str); str = getenv("ECACHEDIR"); if (str) EDirUserCacheSet(str); srand((unsigned int)time(NULL)); if (!uname(&ubuf)) Mode.wm.machine_name = Estrdup(ubuf.nodename); if (!Mode.wm.machine_name) Mode.wm.machine_name = Estrdup("localhost"); /* Now we're going to interpret any of the commandline parameters * that are passed to it -- Well, at least the ones that we * understand. */ Mode.theme.path = NULL; dstr = NULL; for (loop = 1; loop;) { ch = EoptGet(argc, argv); if (ch <= 0) break; #if 0 Eprintf("Opt: %c: %d - %s\n", ch, eoptind, eoptarg); #endif switch (ch) { default: case '?': printf("e16: Ignoring: "); for (i = eoptind; i < argc; i++) printf("%s ", argv[i]); printf("\n"); loop = 0; break; case 'h': EoptHelp(); exit(0); break; case 'd': dstr = eoptarg; break; case 'f': Mode.wm.restart = 1; break; case 'p': EConfNameSet(eoptarg); break; case 'P': EDirUserSet(eoptarg); break; case 'Q': EDirUserCacheSet(eoptarg); break; case 's': Mode.wm.single = 1; Dpy.screen = strtoul(eoptarg, NULL, 10); break; case 'S': SetSMID(eoptarg); break; case 't': Mode.theme.path = Estrdup(eoptarg); break; case 'V': printf("%s %s\n", e_wm_name, e_wm_version); exit(0); break; case 'v': EDebugSet(EDBUG_TYPE_VERBOSE, 1); break; case 'w': sscanf(eoptarg, "%dx%d", &Mode.wm.win_w, &Mode.wm.win_h); Mode.wm.window = 1; Mode.wm.single = 1; Mode.wm.master = 0; break; #ifdef USE_EXT_INIT_WIN case 'X': ExtInitWinSet(strtoul(eoptarg, NULL, 0)); Mode.wm.restart = 1; break; #endif case 'm': Mode.wm.master = 0; Mode.wm.master_screen = strtoul(eoptarg, NULL, 10); break; } } SignalsSetup(); /* Install signal handlers */ EDirsSetup(); ECheckEprog("epp"); ECheckEprog("eesh"); SetupX(dstr); /* This is where the we fork per screen */ /* X is now running, and we have forked per screen */ ESavePrefixSetup(); /* So far nothing should rely on a selected settings or theme. */ ConfigurationLoad(); /* Load settings */ /* Initialise internationalisation */ LangInit(); /* The theme path must now be available for config file loading. */ ThemePathFind(); /* Set the Environment variables */ Esetenv("EVERSION", e_wm_version); Esetenv("EROOT", EDirRoot()); Esetenv("EBIN", EDirBin()); Esetenv("ECONFDIR", EDirUser()); Esetenv("ECACHEDIR", EDirUserCache()); Esetenv("ETHEME", Mode.theme.path); /* Move elsewhere? */ EImageInit(); HintsInit(); CommsInit(); SessionInit(); SnapshotsLoad(); #if USE_DBUS DbusInit(); #endif if (Mode.wm.window) EMapWindow(VROOT); ModulesSignal(ESIGNAL_INIT, NULL); /* Load the theme */ ThemeConfigLoad(); if (Mode.debug_exit) return 0; /* Do initial configuration */ ModulesSignal(ESIGNAL_CONFIGURE, NULL); /* Set root window cursor */ ECsrApply(ECSR_ROOT, WinGetXwin(VROOT)); #ifdef USE_EXT_INIT_WIN /* Kill the E process owning the "init window" */ ExtInitWinKill(); #endif /* let's make sure we set this up and go to our desk anyways */ DeskGoto(DesksGetCurrent()); ESync(ESYNC_MAIN); #ifdef SIGCONT for (i = 0; i < Mode.wm.child_count; i++) kill(Mode.wm.children[i], SIGCONT); #endif ModulesSignal(ESIGNAL_START, NULL); #if ENABLE_DIALOGS DialogsInit(); #endif EwinsManage(); RunInitPrograms(); SnapshotsSpawn(); if (!Mode.wm.restart) StartupWindowsOpen(); Conf.startup.firsttime = 0; Mode.wm.save_ok = Conf.autosave; Mode.wm.startup = 0; autosave(); /* The primary event loop */ EventsMain(); SessionExit(EEXIT_QUIT, NULL); return 0; }
QFEHelpEditorWidget::QFEHelpEditorWidget(QWidget* parent) : QWidget(parent), ui(new Ui::QFEHelpEditorWidget) { modified=false; newScript=true; ui->setupUi(this); ui->edtScript->getEditor()->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); ui->edtScript->getEditor()->setLineWrapMode(QTextEdit::WidgetWidth); connect(ui->edtScript->getEditor()->document(), SIGNAL(contentsChanged()), this, SLOT(documentWasModified())); highlighter=new QFHTMLHighlighter("", ui->edtScript->getEditor()->document()); highlighter->setUseSpecial2("$(", ")$"); highlighter->setUseSpecial1("$$", "$$"); completer = new QCompleter(ui->edtScript->getEditor()); completermodel=modelFromFile(ProgramOptions::getInstance()->getAssetsDirectory()+"/qtscript/completer.txt"); completer->setModel(completermodel); completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel); completer->setCaseSensitivity(Qt::CaseInsensitive); completer->setWrapAround(false); ui->edtScript->getEditor()->setCompleter(completer); recentHelpFiles=new QRecentFilesMenu(this); recentHelpFiles->setUseSystemFileIcons(false); recentHelpFiles->setAlwaysEnabled(true); connect(recentHelpFiles, SIGNAL(openRecentFile(QString)), this, SLOT(openScriptNoAsk(QString))); ui->btnOpen->setMenu(recentHelpFiles); connect(ui->edtScript->getEditor(), SIGNAL(cursorPositionChanged()), this, SLOT(edtScript_cursorPositionChanged())); actLoadAutosave=new QFActionWithNoMenuRole(tr("load last autosaved file ..."), this); connect(actLoadAutosave, SIGNAL(triggered()), this, SLOT(reloadLastAutosave())); cutAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_cut.png"), tr("Cu&t"), this); cutAct->setShortcut(tr("Ctrl+X")); cutAct->setToolTip(tr("Cut the current selection's contents to the " "clipboard")); connect(cutAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(cut())); copyAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_copy.png"), tr("&Copy"), this); copyAct->setShortcut(tr("Ctrl+C")); copyAct->setToolTip(tr("Copy the current selection's contents to the " "clipboard")); connect(copyAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(copy())); pasteAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_paste.png"), tr("&Paste"), this); pasteAct->setShortcut(tr("Ctrl+V")); pasteAct->setToolTip(tr("Paste the clipboard's contents into the current " "selection")); connect(pasteAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(paste())); undoAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_undo.png"), tr("&Undo"), this); undoAct->setShortcut(tr("Ctrl+Z")); undoAct->setToolTip(tr("Undo the last change ")); connect(undoAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(undo())); redoAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_redo.png"), tr("&Redo"), this); redoAct->setShortcut(tr("Ctrl+Shift+Z")); redoAct->setToolTip(tr("Redo the last undone change ")); connect(redoAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(redo())); findAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_find.png"), tr("&Find ..."), this); findAct->setShortcut(tr("Ctrl+F")); findAct->setToolTip(tr("Find a string in sequence ")); connect(findAct, SIGNAL(triggered()), this, SLOT(findFirst())); findNextAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_find_next.png"), tr("Find &next"), this); findNextAct->setShortcut(tr("F3")); findNextAct->setToolTip(tr("Find the next occurence ")); connect(findNextAct, SIGNAL(triggered()), this, SLOT(findNext())); findNextAct->setEnabled(false); replaceAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_find_replace.png"), tr("Find && &replace ..."), this); replaceAct->setShortcut(tr("Ctrl+R")); replaceAct->setToolTip(tr("Find a string in sequence and replace it with another string ")); connect(replaceAct, SIGNAL(triggered()), this, SLOT(replaceFirst())); commentAct = new QFActionWithNoMenuRole(tr("&Comment text"), this); commentAct->setShortcut(tr("Ctrl+B")); commentAct->setToolTip(tr("add (single line) comment at the beginning of each line ")); connect(commentAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(comment())); unCommentAct = new QFActionWithNoMenuRole(tr("&Uncomment text"), this); unCommentAct->setShortcut(tr("Ctrl+Shift+B")); unCommentAct->setToolTip(tr("remove (single line) comment at the beginning of each line ")); connect(unCommentAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(uncomment())); indentAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_indent.png"), tr("&Increase indention"), this); commentAct->setShortcut(tr("Ctrl+I")); indentAct->setToolTip(tr("increase indention ")); connect(indentAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(indentInc())); unindentAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_unindent.png"), tr("&Decrease indention"), this); unindentAct->setShortcut(tr("Ctrl+Shift+I")); unindentAct->setToolTip(tr("decrease indention ")); connect(unindentAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(indentDec())); gotoLineAct = new QFActionWithNoMenuRole(tr("&Goto line ..."), this); gotoLineAct->setShortcut(tr("Alt+G")); gotoLineAct->setToolTip(tr("goto a line in the opened file ")); connect(gotoLineAct, SIGNAL(triggered()), this, SLOT(gotoLine())); printAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_print.png"), tr("&Print ..."), this); printAct->setToolTip(tr("print the current SDFF file ")); connect(printAct, SIGNAL(triggered()), this, SLOT(print())); actInsertIcon = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/insert_image.png"), tr("&Insert icon ..."), this); actInsertIcon->setToolTip(tr("print the current SDFF file ")); connect(actInsertIcon, SIGNAL(triggered()), this, SLOT(insertIcon())); toEntityAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/toentity.png"), tr("&Convert characters to entities ..."), this); toEntityAct->setToolTip(tr("convert characters in the selected text to HTML entities")); connect(toEntityAct, SIGNAL(triggered()), this, SLOT(toEntity())); toCharAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/tochars.png"), tr("&Convert entities to characters ..."), this); toCharAct->setToolTip(tr("convert HTML entities in the selected text to characters")); connect(toCharAct, SIGNAL(triggered()), this, SLOT(toChars())); cutAct->setEnabled(false); copyAct->setEnabled(false); undoAct->setEnabled(false); redoAct->setEnabled(false); connect(ui->edtScript->getEditor(), SIGNAL(copyAvailable(bool)), cutAct, SLOT(setEnabled(bool))); connect(ui->edtScript->getEditor(), SIGNAL(copyAvailable(bool)), copyAct, SLOT(setEnabled(bool))); connect(ui->edtScript->getEditor(), SIGNAL(undoAvailable(bool)), undoAct, SLOT(setEnabled(bool))); connect(ui->edtScript->getEditor(), SIGNAL(redoAvailable(bool)), redoAct, SLOT(setEnabled(bool))); connect(ui->edtScript->getEditor(), SIGNAL(findNextAvailable(bool)), findNextAct, SLOT(setEnabled(bool))); QMenu* menuMore=new QMenu(ui->tbMoreOptions); menuMore->addAction(indentAct); menuMore->addAction(unindentAct); menuMore->addAction(commentAct); menuMore->addAction(unCommentAct); menuMore->addSeparator(); menuMore->addAction(toEntityAct); menuMore->addAction(toCharAct); menuMore->addSeparator(); menuMore->addAction(actInsertIcon); menuMore->addSeparator(); menuMore->addAction(gotoLineAct); menuMore->addAction(findAct); menuMore->addAction(replaceAct); menuMore->addAction(findNextAct); menuMore->addSeparator(); menuMore->addAction(actLoadAutosave); ui->tbMoreOptions->setMenu(menuMore); ui->tbFind->setDefaultAction(findAct); ui->tbFindNext->setDefaultAction(findNextAct); ui->tbReplace->setDefaultAction(replaceAct); ui->tbPrint->setDefaultAction(printAct); ui->tbCopy->setDefaultAction(copyAct); ui->tbCut->setDefaultAction(cutAct); ui->tbPaste->setDefaultAction(pasteAct); ui->tbRedo->setDefaultAction(redoAct); ui->tbUndo->setDefaultAction(undoAct); ui->tbEntity->setDefaultAction(toEntityAct); ui->tbChars->setDefaultAction(toCharAct); setScriptFilename(""); QMenu* menu; menu=new QMenu(tr("directories"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$mainhelpdir$$"); addInsertAction(menu, "$$mainhelppicdir$$"); addInsertAction(menu, "$$assetsdir$$"); addInsertAction(menu, "$$examplesdir$$"); addInsertAction(menu, "$$configdir$$"); addInsertAction(menu, "$$maindir$$"); addInsertAction(menu, "$$sourcedir$$"); menu=new QMenu(tr("version/copyright info"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$version.svnrevision$$"); addInsertAction(menu, "$$version.status$$"); addInsertAction(menu, "$$version.date$$"); addInsertAction(menu, "$$version$$"); addInsertAction(menu, "$$version_full$$"); menu->addSeparator(); addInsertAction(menu, "$$thanksto$$"); addInsertAction(menu, "$$copyright$$"); addInsertAction(menu, "$$author$$"); addInsertAction(menu, "$$weblink$$"); addInsertAction(menu, "$$license$$"); addInsertAction(menu, "$$maillist$$"); addInsertAction(menu, "$$maillistrequest$$"); menu->addSeparator(); addInsertAction(menu, "$$qfcitation$$"); addInsertAction(menu, "$$qfcitation_bibtex$$"); addInsertAction(menu, "$$jankrieger_phdthesis$$"); addInsertAction(menu, "$$jankrieger_phdthesis_ref$$"); menu=new QMenu(tr("general help links"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, tr("Link: RDR general help"), "<a href=\"$qf_ui_rdr_helpfile$$\">$$qf_ui_rdr_helpfiletitle$$</a>" ); addInsertAction(menu, tr("Link: Evaluation general help"), "<a href=\"$$qf_ui_eval_helpfile$$\">$$qf_ui_eval_helpfiletitle$$</a>" ); addInsertAction(menu, tr("Link: Plotter Widget general help"), "<a href=\"$$qf_ui_jkqtplotter_helpfile$$\">$$qf_ui_jkqtplotter_helpfiletitle$$</a>" ); addInsertAction(menu, tr("Link: LaTeX parser general help"), "<a href=\"$$qf_ui_latex_helpfile$$\">$$qf_ui_latex_helpfiletitle$$</a>" ); addInsertAction(menu, tr("Link: Expression parser help"), "<a href=\"$$qf_mathparser_helpfile$$\">$$qf_mathparser_helpfiletitle$$</a>" ); //addInsertAction(menu, tr("Link: help"), "<a href=\"$$aa$$\">$$aa$$</a>" ); //addInsertAction(menu, tr("Link: help"), QString("<a href=\"$$mainhelpdir$$aa\">aa</a>") ); addInsertAction(menu, tr("Link: Custom color palettes help"), QString("<a href=\"$$mainhelpdir$$colorpalettes.html\">custom color paletes</a>") ); addInsertAction(menu, tr("Link: Available color palettes"), QString("<a href=\"$$mainhelpdir$$installedcolorpalettes.html\">available color paletes</a>") ); addInsertAction(menu, tr("Link: Regular Expressions"), QString("<a href=\"$$mainhelpdir$$qf3_qtregexp.html\">regular expressions</a>") ); addInsertAction(menu, tr("Link: Fit Functions"), QString("<a href=\"$$mainhelpdir$$qf3_fitfunc.html\">fit functions</a>") ); addInsertAction(menu, tr("Link: Fit Algorithms"), QString("<a href=\"$$mainhelpdir$$qf3_fitalg.html\">fit algorithms</a>") ); addInsertAction(menu, tr("Link: File Formats"), QString("<a href=\"$$mainhelpdir$$qf3_fileformats.html\">file formats</a>") ); addInsertAction(menu, tr("Link: GPL 3.0"), QString("<a href=\"$$mainhelpdir$$gpl3_0.html\">GPL 3.0</a>") ); addInsertAction(menu, tr("Link: FAQs"), QString("<a href=\"$$qf_faqfile$$\">Frequently asked questions</a>") ); menu->addSeparator(); addInsertAction(menu, "$$qf_ui_rdr_helpfile$$"); addInsertAction(menu, "$$qf_ui_rdr_helpfiletitle$$"); addInsertAction(menu, "$$qf_ui_eval_helpfile$$"); addInsertAction(menu, "$$qf_ui_eval_helpfiletitle$$"); addInsertAction(menu, "$$qf_ui_jkqtplotter_helpfile$$"); addInsertAction(menu, "$$qf_ui_jkqtplotter_helpfiletitle$$"); addInsertAction(menu, "$$qf_ui_latex_helpfile$$"); addInsertAction(menu, "$$qf_ui_latex_helpfiletitle$$"); addInsertAction(menu, "$$qf_mathparser_helpfile$$"); addInsertAction(menu, "$$qf_mathparser_helpfiletitle$$"); addInsertAction(menu, "$$qf_faqfile$$"); menu=new QMenu(tr("page header/footer"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$qf_commondoc_backtop$$"); menu->addSeparator(); addInsertAction(menu, "$$qf_commondoc_footer.start$$"); addInsertAction(menu, "$$qf_commondoc_footer.end$$"); menu->addSeparator(); addInsertAction(menu, "$$qf_commondoc_header.start$$"); addInsertAction(menu, "$$qf_commondoc_header.end$$"); addInsertAction(menu, "$$qf_commondoc_header.end_notitle$$"); addInsertAction(menu, "$$qf_commondoc_header.rdr$$"); addInsertAction(menu, "$$qf_commondoc_header.eval$$"); addInsertAction(menu, "$$qf_commondoc_header.extension$$"); addInsertAction(menu, "$$qf_commondoc_header.fitfunc$$"); addInsertAction(menu, "$$qf_commondoc_header.fitalg$$"); addInsertAction(menu, "$$qf_commondoc_header.separator$$"); menu=new QMenu(tr("plugin info"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$local_plugin_icon$$"); addInsertAction(menu, "$$local_plugin_iconfilename$$"); addInsertAction(menu, "$$local_plugin_name$$"); addInsertAction(menu, "$$local_plugin_author$$"); addInsertAction(menu, "$$local_plugin_copyright$$"); addInsertAction(menu, "$$local_plugin_weblink_url$$"); addInsertAction(menu, "$$local_plugin_weblink$$"); addInsertAction(menu, "$$local_plugin_id$$"); addInsertAction(menu, "$$local_plugin_subid$$"); addInsertAction(menu, "$$local_plugin_subname$$"); addInsertAction(menu, "$$local_plugin_subshortname$$"); addInsertAction(menu, "$$local_plugin_tutorial_file$$"); addInsertAction(menu, "$$local_plugin_tutorial_link$$"); addInsertAction(menu, "$$local_plugin_mainhelp_file$$"); addInsertAction(menu, "$$local_plugin_mainhelp_link$$"); addInsertAction(menu, "$$local_plugin_version$$"); addInsertAction(menu, "$$local_plugin_typehelp_link$$"); addInsertAction(menu, "$$local_plugin_typehelp_file$$"); addInsertAction(menu, "$$local_plugin_assets$$"); addInsertAction(menu, "$$local_plugin_examples$$"); addInsertAction(menu, "$$local_plugin_help$$"); addInsertAction(menu, "$$local_plugin_config$$"); addInsertAction(menu, "$$local_plugin_tutorials$$"); menu->addSeparator(); addInsertAction(menu, "$$plugin_info:help:PLUGINID$$"); addInsertAction(menu, "$$plugin_info:tutorial:PLUGINID$$"); addInsertAction(menu, "$$plugin_info:helpdir:PLUGINID$$"); addInsertAction(menu, "$$plugin_info:assetsdir:PLUGINID$$"); addInsertAction(menu, "$$plugin_info:examplesdir:PLUGINID$$"); addInsertAction(menu, "$$plugin_info:configdir:PLUGINID$$"); menu->addSeparator(); addInsertAction(menu, "$$fitfunction:help:PLUGINID$$"); addInsertAction(menu, "$$fitfunction:name:PLUGINID$$"); addInsertAction(menu, "$$fitfunction:short_name:PLUGINID$$"); menu->addSeparator(); addInsertAction(menu, "$$fitalgorithm:help:PLUGINID$$"); addInsertAction(menu, "$$fitalgorithm:name:PLUGINID$$"); addInsertAction(menu, "$$fitalgorithm:short_name:PLUGINID$$"); menu->addSeparator(); addInsertAction(menu, "$$importer:help:PLUGINID$$"); addInsertAction(menu, "$$importer:name:PLUGINID$$"); addInsertAction(menu, "$$exporter:help:PLUGINID$$"); addInsertAction(menu, "$$exporter:name:PLUGINID$$"); menu=new QMenu(tr("plugin lists"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$list:extension:INTERFACENAME$$"); addInsertAction(menu, "$$list:fitfunc:$$"); addInsertAction(menu, "$$list:fitfunc:STARTSWITH$$"); addInsertAction(menu, "$$list:fitfunc_inplugin:PLUGIN_ID|STARTSWITH$$"); addInsertAction(menu, "$$list:fitfunc_inplugin:PLUGIN_ID$$"); addInsertAction(menu, "$$list:fitalg:$$"); addInsertAction(menu, "$$list:fitalg:STARTSWITH$$"); addInsertAction(menu, "$$list:importers:STARTSWITH$$"); addInsertAction(menu, "$$list:exporters:STARTSWITH$$"); addInsertAction(menu, "$$list:plugin_tutorials:PLUGIN_ID$$"); menu=new QMenu(tr("help lists"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$tutorials_contents$$"); addInsertAction(menu, "$$help_contents$$"); addInsertAction(menu, "$$settings_contents$$"); menu=new QMenu(tr("insert files"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$insert:FILENAME$$"); addInsertAction(menu, "$$insertglobal:FILENAME$$"); menu=new QMenu(tr("insert Equations (LaTeX)"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$math:LATEX$$"); addInsertAction(menu, "$(LATEX)$"); addInsertAction(menu, "$$bmath:LATEX$$"); addInsertAction(menu, "$[LATEX]$"); menu=new QMenu(tr("insert Literature References"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$ref:<ID>:Text$$"); addInsertAction(menu, "$$ref:<ID>:$$"); addInsertAction(menu, "$$invisibleref:<ID>:Text$$"); addInsertAction(menu, "$$references$$"); menu=new QMenu(tr("insert Figures"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$fig:FILENAME:CAPTION$$"); menu=new QMenu(tr("insert Info boxes"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$see:Text$$"); addInsertAction(menu, "$$note:Text$$"); addInsertAction(menu, "$$info:Text$$"); addInsertAction(menu, "$$warning:Text$$"); addInsertAction(menu, "$$example:Text$$"); addInsertAction(menu, "$$codeexample:Text$$"); addInsertAction(menu, "$$bqtt:Text$$"); addInsertAction(menu, "$$bqcode:Text$$"); menu->addSeparator(); addInsertAction(menu, "$$startbox$$"); addInsertAction(menu, "$$startbox_info$$"); addInsertAction(menu, "$$startbox_note$$"); addInsertAction(menu, "$$startbox_see$$"); addInsertAction(menu, "$$startbox_warning$$"); addInsertAction(menu, "$$startbox_example$$"); addInsertAction(menu, "$$startbox:backgroundcolor:bordercolor$$"); addInsertAction(menu, "$$startbox:lightgrey:midnightblue$$"); addInsertAction(menu, "$$endbox$$"); menu=new QMenu(tr("insert Tooltips"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$tooltip:PHRASE$$"); menu=new QMenu(tr("FAQs"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, tr("FAQ entry"), "$$faq_start$$\n <a name=\"FAQ1\"><b>Question?</b>\n$$faq_answer$$\n Answer ...\n$$faq_end$$"); menu->addSeparator(); addInsertAction(menu, "$$faq_start"); addInsertAction(menu, "$$faq_answer"); addInsertAction(menu, "$$faq_end"); menu=new QMenu(tr("Function References"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, tr("Function reference entry"), "$$funcref_start$$<a name=\"NAME\"/><!-- func:NAME -->\n <b><tt><!-- template -->NAME<!-- /template --></tt> - <i> DESCRIPTION </i>:</b>\n$$funcref_description$$\n DESCRIPTION\n <!-- /func:NAME -->\n$$funcref_end$$"); menu->addSeparator(); addInsertAction(menu, "$$funcref_start"); addInsertAction(menu, "$$funcref_description"); addInsertAction(menu, "$$funcref_end"); menu=new QMenu(tr("insert other markups"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$tt:Text$$"); menu=new QMenu(tr("LaTeX"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "\\left(%1#\\right)"); addInsertAction(menu, "\\left[%1#\\right]"); addInsertAction(menu, "\\left\\{%1#\\right\\}"); addInsertAction(menu, "\\left\\langle%1#\\right\\rangle"); menu->addSeparator(); addInsertAction(menu, "\\sqrt{%1#}"); menu->addSeparator(); addInsertAction(menu, "\\sum_{#}^{}%1"); addInsertAction(menu, "\\prod_{#}^{}%1"); addInsertAction(menu, "\\int_{#}^{}%1\\;\\mathrm{d}x"); addInsertAction(menu, "\\iint_{#}^{}%1\\;\\mathrm{d}^2x"); addInsertAction(menu, "\\iiint_{#}^{}%1\\;\\mathrm{d}^3x"); addInsertAction(menu, "\\oint_{#}^{}%1\\;\\mathrm{d}x"); addInsertAction(menu, "\\lim_{%1#}"); addInsertAction(menu, "\\argmin_{%1#}"); addInsertAction(menu, "\\argmax_{%1#}"); menu->addSeparator(); addInsertAction(menu, "\\vec{%1#}"); addInsertAction(menu, "\\hat{%1#}"); addInsertAction(menu, "\\tilde{%1#}"); addInsertAction(menu, "\\mathbf{%1#}"); addInsertAction(menu, "\\mathrm{%1#}"); addInsertAction(menu, "\\mathit{%1#}"); addInsertAction(menu, "\\mathsf{%1#}"); addInsertAction(menu, "\\mathbb{%1#}"); addInsertAction(menu, "\\mathscript{%1#}"); addInsertAction(menu, "\\underline{%1#}"); //addInsertAction(menu, "$$$$"); menu=new QMenu(tr("Special Characters"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$" "$"); addInsertAction(menu, "$$" "$$"); QTimer::singleShot(AUTOSAVE_INTERVAL_MSEC, this, SLOT(autosave())); }
/** * @param argc: Number of command line arguments supplied. * @param argv: Char* array containing the command line arguments supplied. * @return: To the system, normally 0. * @brief: The first function once enotes is called. */ int main(int argc, char *argv[]) { int note_count; /* IPC Check */ ecore_ipc_init(); dml("IPC Initiated Successfully", 1); /* loading will increment this if there are notes if not we may need to * create a blank one */ note_count = 0; if ((ecore_config_init("enotes")) == ECORE_CONFIG_ERR_FAIL) { ecore_ipc_shutdown(); return (-1); } ecore_app_args_set(argc, (const char **) argv); ecore_config_app_describe("E-Notes - Sticky Notes for Enlightenment\n\ Copyright (c) Thomas Fletcher\n\ Usage: enotes [options]"); /* Read the Usage and Configurations */ main_config = mainconfig_new(); if (read_configuration(main_config) != ECORE_CONFIG_PARSE_CONTINUE) { ecore_config_shutdown(); ecore_ipc_shutdown(); ecore_shutdown(); mainconfig_free(main_config); return (-1); } dml("Successfully Read Configurations and Usage", 1); process_note_storage_locations(); if (find_server() != 0) { if (remotecmd != NULL) send_to_server(remotecmd); else send_to_server("DEFNOTE"); } else { dml("Server wasn't found.. Creating one", 1); /* Setup Server */ setup_server(); /* Initialise the E-Libs */ ecore_init(); ecore_x_init(NULL); ecore_app_args_set(argc, (const char **) argv); if (!ecore_evas_init()) { mainconfig_free(main_config); return -1; } ewl_init(&argc, argv); edje_init(); dml("Efl Successfully Initiated", 1); autoload(); /* create autosave timer */ update_autosave(); if (remotecmd != NULL) handle_ipc_message(remotecmd); /* Begin the Control Centre */ if (main_config->controlcentre == 1) { setup_cc(); dml("Control Centre Setup", 1); } else { dml("No Control Centre - Displaying Notice", 1); if (get_note_count() == 0) new_note(); } if (main_config->welcome == 1) { open_welcome(); } /* Begin the main loop */ dml("Starting Main Loop", 1); ecore_main_loop_begin(); dml("Main Loop Ended", 1); /* Save Controlcentre Settings */ set_cc_pos(); autosave(); if (autosave_timer) ecore_timer_del(autosave_timer); /* Save and Free the Configuration */ ecore_config_save(); dml("Configuration Saved", 1); mainconfig_free(main_config); dml("Configuration Structure Free'd", 1); /* Shutdown the E-Libs */ edje_shutdown(); ecore_evas_shutdown(); ecore_x_shutdown(); ecore_shutdown(); dml("Efl Shutdown", 1); } /* End IPC */ ecore_ipc_shutdown(); dml("IPC Shutdown", 1); dml("Leaving.", 1); return (0); }
TApp::TApp() : m_currentScene(0) , m_currentXsheet(0) , m_currentFrame(0) , m_currentColumn(0) , m_currentLevel(0) , m_currentTool(0) , m_currentObject(0) , m_currentSelection(0) , m_currentOnionSkinMask(0) , m_currentFx(0) , m_mainWindow(0) , m_autosaveTimer(0) , m_autosaveSuspended(false) , m_isStarting(false) , m_isPenCloseToTablet(false) { m_currentScene = new TSceneHandle(); m_currentXsheet = new TXsheetHandle(); m_currentFrame = new TFrameHandle(); m_currentColumn = new TColumnHandle(); m_currentLevel = new TXshLevelHandle(); m_currentTool = new ToolHandle(); m_currentObject = new TObjectHandle(); m_currentOnionSkinMask = new TOnionSkinMaskHandle(); m_currentFx = new TFxHandle(); m_currentSelection = TSelectionHandle::getCurrent(); m_paletteController = new PaletteController(); bool ret = true; ret = ret && QObject::connect(m_currentXsheet, SIGNAL(xsheetChanged()), this, SLOT(onXsheetChanged())); ret = ret && QObject::connect(m_currentXsheet, SIGNAL(xsheetSoundChanged()), this, SLOT(onXsheetSoundChanged())); ret = ret && QObject::connect(m_currentScene, SIGNAL(sceneSwitched()), this, SLOT(onSceneSwitched())); ret = ret && QObject::connect(m_currentScene, SIGNAL(sceneChanged()), this, SLOT(onSceneChanged())); ret = ret && QObject::connect(m_currentXsheet, SIGNAL(xsheetSwitched()), this, SLOT(onXsheetSwitched())); ret = ret && QObject::connect(m_currentFrame, SIGNAL(frameSwitched()), this, SLOT(onFrameSwitched())); ret = ret && QObject::connect(m_currentFrame, SIGNAL(frameSwitched()), this, SLOT(onImageChanged())); ret = ret && QObject::connect(m_currentFx, SIGNAL(fxSwitched()), this, SLOT(onFxSwitched())); ret = ret && QObject::connect(m_currentColumn, SIGNAL(columnIndexSwitched()), this, SLOT(onColumnIndexSwitched())); ret = ret && QObject::connect(m_currentColumn, SIGNAL(columnIndexSwitched()), this, SLOT(onImageChanged())); ret = ret && QObject::connect(m_currentLevel, SIGNAL(xshLevelSwitched(TXshLevel *)), this, SLOT(onImageChanged())); ret = ret && QObject::connect(m_currentLevel, SIGNAL(xshLevelSwitched(TXshLevel *)), this, SLOT(onXshLevelSwitched(TXshLevel *))); ret = ret && QObject::connect(m_currentLevel, SIGNAL(xshLevelChanged()), this, SLOT(onXshLevelChanged())); ret = ret && QObject::connect(m_currentObject, SIGNAL(objectSwitched()), this, SLOT(onObjectSwitched())); ret = ret && QObject::connect(m_currentObject, SIGNAL(splineChanged()), this, SLOT(onSplineChanged())); ret = ret && QObject::connect(m_paletteController->getCurrentLevelPalette(), SIGNAL(paletteChanged()), this, SLOT(onPaletteChanged())); ret = ret && QObject::connect(m_paletteController->getCurrentLevelPalette(), SIGNAL(colorStyleSwitched()), this, SLOT(onLevelColorStyleSwitched())); ret = ret && QObject::connect(m_paletteController->getCurrentLevelPalette(), SIGNAL(colorStyleChangedOnMouseRelease()), this, SLOT(onLevelColorStyleChanged())); ret = ret && QObject::connect(m_paletteController->getCurrentCleanupPalette(), SIGNAL(paletteChanged()), m_currentScene, SIGNAL(sceneChanged())); TMeasureManager::instance()->addCameraMeasures(getCurrentCameraSize); m_autosaveTimer = new QTimer(this); ret = ret && connect(m_autosaveTimer, SIGNAL(timeout()), this, SLOT(autosave())); Preferences *preferences = Preferences::instance(); if (preferences->isRasterOptimizedMemory()) { if (!TBigMemoryManager::instance()->init( (int)(/*15*1024*/ TSystem::getFreeMemorySize(true) * .8))) DVGui::warning(tr("Error allocating memory: not enough memory.")); } ret = ret && connect(preferences, SIGNAL(stopAutoSave()), SLOT(onStopAutoSave())); ret = ret && connect(preferences, SIGNAL(startAutoSave()), SLOT(onStartAutoSave())); ret = ret && connect(m_currentTool, SIGNAL(toolEditingFinished()), SLOT(onToolEditingFinished())); if (preferences->isAutosaveEnabled()) m_autosaveTimer->start(preferences->getAutosavePeriod() * 1000 * 60); UnitParameters::setCurrentDpiGetter(getCurrentDpi); assert(ret); }
void TApp::onToolEditingFinished() { if (!Preferences::instance()->isAutosaveEnabled() || !m_autosaveSuspended) return; autosave(); }