ImageDialog::ImageDialog(QWidget *parent) : QDialog(parent) { setupUi(this); connect(bt_save,SIGNAL(clicked()),SLOT(onSaveAs())); }
void BaseEditor::actionSaveAs() { auto uiFramework = pImpl_->get<IUIFramework>(); TF_ASSERT(uiFramework != nullptr); if (!uiFramework) { return; } auto path = uiFramework->showSaveAsFileDialog("Save As", lastSaveFolder(), fileSaveFilter(), IUIFramework::None); if (!path.empty()) { clearCheckoutState(); setLastSaveFolder(FilePath::getFolder(path)); if(onSaveAs(path.c_str())) { auto editor = pImpl_->get<IEditor>(); TF_ASSERT(editor != nullptr); if (editor) { editor->saveAs(path.c_str()); } auto assetManager = pImpl_->get<IAssetManager>(); if (assetManager) { auto assetModel = assetManager->assetModel(); if (assetModel) { assetModel->revert(); } } } } }
static void onSave() { if (!s_loadedFilename) onSaveAs(); else LoadSave_saveRocketXML(getMostRecentFile(), getTrackData()); setWindowTitle(getMostRecentFile(), false); s_undoLevel = Commands_undoCount(); }
bool Editor_saveBeforeExit() { if (s_loadedFilename) { onSave(); return true; } return onSaveAs(); }
void App::onSave() { if (filename.isEmpty()) return onSaveAs(); QFile file(filename); file.open(QIODevice::WriteOnly); file.write(QJsonDocument( SceneSerializer::run( root, graph_scene->inspectorPositions())).toJson()); stack->setClean(); }
bool EditorWindow::SaveChanges() { if (PM->isModified()) { FXuint retval = FXMessageBox::question(this, MBOX_YES_NO_CANCEL, "Editor", "Il tuo progetto e' stato modificato.\nVuoi salvare prima che sia troppo tardi?"); if (retval == MBOX_CLICKED_YES) { if (!onSaveAs(NULL, 0, NULL)) return false; } else if (retval == MBOX_CLICKED_CANCEL) return false; } return true; }
void MainWindow::init() { ui->listWidget->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); ui->listWidget->setResizeMode(QListWidget::Adjust); ui->refreshButton->setIconSize(QSize(16,16)); ui->refreshButton->setIcon(QIcon::fromTheme("view-refresh")); ui->formatButton->setIconSize(QSize(16,16)); ui->formatButton->setIcon(QIcon::fromTheme("format-text-direction-ltr")); QFont font; font.setFamily("Andale"); font.setFixedPitch(true); font.setPixelSize(12); font.setWeight(1); ui->contentEdit->setFont(font); ui->scrollArea->setWidgetResizable(true); ui->scrollArea->setPalette(QPalette(Qt::white)); // connect onTreeItemClicked connect(ui->treeWidget,SIGNAL(itemClicked(QTreeWidgetItem*,int)), this,SLOT(onTreeItemClicked(QTreeWidgetItem*,int))); // connect onTreeContextMenuRequested connect(ui->treeWidget,SIGNAL(customContextMenuRequested(QPoint)), this,SLOT(onTreeContextMenuRequested(QPoint))); // connect onContentEditChanged connect(ui->contentEdit,SIGNAL(textChanged()),this,SLOT(onContentEditChanged())); // connect onNameEditChanged connect(ui->nameEdit,SIGNAL(textChanged(QString)),this,SLOT(onNameEditChanged(QString))); // connect file menu actions connect(ui->actionOpen,SIGNAL(triggered()),this,SLOT(onOpen())); connect(ui->actionSave,SIGNAL(triggered()),this,SLOT(onSave())); connect(ui->actionSave_As,SIGNAL(triggered()),this,SLOT(onSaveAs())); }
int onSave() { restore_mouse(); if(disable_saving) { jwin_alert("ZQuest","Saving is","disabled in this version.",NULL,"O&K",NULL,'k',0,lfont); return D_O_K; } if(!first_save) return onSaveAs(); else if(OverwriteProtection) { jwin_alert("ZQuest","Overwriting quests is disabled.","Change this in the options dialog.",NULL,"O&K",NULL,'k',0,lfont); return D_O_K; } int ret = save_quest(filepath, false); char buf[80],name[13]; extract_name(filepath,name,FILENAME8_3); if(!ret) { sprintf(buf,"Saved %s",name); jwin_alert("ZQuest",buf,NULL,NULL,"O&K",NULL,'k',0,lfont); saved=true; first_save=true; header.dirty_password=false; } else { sprintf(buf,"Error saving %s",name); jwin_alert("Error",buf,NULL,NULL,"O&K",NULL,'k',0,lfont); } last_timed_save[0]=0; return D_O_K; }
void MainWindow::onSave() { if(m_fileName.isNull()) { onSaveAs(); return; } QFile file(m_fileName); qDebug() << "Opening:" << m_fileName; if(!file.open(QIODevice::WriteOnly)) return; qDebug() << "Creating data stream..."; QDataStream out(&file); qDebug() << "Writing data..." << ui->treeWidget->topLevelItemCount(); QList<Score> list; for(int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) list.append(*(Score*)ui->treeWidget->topLevelItem(i)); out << list; qDebug() << "Done."; }
/** Constructor @param parent */ QtSpacescapeMainWindow::QtSpacescapeMainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::QtSpacescapeUI), mFilename(""), mLastExportDir(""), mLastOpenDir(""), mLastSaveDir(""), mRefreshing(false) { // setup the ui ui->setupUi(this); // set the property manager to a variant type (changable/editable - not read only) mPropertyManager = new QtVariantPropertyManager(); QtVariantEditorFactory *variantFactory = new QtVariantEditorFactory(); ui->layerProperties->setFactoryForManager(mPropertyManager, variantFactory); ui->layerProperties->setPropertiesWithoutValueMarked(true); // we want the little arrows on root properties to indicate they're expandable ui->layerProperties->setRootIsDecorated(true); // set us as a progress listener ui->ogreWindow->setProgressListener(this); // add a signal for when properties are changed connect(mPropertyManager, SIGNAL(valueChanged(QtProperty *, const QVariant &)), this, SLOT(valueChanged(QtProperty *, const QVariant &))); // add a signal to detect when layer items change so we can update status bar // with a tip connect(ui->layerProperties, SIGNAL(currentItemChanged(QtBrowserItem*)), this,SLOT(currentItemChanged(QtBrowserItem*))); // add a signal for when the open menu item is selected connect(ui->action_Open, SIGNAL(triggered()), this, SLOT(onOpen())); // add a signal for when the save menu item is selected connect(ui->action_Save, SIGNAL(triggered()), this, SLOT(onSave())); // add a signal for when the save menu item is selected connect(ui->actionSave_as, SIGNAL(triggered()), this, SLOT(onSaveAs())); // add a signal for when the about menu item is selected connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(onAbout())); mPropertyTitles["destBlendFactor"] = QString("Dest Blend Factor"); mPropertyTitles["ditherAmount"] = QString("Dither Amount"); mPropertyTitles["farColor"] = QString("Far Color"); mPropertyTitles["gain"] = QString("Gain"); mPropertyTitles["innerColor"] = QString("Inner Color"); mPropertyTitles["lacunarity"] = QString("Lacunarity"); mPropertyTitles["maskEnabled"] = QString("Mask Enabled"); mPropertyTitles["maskGain"] = QString("Mask Gain"); mPropertyTitles["maskInnerColor"] = QString("Mask Inner Color"); mPropertyTitles["maskLacunarity"] = QString("Mask Lacunarity"); mPropertyTitles["maskNoiseType"] = QString("Mask Noise Type"); mPropertyTitles["maskOffset"] = QString("Mask Offset"); mPropertyTitles["maskOctaves"] = QString("Mask Octaves"); mPropertyTitles["maskOuterColor"] = QString("Mask Outer Color"); mPropertyTitles["maskPower"] = QString("Mask Power"); mPropertyTitles["maskScale"] = QString("Mask Noise Scale"); mPropertyTitles["maskSeed"] = QString("Mask Random Seed"); mPropertyTitles["maskThreshold"] = QString("Mask Threshold"); mPropertyTitles["maxSize"] = QString("Max Billboard Size"); mPropertyTitles["minSize"] = QString("Min Billboard Size"); mPropertyTitles["name"] = QString("Layer Name"); mPropertyTitles["nearColor"] = QString("Near Color"); mPropertyTitles["noiseType"] = QString("Noise Type"); mPropertyTitles["numBillboards"] = QString("Number of Billboards"); mPropertyTitles["numPoints"] = QString("Number of Points"); mPropertyTitles["octaves"] = QString("Octaves"); mPropertyTitles["offset"] = QString("Noise Offset"); mPropertyTitles["outerColor"] = QString("Outer Color"); mPropertyTitles["pointSize"] = QString("Point Size"); mPropertyTitles["powerAmount"] = QString("Power"); mPropertyTitles["previewTextureSize"] = QString("Preview Texture Size"); mPropertyTitles["texture"] = QString("Billboard Texture"); mPropertyTitles["type"] = QString("Layer Type"); mPropertyTitles["scale"] = QString("Noise Scale"); mPropertyTitles["seed"] = QString("Random Seed"); mPropertyTitles["shelfAmount"] = QString("Threshold"); mPropertyTitles["sourceBlendFactor"] = QString("Source Blend Factor"); mPropertyTitles["visible"] = QString("Layer Visible"); }
void Editor_menuEvent(int menuItem) { int highlightRowStep = getTrackData()->highlightRowStep; switch (menuItem) { case EDITOR_MENU_ENTER_CURRENT_V : case EDITOR_MENU_ROWS_UP : case EDITOR_MENU_ROWS_DOWN : case EDITOR_MENU_PREV_BOOKMARK : case EDITOR_MENU_NEXT_BOOKMARK : case EDITOR_MENU_PREV_KEY : case EDITOR_MENU_NEXT_KEY : case EDITOR_MENU_PLAY : { endEditing(); } } cancelEditing(); // If some internal control has focus we let it do its thing if (Emgui_hasKeyboardFocus()) { Editor_update(); return; } switch (menuItem) { // File case EDITOR_MENU_OPEN: onOpen(); break; case EDITOR_MENU_SAVE: onSave(); break; case EDITOR_MENU_SAVE_AS: onSaveAs(); break; case EDITOR_MENU_REMOTE_EXPORT : RemoteConnection_sendSaveCommand(); break; case EDITOR_MENU_RECENT_FILE_0: case EDITOR_MENU_RECENT_FILE_1: case EDITOR_MENU_RECENT_FILE_2: case EDITOR_MENU_RECENT_FILE_3: { Editor_loadRecentFile(menuItem - EDITOR_MENU_RECENT_FILE_0); break; } // Edit case EDITOR_MENU_UNDO : onUndo(); break; case EDITOR_MENU_REDO : onRedo(); break; case EDITOR_MENU_CANCEL_EDIT : onCancelEdit(); break; case EDITOR_MENU_DELETE_KEY : onDeleteKey(); break; case EDITOR_MENU_CUT : onCutAndCopy(true); break; case EDITOR_MENU_COPY : onCutAndCopy(false); break; case EDITOR_MENU_PASTE : onPaste(); break; case EDITOR_MENU_SELECT_TRACK : onSelectTrack(); break; case EDITOR_MENU_BIAS_P_001 : biasSelection(0.01f); break; case EDITOR_MENU_BIAS_P_01 : biasSelection(0.1f); break; case EDITOR_MENU_BIAS_P_1: biasSelection(1.0f); break; case EDITOR_MENU_BIAS_P_10: biasSelection(10.0f); break; case EDITOR_MENU_BIAS_P_100: biasSelection(100.0f); break; case EDITOR_MENU_BIAS_P_1000: biasSelection(1000.0f); break; case EDITOR_MENU_BIAS_N_001: biasSelection(-0.01f); break; case EDITOR_MENU_BIAS_N_01: biasSelection(-0.1f); break; case EDITOR_MENU_BIAS_N_1: biasSelection(-1.0f); break; case EDITOR_MENU_BIAS_N_10: biasSelection(-10.0f); break; case EDITOR_MENU_BIAS_N_100 : biasSelection(-100.0f); break; case EDITOR_MENU_BIAS_N_1000: biasSelection(-1000.0f); break; case EDITOR_MENU_INTERPOLATION : onInterpolation(); break; case EDITOR_MENU_ENTER_CURRENT_V : onEnterCurrentValue(); break; // View case EDITOR_MENU_PLAY : onPlay(); break; case EDITOR_MENU_ROWS_UP : onRowStep(-highlightRowStep , NO_SELECTION); break; case EDITOR_MENU_ROWS_DOWN : onRowStep(highlightRowStep , NO_SELECTION); break; case EDITOR_MENU_ROWS_2X_UP : onRowStep(-highlightRowStep * 2 , NO_SELECTION); break; case EDITOR_MENU_ROWS_2X_DOWN : onRowStep(highlightRowStep * 2 , NO_SELECTION); break; case EDITOR_MENU_PREV_BOOKMARK : onBookmarkDir(ARROW_UP, NO_SELECTION); break; case EDITOR_MENU_NEXT_BOOKMARK : onBookmarkDir(ARROW_DOWN, NO_SELECTION); break; case EDITOR_MENU_FIRST_TRACK : onTrackSide(ARROW_LEFT, true, NO_SELECTION); break; case EDITOR_MENU_LAST_TRACK : onTrackSide(ARROW_RIGHT, true, NO_SELECTION); break; case EDITOR_MENU_PREV_KEY : onPrevNextKey(true, NO_SELECTION); break; case EDITOR_MENU_NEXT_KEY : onPrevNextKey(false, NO_SELECTION); break; case EDITOR_MENU_FOLD_TRACK : onFoldTrack(true); break; case EDITOR_MENU_UNFOLD_TRACK : onFoldTrack(false); break; case EDITOR_MENU_FOLD_GROUP : onFoldGroup(true); break; case EDITOR_MENU_UNFOLD_GROUP : onFoldGroup(false); break; case EDITOR_MENU_TOGGLE_BOOKMARK : onToggleBookmark(); break; case EDITOR_MENU_CLEAR_BOOKMARKS : onClearBookmarks(); break; case EDITOR_MENU_TAB : onTab(); break; } Editor_update(); }
/** MainWindow represents, not surprisingly, the main window of the application. It handles all the menu items and the UI. */ MainWindow::MainWindow( ) : QMainWindow( 0 ) { setupUi(this); // add the file dropdown to the toolbar...can't do this in Designer for some reason QWidget *stretch = new QWidget(toolBar); stretch->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); toolBar->addWidget(stretch); currentFileDropDown = new QComboBox(toolBar); currentFileDropDown->setSizeAdjustPolicy(QComboBox::AdjustToContents); toolBar->addWidget(currentFileDropDown); QWidget *pad = new QWidget(toolBar); // this doesn't pad as much as it should...to be fixed... toolBar->addWidget(pad); //initialization buildLog = new BuildLog(); highlighter = new Highlighter( editor->document() ); prefs = new Preferences(this); projInfo = new ProjectInfo(this); uploader = new Uploader(this); builder = new Builder(this, projInfo, buildLog); usbConsole = new UsbConsole(); findReplace = new FindReplace(this); about = new About(); updater = new AppUpdater(); // load boardTypeGroup = new QActionGroup(menuBoard_Type); loadBoardProfiles( ); loadExamples( ); loadLibraries( ); loadRecentProjects( ); readSettings( ); // misc. signals connect(editor, SIGNAL(cursorPositionChanged()), this, SLOT(onCursorMoved())); connect(actionPreferences, SIGNAL(triggered()), prefs, SLOT(loadAndShow())); connect(actionUsb_Monitor, SIGNAL(triggered()), usbConsole, SLOT(loadAndShow())); connect(currentFileDropDown, SIGNAL(currentIndexChanged(int)), this, SLOT(onFileSelection(int))); connect(editor->document(), SIGNAL(contentsChanged()),this, SLOT(onDocumentModified())); connect(outputConsole, SIGNAL(itemDoubleClicked(QListWidgetItem*)),this, SLOT(onConsoleDoubleClick(QListWidgetItem*))); connect(projInfo, SIGNAL(projectInfoUpdated()), builder, SLOT(onProjectUpdated())); // menu actions connect(actionNew, SIGNAL(triggered()), this, SLOT(onNewFile())); connect(actionAdd_Existing_File, SIGNAL(triggered()), this, SLOT(onAddExistingFile())); connect(actionNew_Project, SIGNAL(triggered()), this, SLOT(onNewProject())); connect(actionOpen, SIGNAL(triggered()), this, SLOT(onOpen())); connect(actionSave, SIGNAL(triggered()), this, SLOT(onSave())); connect(actionSave_As, SIGNAL(triggered()), this, SLOT(onSaveAs())); connect(actionBuild, SIGNAL(triggered()), this, SLOT(onBuild())); connect(actionStop, SIGNAL(triggered()), this, SLOT(onStop())); connect(actionClean, SIGNAL(triggered()), this, SLOT(onClean())); connect(actionProperties, SIGNAL(triggered()), this, SLOT(onProperties())); connect(actionUpload, SIGNAL(triggered()), this, SLOT(onUpload())); connect(actionUndo, SIGNAL(triggered()), editor, SLOT(undo())); connect(actionRedo, SIGNAL(triggered()), editor, SLOT(redo())); connect(actionCut, SIGNAL(triggered()), editor, SLOT(cut())); connect(actionCopy, SIGNAL(triggered()), editor, SLOT(copy())); connect(actionPaste, SIGNAL(triggered()), editor, SLOT(paste())); connect(actionSelect_All, SIGNAL(triggered()), editor, SLOT(selectAll())); connect(actionFind, SIGNAL(triggered()), findReplace, SLOT(show())); connect(actionAbout, SIGNAL(triggered()), about, SLOT(show())); connect(actionUpdate, SIGNAL(triggered()), this, SLOT(onUpdate())); connect(actionBuildLog, SIGNAL(triggered()), buildLog, SLOT(show())); connect(actionVisitForum, SIGNAL(triggered()), this, SLOT(onVisitForum())); connect(actionClear_Output_Console, SIGNAL(triggered()), outputConsole, SLOT(clear())); connect(actionUpload_File_to_Board, SIGNAL(triggered()), this, SLOT(onUploadFile())); connect(actionMake_Controller_Reference, SIGNAL(triggered()), this, SLOT(openMCReference())); connect(actionMcbuilder_User_Manual, SIGNAL(triggered()), this, SLOT(openManual())); connect(menuExamples, SIGNAL(triggered(QAction*)), this, SLOT(onExample(QAction*))); connect(menuLibraries, SIGNAL(triggered(QAction*)), this, SLOT(onLibrary(QAction*))); connect(actionSave_Project_As, SIGNAL(triggered()), this, SLOT(onSaveProjectAs())); connect(menuRecent_Projects, SIGNAL(triggered(QAction*)), this, SLOT(openRecentProject(QAction*))); }