Example #1
0
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: about(); break;
        case 1: newFile(); break;
        case 2: openFile((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 3: openFile(); break;
        case 4: saveFile(); break;
        case 5: saveFileAs((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 6: saveFileAs(); break;
        case 7: runFile(); break;
        case 8: inspect(); break;
        case 9: append((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2]))); break;
        case 10: onEngineStarted(); break;
        case 11: onEngineStopped(); break;
        case 12: onEnginePanic((*reinterpret_cast< Atom(*)>(_a[1])),(*reinterpret_cast< Word(*)>(_a[2])),(*reinterpret_cast< const QString(*)>(_a[3])),(*reinterpret_cast< const QString(*)>(_a[4]))); break;
        default: ;
        }
        _id -= 13;
    }
    return _id;
}
Example #2
0
void Opeke::saveFile()
{
    if ( !fileName.isEmpty() )
    {
        saveFileAs ( fileName );
    }
    else
    {
        saveFileAs();
    }
}
Example #3
0
void QSWindow::preload(){
    //file control buttons and shortcuts
    setAcceptDrops(true);
    ui->tabWidget->setAcceptDrops(true);
    connect(ui->actionOpen_File, SIGNAL(triggered()), SLOT(openFile()));
    ui->actionOpen_File->setShortcut(QKeySequence::Open);
    connect(ui->actionSave_File, SIGNAL(triggered()), SLOT(saveFile()));
    ui->actionSave_File->setShortcut(QKeySequence::Save);
    connect(ui->actionSave_File_as, SIGNAL(triggered()), SLOT(saveFileAs()));
    ui->actionSave_File_as->setShortcut(QKeySequence::SaveAs);
    connect(ui->actionClose, SIGNAL(triggered()), SLOT(closeFile()));
    ui->actionClose->setShortcut(QKeySequence::Close);


    connect(ui->actionPreset, SIGNAL(triggered()), SLOT(changePreset()));
    connect(ui->actionDisplay_Keyboard, SIGNAL(triggered()), SLOT(displayKeyBoard()));
    ui->actionDisplay_Keyboard->setShortcut(QKeySequence("ctrl+K"));
    connect(ui->actionDisplay_specturm,SIGNAL(triggered()), SLOT(displaySpectrum()));
    connect(ui->actionScore_to_wav, SIGNAL(triggered()), SLOT(scoreToWav()));
    connect(ui->actionWav_to_score, SIGNAL(triggered()), SLOT(wavToScore()));
    connect(ui->menuOpened, SIGNAL(triggered(QAction*)), SLOT(switchScene(QAction*)));

    connect(this,SIGNAL(addFromLameSignal(QString)),this, SLOT(addFromLame(QString)), Qt::QueuedConnection);
   //music state management
    connect(mediaPlayer, SIGNAL(positionChanged(qint64)),
            this,SLOT(positionChanged(qint64)),Qt::QueuedConnection);
    connect(mediaPlayer, SIGNAL(durationChanged(qint64)),
            this, SLOT(durationChanged(qint64)),Qt::QueuedConnection);
    connect(mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)), this,
            SLOT(mediaStateChanged(QMediaPlayer::State)),Qt::QueuedConnection);
    connect(positionSlider, SIGNAL(sliderReleased()), this, SLOT(setPosition()),Qt::QueuedConnection);
    connect(playButton, SIGNAL(clicked()), this, SLOT(musicPlay()),Qt::QueuedConnection);

    connect(recorder->recordButton, SIGNAL(clicked()), this, SLOT(record()));
}
void MainWindow::saveFile()
{
  if(mFilePath.isEmpty()) 
    saveFileAs();
  else
    saveFile(mFilePath);
}
void MetaWindow::createActions(){
	resetAct = new QAction(tr("&Reset"),this);
	resetAct->setShortcut(tr("Ctrl+R"));
	resetAct->setStatusTip(tr("Reset the list to its original state."));
	connect(resetAct, SIGNAL(triggered()), this, SLOT(resetModel()));

	saveAct = new QAction(tr("&Save"),this);
	saveAct->setShortcut(tr("Ctrl+S"));
	saveAct->setStatusTip(tr("Save the current file."));
	connect(saveAct, SIGNAL(triggered()), this, SLOT(saveFile()));

	saveAsAct = new QAction(tr("Save As..."),this);
	saveAsAct->setStatusTip(tr("Save the current file to a specified file name."));
	connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveFileAs()));

	loadAct = new QAction(tr("&Load"),this);
	loadAct->setShortcut(tr("Ctrl+L"));
	loadAct->setStatusTip(tr("Load input file"));
	connect(loadAct, SIGNAL(triggered()), this, SLOT(loadFile()));

	quitAct = new QAction(tr("&Quit"),this);
	quitAct->setShortcut(tr("Ctrl+Q"));
	quitAct->setStatusTip(tr("Quit"));
	connect(quitAct, SIGNAL(triggered()), this, SLOT(close()));

	aboutAct = new QAction(tr("About"),this);
	searchAct = new QAction(tr("Search For Parameter/Parameter List"), this);
	searchAct->setToolTip("Search for a particular Parameter or ParameterList");
	connect(aboutAct, SIGNAL(triggered()), this, SLOT(showAbout()));
	connect(searchAct, SIGNAL(triggered()), this, SLOT(initiateSearch()));
}
void MainWindow::initServoBoard()
{
    this->ui->actionSave_Sequence->setVisible(true);
    this->ui->actionLoad_Sequence->setVisible(true);
    this->ui->actionSave_Sequence_As->setVisible(true);
    this->ui->actionSet_Global_Values->setVisible(true);
    this->ui->actionKeep_Edits_Automatically->setVisible(true);
    if (!this->servoControl)
    {
        servoControl = new ServoboardController(this->port,this->servotab,this);
    }
    connect(this->ui->actionLoad_Sequence,SIGNAL(triggered()),servoControl,SLOT(loadFile()));
    connect(this->ui->actionSave_Sequence,SIGNAL(triggered()),servoControl,SLOT(saveFile()));
    connect(this->ui->actionSave_Sequence_As,SIGNAL(triggered()),servoControl,SLOT(saveFileAs()));
    connect(this->servotab,SIGNAL(newPositionToSequence(Position*)),
            servoControl,SLOT(newPositionForSequence(Position*)));
    connect(this->ui->actionSet_Global_Values,SIGNAL(triggered()),
            servoControl,SLOT(globalVariableSetRequested()));
    connect(this->servotab,SIGNAL(playSequence()),servoControl,SLOT(playCurrentSequence()));
    connect(this->servotab,SIGNAL(playPosition(Position*)),this->servoControl,SLOT(playPosition(Position*)));
    connect(this->ui->actionKeep_Edits_Automatically,SIGNAL(toggled(bool)),
            servoControl,SLOT(suppressChangeNotifications(bool)));

    connect(this->servotab,SIGNAL(pauseSequence()),this->servoControl,SLOT(pauseSequence()));
    connect(this->servotab,SIGNAL(stopSequence()),this->servoControl,SLOT(stopSequence()));


}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QFont f("unexistent");
    f.setStyleHint(QFont::Monospace);
    ui->ui_inputPlainTextEdit->setFont(f);
    ui->ui_outputPlainTextEdit->setFont(f);

    setCurrentPath(QString());
    setModified(false);

    connect(ui->ui_sourceEditTableWidget, SIGNAL(cursorPositionChanged(int,int)), this, SLOT(cursorPositionChanged(int,int)));
    connect(ui->ui_sourceEditTableWidget, SIGNAL(textChanged()), this, SLOT(textChanged()));
    connect(ui->ui_newFileAction, SIGNAL(triggered()), this, SLOT(newFile()));
    connect(ui->ui_openFileAction, SIGNAL(triggered()), this, SLOT(openFile()));
    connect(ui->ui_saveFileAction, SIGNAL(triggered()), this, SLOT(saveFile()));
    connect(ui->ui_saveAsAction, SIGNAL(triggered()), this, SLOT(saveFileAs()));
    connect(ui->ui_quitAction, SIGNAL(triggered()), this, SLOT(close()));

    connect(ui->ui_setInterpreterAction, SIGNAL(triggered()), this, SLOT(setInterpreter()));
    connect(ui->ui_runInterpreterAction, SIGNAL(triggered()), this, SLOT(runInterpreter()));
}
Example #8
0
ProjectManager::ProjectManager(QObject* parent) :
    QObject(parent),
    m_project(0),
    m_trackView(0),
    m_progressDialog(NULL)
{
    m_fileRevert = KStandardAction::revert(this, SLOT(slotRevert()), pCore->window()->actionCollection());
    m_fileRevert->setIcon(KoIconUtils::themedIcon(QStringLiteral("document-revert")));
    m_fileRevert->setEnabled(false);

    QAction *a = KStandardAction::open(this,                   SLOT(openFile()),               pCore->window()->actionCollection());
    a->setIcon(KoIconUtils::themedIcon(QStringLiteral("document-open")));
    a = KStandardAction::saveAs(this,                 SLOT(saveFileAs()),             pCore->window()->actionCollection());
    a->setIcon(KoIconUtils::themedIcon(QStringLiteral("document-save-as")));
    a = KStandardAction::openNew(this,                SLOT(newFile()),                pCore->window()->actionCollection());
    a->setIcon(KoIconUtils::themedIcon(QStringLiteral("document-new")));
    m_recentFilesAction = KStandardAction::openRecent(this, SLOT(openFile(QUrl)), pCore->window()->actionCollection());

    QAction * backupAction = new QAction(KoIconUtils::themedIcon(QStringLiteral("edit-undo")), i18n("Open Backup File"), this);
    pCore->window()->addAction(QStringLiteral("open_backup"), backupAction);
    connect(backupAction, SIGNAL(triggered(bool)), SLOT(slotOpenBackup()));

    m_notesPlugin = new NotesPlugin(this);

    m_autoSaveTimer.setSingleShot(true);
    connect(&m_autoSaveTimer, SIGNAL(timeout()), this, SLOT(slotAutoSave()));

    // Ensure the default data folder exist
    QDir dir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
    dir.mkpath(QStringLiteral(".backup"));
    dir.mkdir(QStringLiteral("titles"));
}
Example #9
0
QCrmlGenerator::QCrmlGenerator()
{
    QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
    newAction = new QAction(tr("&New"), this);
    connect(newAction, SIGNAL(triggered()) , this, SLOT(newFile()));

    openAction = new QAction(tr("&Open"), this);
    connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));
    saveAction = new QAction(tr("&Save"), this);
    connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));
    saveAsAction = new QAction(tr("Save &As..."), this);
    connect(saveAsAction, SIGNAL(triggered()), this, SLOT(saveFileAs()));

    exitAction = new QAction(tr("&Exit"), this);
    connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));

    fileMenu->addAction(newAction);
    fileMenu->addAction(openAction);
    fileMenu->addSeparator();
    fileMenu->addAction(saveAction);
    fileMenu->addAction(saveAsAction);
    fileMenu->addSeparator();
    fileMenu->addAction(exitAction);

    m_editorWidget = new EditorWidget;
    setCentralWidget(m_editorWidget);
}
Example #10
0
bool Editor::saveFile(const QUrl &targetUrl)
{
	QUrl url(targetUrl);
	bool result = false;
	if (url.isEmpty() && currentUrl().isEmpty()) {
		result = saveFileAs();
	} else {
		if (url.isEmpty()) url = currentUrl();
		QTemporaryFile tmp;  // only used for network export
		tmp.setAutoRemove(false);
		tmp.open();
		QString filename = url.isLocalFile() ? url.toLocalFile() : tmp.fileName();
	
		QSaveFile *savefile = new QSaveFile(filename);
		if (savefile->open(QIODevice::WriteOnly)) {
			QTextStream outputStream(savefile);
			// store commands in their generic @(...) notation format, to be translatable when reopened
			// this allows sharing of scripts written in different languages
			Tokenizer tokenizer;
			tokenizer.initialize(editor->document()->toPlainText());
			const QStringList localizedLooks(Translator::instance()->allLocalizedLooks());
			QString unstranslated;
			Token* t;
			bool pendingEOL = false;  // to avoid writing a final EOL token
			while ((t = tokenizer.getToken())->type() != Token::EndOfInput) {
				if (pendingEOL) {
					unstranslated.append('\n');
					pendingEOL = false;
				}
				if (localizedLooks.contains(t->look())) {
					QString defaultLook(Translator::instance()->defaultLook(t->look()));
					unstranslated.append(QString("@(%1)").arg(defaultLook));
				} else {
					if (t->type() == Token::EndOfLine) 
						pendingEOL = true;
					else
						unstranslated.append(t->look());
				}
			}
			outputStream << KTURTLE_MAGIC_1_0 << '\n';
			outputStream << unstranslated;
			outputStream.flush();
			savefile->commit();  // check for error here?
		}
		delete savefile;
        if (!url.isLocalFile())
           {
            KIO::StoredTransferJob *job = KIO::storedPut(savefile, url, -1, 0);
                 if(job->exec()){
                    setCurrentUrl(url);
                    editor->document()->setModified(false);
                    // MainWindow will add us to the recent file list
                    emit fileSaved(url);
                    result = true; // fix GUI for saveAs and saveExamples. TODO: check 5 lines above
                }
           }
    }
	return result;
}
Example #11
0
    MainWindow::MainWindow()
    {
        resize(640, 640);

        scroll = new QScrollArea();
        scroll->setWidgetResizable(true);
        setCentralWidget(scroll);

        editor = new EditorWidget();
        scroll->setWidget(editor);

        statusBar()->showMessage(tr("%1 - by Overkill.").arg(AppName), 2000);
        statusBar()->setStyleSheet(
            "QStatusBar {"
            "   border-top: 1px solid #CCCCCC;"
            "   background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #DADBDE, stop: 1 #F6F7FA);"
            "   padding: 4px;"
            "   color: #777777;"
            "}"
        );

#ifdef Q_WS_WIN
        QKeySequence quitSequence(Qt::ALT + Qt::Key_F4);
#else
        QKeySequence quitSequence(QKeySequence::Quit);
#endif

        fileMenu = menuBar()->addMenu(tr("&File"));
        newAction = createAction(fileMenu, tr("&New"), tr("Create a new CHR."), QKeySequence::New);
        openAction = createAction(fileMenu, tr("&Open..."), tr("Open an existing CHR."), QKeySequence::Open);
        createSeparator(fileMenu);
        saveAction = createAction(fileMenu, tr("&Save..."), tr("Save the current CHR."), QKeySequence::Save);
        saveAsAction = createAction(fileMenu, tr("Save &As..."), tr("Save a copy of the current CHR."), QKeySequence::SaveAs);
        createSeparator(fileMenu);
        for(int i = 0; i < MaxRecentCount; ++i)
        {
            auto action = createAction(fileMenu, QKeySequence(Qt::ALT + Qt::Key_1 + i));
            action->setDisabled(true);
            recentFileActions[i] = action;
            connect(action, SIGNAL(triggered()), this, SLOT(openRecentFile()));
        }
        clearRecentAction = createAction(fileMenu, tr("Clear &Recent Files"), tr("Clear all recently opened files."), QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Delete));
        updateRecentFiles();
        createSeparator(fileMenu);
        exitAction = createAction(fileMenu, tr("E&xit"), tr("Exit the program."), quitSequence);

        helpMenu = menuBar()->addMenu(tr("&Help"));
        aboutAction = createAction(helpMenu, tr("&About..."), tr("About %1.").arg(AppName), QKeySequence::HelpContents);

        connect(newAction, SIGNAL(triggered()), this, SLOT(newFile()));
        connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));
        connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));
        connect(saveAsAction, SIGNAL(triggered()), this, SLOT(saveFileAs()));
        connect(clearRecentAction, SIGNAL(triggered()), this, SLOT(clearRecentFiles()));
        connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));
        connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));

        QTimer::singleShot(0, this, SLOT(newFile()));
    }
Example #12
0
void MainWindow::saveFile()
{
    if (fileName == "")
    {
        saveFileAs();
        return;
    }
}
Example #13
0
void MetaWindow::saveFile(){
	QString currentFileName = model->getSaveFileName();
	if(currentFileName != ""){
		model->writeOutput(currentFileName);
	}
	else{
		saveFileAs();
	}
}
Example #14
0
void MainWindow::on_actionSave_triggered()
{
  if (tabs[currentTab()].path.isEmpty())
  {
      saveFileAs();
  }else {
      saveFile();
  }
}
Example #15
0
void QCrmlGenerator::saveFile()
{
    if (m_saveFile.isEmpty()) {
        saveFileAs();
    }
    else {
        if (m_editorWidget->verifyContents())
            m_editorWidget->save(m_saveFile);
    }
}
Example #16
0
void StandardActions::createStandardActions()
{
    QAction *newAction = new QAction(tr("New"), mainWindow);
    newAction->setShortcut(QKeySequence("Ctrl+N"));
    mainWindow->getActionCollection()->addAction("new", newAction);
    connect(newAction, SIGNAL(triggered()), this, SLOT(newFile()));

    QAction *openAction = new QAction(tr("Open"), mainWindow);
    openAction->setShortcut(QKeySequence("Ctrl+O"));
    mainWindow->getActionCollection()->addAction("open", openAction);
    connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));

    QAction *saveAction = new QAction(tr("Save"), mainWindow);
    saveAction->setShortcut(QKeySequence("Ctrl+S"));
    mainWindow->getActionCollection()->addAction("save", saveAction);
    connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));

    QAction *saveAsAction = new QAction(tr("Save As"), mainWindow);
    mainWindow->getActionCollection()->addAction("saveas", saveAsAction);
    connect(saveAsAction, SIGNAL(triggered()), this, SLOT(saveFileAs()));

    QAction *exportAction = new QAction(tr("Export"), mainWindow);
    mainWindow->getActionCollection()->addAction("export", exportAction);
    connect(exportAction, SIGNAL(triggered()), this, SLOT(exportFile()));

    QAction *exitAction = new QAction(tr("Exit"), mainWindow);
    exitAction->setShortcut(QKeySequence("Ctrl+Q"));
    mainWindow->getActionCollection()->addAction("exit", exitAction);
    connect(exitAction, SIGNAL(triggered()), this, SLOT(exitApplication()));

    QAction* cutAction = new QAction(tr("Cut"), mainWindow);
    cutAction->setShortcut(QKeySequence("Ctrl+X"));
    mainWindow->getActionCollection()->addAction("cut", cutAction);
    connect(cutAction, SIGNAL(triggered()), this, SLOT(cut()));

    QAction* copyAction = new QAction(tr("Copy"), mainWindow);
    copyAction->setShortcut(QKeySequence("Ctrl+C"));
    mainWindow->getActionCollection()->addAction("copy", copyAction);
    connect(copyAction, SIGNAL(triggered()), this , SLOT(copy()));

    QAction* pasteAction = new QAction(tr("Paste"), mainWindow);
    pasteAction->setShortcut(QKeySequence("Ctrl+V"));
    mainWindow->getActionCollection()->addAction("paste", pasteAction);
    connect(pasteAction, SIGNAL(triggered()), this, SLOT(paste()));

    QAction* undoAction = new QAction(tr("Undo"), mainWindow);
    undoAction->setShortcut(QKeySequence("Ctrl+Z"));
    mainWindow->getActionCollection()->addAction("undo", undoAction);
    connect(undoAction, SIGNAL(triggered()), this, SLOT(undo()));

    QAction* redoAction = new QAction(tr("Redo"), mainWindow);
    redoAction->setShortcut(QKeySequence("Ctrl+R"));
    mainWindow->getActionCollection()->addAction("redo", redoAction);
    connect(redoAction, SIGNAL(triggered(bool)), this, SLOT(redo()));
}
Example #17
0
 void MainWindow::saveFile()
 {
     if(currentFile.isEmpty())
     {
         saveFileAs();
     }
     else
     {
         writeFile(currentFile);
     }
 }
void MainWindow::saveFile()
{
    if(m_currentFilePath.isEmpty())
    {
        saveFileAs();
    }
    else
    {
        save(m_currentFilePath);
    }
}
Example #19
0
bool MetaWindow::saveCurrentUnsavedFile(){
		QMessageBox saveQuestion(QMessageBox::Question, 
		tr("Save?"),
		tr("These choices have not been saved since you last made changes. Would you like to save them now?"), 
		QMessageBox::Yes | QMessageBox::No,
		this);
		saveQuestion.setDefaultButton(QMessageBox::Yes);
		int shouldSave = saveQuestion.exec(); 
		if(shouldSave == QMessageBox::Yes){
			return saveFileAs();
		}
		return true;
}
Example #20
0
bool TextBuffer::saveFile()
{
  if (testFlag(EditFlags::NeedsSave))
    if (file.existsAsFile())
      {
	file.replaceWithText(getText());
	clearFlag(EditFlags::NeedsSave);
        Preferences::getInstance()->recentlyOpened.addFile(file);
	return true;
      }
    else
      return saveFileAs(file);
  return false;
}
Example #21
0
void MainWindow::saveFile()
{
    if (m_undoManager.isClean())
        return;

    if (m_activeFilename == "")
        return saveFileAs();

    bool success = save_project(m_activeFilename, m_project);

    if (success)
      m_undoManager.setClean();
    else
      QMessageBox::critical(this, "Sproxel Error", QString("Error saving project to file ")+m_activeFilename);
}
Example #22
0
int MaceWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: emission((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 1: give_info((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 2: newFile(); break;
        case 3: load(); break;
        case 4: save(); break;
        case 5: saveFileAs(); break;
        default: ;
        }
        _id -= 6;
    }
    return _id;
}
Example #23
0
/** GUI setup
 */
spqrMainWindow::spqrMainWindow(int argc, char *argv[], QWidget *parent)
    : QMainWindow(parent), MruHelper("spqr")
{
    statusBar()->showMessage(tr("spqr Setup"));

    lqPreferences p;
    p.loadGeometry(this);

    con = new ConsoleEdit(argc, argv);
    connect(con, SIGNAL(engine_ready()), this, SLOT(engineReady()));

    make_tabs();

    QMenu *m = menuBar()->addMenu(tr("&File"));
    m->setStatusTip(tr("Show File operations"));
    m->addAction(tr("&New..."), this, SLOT(newFile()), QKeySequence::New)->setStatusTip(tr("Create a new file"));
    m->addAction(tr("&Open..."), this, SLOT(openFile()), QKeySequence::Open)->setStatusTip(tr("Open an existing file"));
    m->addMenu(mruMenu = new QMenu(tr("Recent &Files...")))->setStatusTip(tr("List recently opened files"));
    loadMru(p, this);
    m->addSeparator();
    m->addAction(tr("&Save"), this, SLOT(saveFile()), QKeySequence::Save)->setStatusTip(tr("Save the document to disk"));
    m->addAction(tr("Save &As..."), this, SLOT(saveFileAs()), QKeySequence::SaveAs)->setStatusTip(tr("Save the document under a new name"));

    m->addSeparator();
    m->addAction(tr("&Quit"), qApp, SLOT(quit()), QKeySequence::Quit)->setStatusTip(tr("Exit the application"));

    // detach the background processor to avoid a random GPF exiting the program
    connect(qApp, &QApplication::aboutToQuit, []() { SwiPrologEngine::quit_request(); });

    menuBar()->addSeparator();
    menuBar()->addAction("&Exec", this, SLOT(execSource()))->setStatusTip(tr("Run Prolog Source code"));
    menuBar()->addAction("&Source", this, SLOT(viewSource()))->setStatusTip(tr("Show the Prolog source window"));
    menuBar()->addAction("&Console", this, SLOT(viewConsole()))->setStatusTip(tr("Show the SWI-Prolog console"));
    menuBar()->addAction("&Help", this, SLOT(viewHelp()))->setStatusTip(tr("Show SWI-Prolog helpDoc"));

    lastDir = p.value("lastDir").toString();
    QString currFile = p.value("fileSource").toString();
    if (argc >= 2)
        currFile = argv[1];
    if (currFile.length())
        openSourceFile(currFile);
}
Example #24
0
MenuBar::MenuBar(QWidget *parent) :
    QMenuBar(parent)
{
    fileMenu = new QMenu("File");
    fileMenu->addAction("New", this, SLOT(newFile()), QKeySequence("CTRL+N"));
    fileMenu->addAction("Open", this, SLOT(openFile()), QKeySequence("CTRL+O"));
    // fileMenu->addAction("Open Recent");
    recentMenu = new QMenu("Open recent files");
    fileMenu->addMenu(recentMenu);

    fileMenu->addAction("Save", this, SLOT(saveFile()), QKeySequence("CTRL+S"));
    fileMenu->addAction("Save As...", this, SLOT(saveFileAs()), QKeySequence("SHIFT+CTRL+S"));
    fileMenu->addSeparator();
    fileMenu->addAction("Close", this, SLOT(closeFile()), QKeySequence("CTRL+W"));
    fileMenu->addAction("Close All", this, SLOT(closeAllFiles()), QKeySequence("SHIFT+CTRL+W"));
    fileMenu->addSeparator();
    fileMenu->addAction("Quit", this, SLOT(quit()), QKeySequence("CTRL+Q"));

    sessionMenu = new QMenu("Session");


    editMenu = new QMenu("Edit");
    editMenu->addAction("Previous Buffer", this, SLOT(decrementBuffer()), QKeySequence("ALT+LEFT"));
    editMenu->addAction("Next Buffer", this, SLOT(incrementBuffer()), QKeySequence("ALT+RIGHT"));

    languageMenu = new QMenu("Language");
    languageMenu->addAction("Evaluate code", this, SLOT(evaluateCode()), QKeySequence("SHIFT+RETURN"));
    languageMenu->addAction("Toggle OpenGL", this, SLOT(toggleOpenGL()), QKeySequence("F1"));

    helpMenu = new QMenu("Help");
    helpMenu->addAction("About", this, SLOT(about()));

    addMenu(fileMenu);
    addMenu(sessionMenu);
    addMenu(editMenu);
    addMenu(languageMenu);
    addMenu(helpMenu);
}
Example #25
0
bool MainWindow::saveFile()
{
	if (_filename.isEmpty()) return saveFileAs();

	try
	{
		if (_fileispng) {
			file_save_pic(_filename, ui->graphicsView, false);
		} else {
			fileSaveXml(_filename, ui->graphicsView);
		}
		undostack.clear();
		setModified(false);
	}

	catch(...)
	{
		QMessageBox::critical(this, tr("ERROR!"), tr("Can't save to this file:\n\n") + _filename + tr("\n\nTry another file."));
		createNewDiagram();
	}

	return true;
}
Example #26
0
void MainWindow::on_actionSave_As_triggered()
{
    saveFileAs();
}
Example #27
0
bool EditorFrame::exportIdfAs()
{
  return saveFileAs("Export", "idf");
}
Example #28
0
bool EditorFrame::saveIdkAs()
{
  return saveFileAs("Save", "osm");
}
Example #29
0
MainWindow::MainWindow(const QString& initialFilename, QWidget *parent) :
    QMainWindow(parent),
    m_appSettings("OpenSource", "Sproxel"),
    m_activeFilename(""),
    m_project(new SproxelProject())
{
    // Project
    VoxelGridGroupPtr sprite(new VoxelGridGroup(Imath::V3i(DEFAULT_VOXGRID_SZ, DEFAULT_VOXGRID_SZ, DEFAULT_VOXGRID_SZ),
      ColorPalettePtr()));
    sprite->setName("unnamed");
    m_project->sprites.push_back(sprite);

    // Windows
    m_glModelWidget = new GLModelWidget(this, &m_appSettings, &m_undoManager, sprite);
    setCentralWidget(m_glModelWidget);

    // The docking palette widget
    m_paletteDocker = new QDockWidget(tr("Palette"), this);
    m_paletteDocker->setObjectName("paletteDocker");
    m_paletteDocker->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    m_paletteWidget = new PaletteWidget(this, &m_undoManager);
    m_paletteDocker->setWidget(m_paletteWidget);
    m_paletteWidget->setPalette(m_project->mainPalette);
    addDockWidget(Qt::RightDockWidgetArea, m_paletteDocker);

    // The docking project widget
    m_projectDocker=new QDockWidget(tr("Project"), this);
    m_projectDocker->setObjectName("projectDocker");
    m_projectWidget=new ProjectWidget(this, &m_undoManager, &m_appSettings);
    m_projectDocker->setWidget(m_projectWidget);
    m_projectWidget->setProject(m_project);
    addDockWidget(Qt::RightDockWidgetArea, m_projectDocker);

    // The docking layers widget
    //m_layersDocker = new QDockWidget(tr("Layers"), this);
    //m_layersDocker->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    //m_layersWidget = new LayersWidget(this);
    //m_layersDocker->setWidget(m_layersWidget);
    //addDockWidget(Qt::RightDockWidgetArea, m_layersDocker);

    // Connect some window signals together
    QObject::connect(m_paletteWidget, SIGNAL(activeColorChanged(Imath::Color4f, int)),
                     m_glModelWidget, SLOT(setActiveColor(Imath::Color4f, int)));
    QObject::connect(m_glModelWidget, SIGNAL(colorSampled(Imath::Color4f, int)),
                     m_paletteWidget, SLOT(setActiveColor(Imath::Color4f, int)));
    QObject::connect(&m_undoManager, SIGNAL(cleanChanged(bool)),
                     this, SLOT(reactToModified(bool)));

    QObject::connect(m_projectWidget, SIGNAL(spriteSelected(VoxelGridGroupPtr)),
      m_glModelWidget, SLOT(setSprite(VoxelGridGroupPtr)));


    // Toolbar
    m_toolbar = new QToolBar("Tools", this);
    m_toolbar->setObjectName("toolbar");
    m_toolbar->setOrientation(Qt::Vertical);
    addToolBar(Qt::LeftToolBarArea, m_toolbar);


    // Actions & Menus
    menuBar()->show();
    m_menuFile = menuBar()->addMenu("Fi&le");

    m_actFileNew = new QAction("&New", this);
    m_actFileNew->setShortcut(Qt::CTRL + Qt::Key_N);
    m_menuFile->addAction(m_actFileNew);
    connect(m_actFileNew, SIGNAL(triggered()),
            this, SLOT(newGrid()));

    m_menuFile->addSeparator();

    m_actFileOpen = new QAction("&Open", this);
    m_actFileOpen->setShortcut(Qt::CTRL + Qt::Key_O);
    m_menuFile->addAction(m_actFileOpen);
    connect(m_actFileOpen, SIGNAL(triggered()),
            this, SLOT(openFile()));

    m_actFileSave = new QAction("&Save", this);
    m_actFileSave->setShortcut(Qt::CTRL + Qt::Key_S);
    m_menuFile->addAction(m_actFileSave);
    connect(m_actFileSave, SIGNAL(triggered()),
            this, SLOT(saveFile()));

    m_actFileSaveAs = new QAction("Save &As", this);
    m_menuFile->addAction(m_actFileSaveAs);
    connect(m_actFileSaveAs, SIGNAL(triggered()),
            this, SLOT(saveFileAs()));

    m_menuFile->addSeparator();

    m_actFileImport = new QAction("&Import...", this);
    m_menuFile->addAction(m_actFileImport);
    connect(m_actFileImport, SIGNAL(triggered()),
            this, SLOT(import()));

    m_actFileExportGrid = new QAction("&Export...", this);
    m_menuFile->addAction(m_actFileExportGrid);
    connect(m_actFileExportGrid, SIGNAL(triggered()),
            this, SLOT(exportGrid()));

    m_menuFile->addSeparator();

    m_actQuit = new QAction("&Quit", this);
    m_actQuit->setShortcut(Qt::CTRL + Qt::Key_Q);
    m_menuFile->addAction(m_actQuit);
    connect(m_actQuit, SIGNAL(triggered()),
            this, SLOT(close()));


    // ------ edit menu
    m_menuEdit = menuBar()->addMenu("&Edit");

    m_actUndo=m_undoManager.createUndoAction(this, "Undo");
    m_actUndo->setShortcut(Qt::CTRL + Qt::Key_Z);
    m_menuEdit->addAction(m_actUndo);

    m_actRedo=m_undoManager.createRedoAction(this, "Redo");
    m_actRedo->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Z);
    m_menuEdit->addAction(m_actRedo);

    m_menuEdit->addSeparator();

    m_actShiftUp = new QAction("Shift up", this);
    m_actShiftUp->setShortcut(Qt::CTRL + Qt::Key_BracketRight);
    m_menuEdit->addAction(m_actShiftUp);
    connect(m_actShiftUp, SIGNAL(triggered()),
            this, SLOT(shiftUp()));

    m_actShiftDown = new QAction("Shift down", this);
    m_actShiftDown->setShortcut(Qt::CTRL + Qt::Key_BracketLeft);
    m_menuEdit->addAction(m_actShiftDown);
    connect(m_actShiftDown, SIGNAL(triggered()),
            this, SLOT(shiftDown()));

    m_actShiftWrap = new QAction("Wrap shift ops", this);
    m_actShiftWrap->setCheckable(true);
    m_actShiftWrap->setChecked(m_glModelWidget->shiftWrap());
    m_menuEdit->addAction(m_actShiftWrap);
    connect(m_actShiftWrap, SIGNAL(toggled(bool)),
            m_glModelWidget, SLOT(setShiftWrap(bool)));

    m_actRotateCw = new QAction("Rotate clockwise", this);
    m_actRotateCw->setShortcut(Qt::CTRL + Qt::Key_Greater);
    m_menuEdit->addAction(m_actRotateCw);
    connect(m_actRotateCw, SIGNAL(triggered()),
            this, SLOT(rotateCw()));

    m_actRotateCcw = new QAction("Rotate counter-clockwise", this);
    m_actRotateCcw->setShortcut(Qt::CTRL + Qt::Key_Less);
    m_menuEdit->addAction(m_actRotateCcw);
    connect(m_actRotateCcw, SIGNAL(triggered()),
            this, SLOT(rotateCcw()));

    m_actMirror = new QAction("Mirror", this);
    m_actMirror->setShortcut(Qt::CTRL + Qt::Key_M);
    m_menuEdit->addAction(m_actMirror);
    connect(m_actMirror, SIGNAL(triggered()),
            this, SLOT(mirror()));

    m_menuEdit->addSeparator();

    m_actPreferences = new QAction("Preferences...", this);
    m_menuEdit->addAction(m_actPreferences);
    connect(m_actPreferences, SIGNAL(triggered()),
            this, SLOT(editPreferences()));


    // ------ grid menu
    m_menuGrid = menuBar()->addMenu("&Grid");

    m_actExtendUp = new QAction("Extend grid dimension up", this);
    m_actExtendUp->setShortcut(Qt::CTRL + Qt::Key_Plus);
    m_menuGrid->addAction(m_actExtendUp);
    connect(m_actExtendUp, SIGNAL(triggered()),
            this, SLOT(extendUp()));

    m_actExtendDown = new QAction("Extend grid dimension down", this);
    m_actExtendDown->setShortcut(Qt::CTRL + Qt::Key_Minus);
    m_menuGrid->addAction(m_actExtendDown);
    connect(m_actExtendDown, SIGNAL(triggered()),
            this, SLOT(extendDown()));

    m_actContractUp = new QAction("Contract grid dimension from above", this);
    m_menuGrid->addAction(m_actContractUp);
    connect(m_actContractUp, SIGNAL(triggered()),
            this, SLOT(contractUp()));

    m_actContractDown = new QAction("Contract grid dimension from below", this);
    m_menuGrid->addAction(m_actContractDown);
    connect(m_actContractDown, SIGNAL(triggered()),
            this, SLOT(contractDown()));

    m_menuGrid->addSeparator();

    m_actUpRes = new QAction("Double grid resolution", this);
    m_menuGrid->addAction(m_actUpRes);
    connect(m_actUpRes, SIGNAL(triggered()),
            this, SLOT(upRes()));

    m_actDownRes = new QAction("Half grid resolution", this);
    m_menuGrid->addAction(m_actDownRes);
    connect(m_actDownRes, SIGNAL(triggered()),
            this, SLOT(downRes()));


    // ------ view menu
    m_menuView = menuBar()->addMenu("&View");

    QAction *action=new QAction(tr("Frame sprite"), this);
    action->setShortcut(Qt::Key_Z);
    m_menuView->addAction(action);
    connect(action, SIGNAL(triggered()),
      m_glModelWidget, SLOT(frameFull()));

    m_actViewGrid = new QAction("View Grid", this);
    m_actViewGrid->setShortcut(Qt::CTRL + Qt::Key_G);
    m_actViewGrid->setCheckable(true);
    m_actViewGrid->setChecked(m_glModelWidget->drawGrid());
    m_menuView->addAction(m_actViewGrid);
    connect(m_actViewGrid, SIGNAL(toggled(bool)),
            m_glModelWidget, SLOT(setDrawGrid(bool)));

    m_actViewVoxgrid = new QAction("Voxel Grid", this);
    m_actViewVoxgrid->setShortcut(Qt::Key_G);
    m_actViewVoxgrid->setCheckable(true);
    m_actViewVoxgrid->setChecked(m_glModelWidget->drawVoxelGrid());
    m_menuView->addAction(m_actViewVoxgrid);
    connect(m_actViewVoxgrid, SIGNAL(toggled(bool)),
            m_glModelWidget, SLOT(setDrawVoxelGrid(bool)));

    m_actViewBBox = new QAction("Bounding Box", this);
    m_actViewBBox->setShortcut(Qt::CTRL + Qt::Key_B);
    m_actViewBBox->setCheckable(true);
    m_actViewBBox->setChecked(m_glModelWidget->drawBoundingBox());
    m_menuView->addAction(m_actViewBBox);
    connect(m_actViewBBox, SIGNAL(toggled(bool)),
            m_glModelWidget, SLOT(setDrawBoundingBox(bool)));

    action=new QAction("Sprite Bounds", this);
    action->setShortcut(Qt::Key_B);
    action->setCheckable(true);
    action->setChecked(m_glModelWidget->drawSpriteBounds());
    m_menuView->addAction(action);
    connect(action, SIGNAL(toggled(bool)),
            m_glModelWidget, SLOT(setDrawSpriteBounds(bool)));


    // ------ window menu
    m_menuWindow = menuBar()->addMenu("&Window");
    m_menuWindow->addAction(m_toolbar->toggleViewAction());
    m_menuWindow->addAction(m_paletteDocker->toggleViewAction());
    m_menuWindow->addAction(m_projectDocker->toggleViewAction());
    //m_menuWindow->addAction(m_layersDocker->toggleViewAction());
    m_menuWindow->addAction(get_python_console_widget()->toggleViewAction());
    get_python_console_widget()->toggleViewAction()->setChecked(false);


    // ------ toolbar hookups
    // Icons from the brilliant icon pack located at : http://pen-art.ru/
    m_toolbarActionGroup = new QActionGroup(this);

    m_actToolSplat = new QAction("Splat", m_toolbarActionGroup);
    m_actToolSplat->setIcon(QIcon(QPixmap(":/icons/splat.png")));
    m_actToolSplat->setCheckable(true);
    connect(m_actToolSplat, SIGNAL(toggled(bool)), this, SLOT(setToolSplat(bool)));

    m_actToolReplace = new QAction("Replace", m_toolbarActionGroup);
    m_actToolReplace->setIcon(QIcon(QPixmap(":/icons/pencil.png")));
    m_actToolReplace->setCheckable(true);
    connect(m_actToolReplace, SIGNAL(toggled(bool)), this, SLOT(setToolReplace(bool)));

    m_actToolFlood = new QAction("Flood", m_toolbarActionGroup);
    m_actToolFlood->setIcon(QIcon(QPixmap(":/icons/paintBucket.png")));
    m_actToolFlood->setCheckable(true);
    connect(m_actToolFlood, SIGNAL(toggled(bool)), this, SLOT(setToolFlood(bool)));

    m_actToolDropper = new QAction("Dropper", m_toolbarActionGroup);
    m_actToolDropper->setIcon(QIcon(QPixmap(":/icons/eyeDropper.png")));
    m_actToolDropper->setCheckable(true);
    connect(m_actToolDropper, SIGNAL(toggled(bool)), this, SLOT(setToolDropper(bool)));

    m_actToolEraser = new QAction("Eraser", m_toolbarActionGroup);
    m_actToolEraser->setIcon(QIcon(QPixmap(":/icons/eraser.png")));
    m_actToolEraser->setCheckable(true);
    connect(m_actToolEraser, SIGNAL(toggled(bool)), this, SLOT(setToolEraser(bool)));

    m_actToolSlab = new QAction("Slab", m_toolbarActionGroup);
    m_actToolSlab->setIcon(QIcon(QPixmap(":/icons/slab.png")));
    m_actToolSlab->setCheckable(true);
    connect(m_actToolSlab, SIGNAL(toggled(bool)), this, SLOT(setToolSlab(bool)));

    m_actToolLine = new QAction("Line", m_toolbarActionGroup);
    m_actToolLine->setIcon(QIcon(QPixmap(":/icons/line.png")));
    m_actToolLine->setCheckable(true);
    connect(m_actToolLine, SIGNAL(toggled(bool)), this, SLOT(setToolLine(bool)));

    m_actToolBox = new QAction("Box", m_toolbarActionGroup);
    m_actToolBox->setIcon(QIcon(QPixmap(":/icons/box.png")));
    m_actToolBox->setCheckable(true);
    connect(m_actToolBox, SIGNAL(toggled(bool)), this, SLOT(setToolBox(bool)));

    m_actToolExtrude = new QAction("Extrude", m_toolbarActionGroup);
    m_actToolExtrude->setIcon(QIcon(QPixmap(":/icons/extrude.png")));
    m_actToolExtrude->setCheckable(true);
    connect(m_actToolExtrude, SIGNAL(toggled(bool)), this, SLOT(setToolExtrude(bool)));

    //m_actToolRay = new QAction("Ray", this);

    m_actToolSplat->setChecked(true);
    m_toolbar->addActions(m_toolbarActionGroup->actions());


    // Toolbar widgets for slicing
    m_toolbar->addSeparator();
    m_minSliceBox=new QSpinBox();
    m_maxSliceBox=new QSpinBox();
    m_toolbar->addWidget(m_maxSliceBox);
    m_toolbar->addWidget(m_minSliceBox);

    connect(m_glModelWidget, SIGNAL(sliceChanged(int, int, int)), this, SLOT(updateSlice(int, int, int)));
    connect(m_minSliceBox, SIGNAL(valueChanged(int)), m_glModelWidget, SLOT(setMinSlice(int)));
    connect(m_maxSliceBox, SIGNAL(valueChanged(int)), m_glModelWidget, SLOT(setMaxSlice(int)));

    // axis selection
    QActionGroup *axisGroup=new QActionGroup(this);

    QAction *a=new QAction("X", axisGroup);
    a->setCheckable(true);
    connect(a, SIGNAL(toggled(bool)), m_glModelWidget, SLOT(setAxisX()));
    m_actAxisX=a;

    a=new QAction("Y", axisGroup);
    a->setCheckable(true);
    connect(a, SIGNAL(toggled(bool)), m_glModelWidget, SLOT(setAxisY()));
    m_actAxisY=a;

    a=new QAction("Z", axisGroup);
    a->setCheckable(true);
    connect(a, SIGNAL(toggled(bool)), m_glModelWidget, SLOT(setAxisZ()));
    m_actAxisZ=a;

    m_toolbar->addSeparator();
    m_toolbar->addActions(axisGroup->actions());

    m_actAxisY->setChecked(true);


    // Remaining verbosity
    setWindowTitle(BASE_WINDOW_TITLE);
    statusBar()->showMessage(tr("Ready"));

    // Load up some settings
    if (m_appSettings.value("saveUILayout", true).toBool())
    {
        resize(m_appSettings.value("MainWindow/size", QSize(546, 427)).toSize());
        move(m_appSettings.value("MainWindow/position", QPoint(200, 200)).toPoint());
        setWindowState((Qt::WindowStates)m_appSettings.value("MainWindow/windowState", Qt::WindowActive).toInt());
        restoreState(m_appSettings.value("MainWindow/widgetsState").toByteArray());
        m_toolbar->setVisible(m_appSettings.value("toolbar/visibility", true).toBool());
        m_paletteDocker->setVisible(m_appSettings.value("paletteWindow/visibility", true).toBool());
        m_projectDocker->setVisible(m_appSettings.value("projectWindow/visibility", true).toBool());
        //m_layersDocker->setVisible(m_appSettings.value("layersWindow/visibility", true).toBool());
    }

    // Load the commandline supplied filename
    if (initialFilename != "")
    {
        openFile(initialFilename);
    }

    // Better way to keep the state in one place
    //std::cout << (m_toolbarActionGroup->checkedAction()->text() == "Splat") << std::endl;
    //std::cout << qPrintable(m_toolbarActionGroup->checkedAction()->text()) << std::endl;

    // Start things off focused on the GLWidget
    m_glModelWidget->setFocus();
}
Example #30
0
FITSViewer::FITSViewer (QWidget *parent)
        : KXmlGuiWindow (parent)
{
#ifdef Q_OS_OSX
    if(Options::independentWindowFITS())
         setWindowFlags(Qt::Window);
     else{
        setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint);
        connect(QApplication::instance(), SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(changeAlwaysOnTop(Qt::ApplicationState)));
     }
#endif

    fitsTab   = new QTabWidget(this);
    undoGroup = new QUndoGroup(this);

    fitsID = 0;
    debayerDialog= NULL;
    markStars = false;

    lastURL = QUrl(QDir::homePath());

    fitsTab->setTabsClosable(true);

    setWindowIcon(QIcon::fromTheme("kstars_fitsviewer", QIcon(":/icons/breeze/default/kstars_fitsviewer.svg")));

    setCentralWidget(fitsTab);

    connect(fitsTab, SIGNAL(currentChanged(int)), this, SLOT(tabFocusUpdated(int)));
    connect(fitsTab, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));

    //These two connections will enable or disable the scope button if a scope is available or not.
    //Of course this is also dependent on the presence of WCS data in the image.

    #ifdef HAVE_INDI
    connect(INDIListener::Instance(), SIGNAL(newTelescope(ISD::GDInterface *)), this, SLOT(updateWCSFunctions()));
    connect(INDIListener::Instance(), SIGNAL(deviceRemoved(ISD::GDInterface *)), this, SLOT(updateWCSFunctions()));
    #endif

    led.setColor(Qt::green);

    fitsPosition.setAlignment(Qt::AlignCenter);
    fitsValue.setAlignment(Qt::AlignCenter);

    //fitsPosition.setFixedWidth(100);
    //fitsValue.setFixedWidth(100);
    fitsWCS.setVisible(false);

    statusBar()->insertPermanentWidget(FITS_WCS, &fitsWCS);
    statusBar()->insertPermanentWidget(FITS_VALUE, &fitsValue);
    statusBar()->insertPermanentWidget(FITS_POSITION, &fitsPosition);
    statusBar()->insertPermanentWidget(FITS_ZOOM, &fitsZoom);
    statusBar()->insertPermanentWidget(FITS_RESOLUTION, &fitsResolution);
    statusBar()->insertPermanentWidget(FITS_LED, &led);

    QAction *action;

    action = actionCollection()->addAction("rotate_right", this, SLOT(rotateCW()));
    action->setText(i18n("Rotate Right"));
    action->setIcon(QIcon::fromTheme("object-rotate-right", QIcon(":/icons/breeze/default/object-rotate-right.svg")));

    action = actionCollection()->addAction("rotate_left", this, SLOT(rotateCCW()));
    action->setText(i18n("Rotate Left"));
    action->setIcon(QIcon::fromTheme("object-rotate-left", QIcon(":/icons/breeze/default/object-rotate-left.svg")));

    action = actionCollection()->addAction("flip_horizontal", this, SLOT(flipHorizontal()));
    action->setText(i18n("Flip Horizontal"));
    action->setIcon(QIcon::fromTheme("object-flip-horizontal", QIcon(":/icons/breeze/default/object-flip-horizontal.svg")));

    action = actionCollection()->addAction("flip_vertical", this, SLOT(flipVertical()));
    action->setText(i18n("Flip Vertical"));
    action->setIcon(QIcon::fromTheme("object-flip-vertical", QIcon(":/icons/breeze/default/object-flip-vertical.svg")));

    action = actionCollection()->addAction("image_histogram");
    action->setText(i18n("Histogram"));
    connect(action, SIGNAL(triggered(bool)), SLOT (histoFITS()));
    actionCollection()->setDefaultShortcut(action, QKeySequence::Replace);

    action->setIcon(QIcon(":/icons/histogram.png"));

    action = KStandardAction::open(this,   SLOT(openFile()),   actionCollection());
    action->setIcon(QIcon::fromTheme("document-open", QIcon(":/icons/breeze/default/document-open.svg")));
    
    saveFileAction    = KStandardAction::save(this,   SLOT(saveFile()),   actionCollection());
    saveFileAction->setIcon(QIcon::fromTheme("document-save", QIcon(":/icons/breeze/default/document-save.svg")));

    action=saveFileAsAction  = KStandardAction::saveAs(this, SLOT(saveFileAs()), actionCollection());
    saveFileAsAction->setIcon(QIcon::fromTheme("document-save_as", QIcon(":/icons/breeze/default/document-save-as.svg")));

    action = actionCollection()->addAction("fits_header");
    actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::CTRL+Qt::Key_H));
    action->setIcon(QIcon::fromTheme("document-properties", QIcon(":/icons/breeze/default/document-properties.svg")));
    action->setText(i18n( "FITS Header"));
    connect(action, SIGNAL(triggered(bool) ), SLOT(headerFITS()));

    action = actionCollection()->addAction("fits_debayer");
    actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::CTRL+Qt::Key_D));
    action->setIcon(QIcon::fromTheme("view-preview", QIcon(":/icons/breeze/default/view-preview.svg")));
    action->setText(i18n( "Debayer..."));
    connect(action, SIGNAL(triggered(bool) ), SLOT(debayerFITS()));

    action = actionCollection()->addAction("image_stretch");
    action->setText(i18n("Auto stretch"));
    connect(action, SIGNAL(triggered(bool)), SLOT (stretchFITS()));
    actionCollection()->setDefaultShortcut(action, QKeySequence::SelectAll);
    action->setIcon(QIcon::fromTheme("transform-move", QIcon(":/icons/breeze/default/transform-move.svg")));

    action = KStandardAction::close(this,  SLOT(close()),  actionCollection());
    action->setIcon(QIcon::fromTheme("window-close", QIcon(":/icons/breeze/default/window-close.svg")));
    
    action = KStandardAction::copy(this,   SLOT(copyFITS()),   actionCollection());
    action->setIcon(QIcon::fromTheme("edit-copy", QIcon(":/icons/breeze/default/edit-copy.svg")));
    
    action=KStandardAction::zoomIn(this,     SLOT(ZoomIn()),      actionCollection());
    action->setIcon(QIcon::fromTheme("zoom-in", QIcon(":/icons/breeze/default/zoom-in.svg")));
    
    action=KStandardAction::zoomOut(this,    SLOT(ZoomOut()),     actionCollection());
    action->setIcon(QIcon::fromTheme("zoom-out", QIcon(":/icons/breeze/default/zoom-out.svg")));
    
    action=KStandardAction::actualSize(this, SLOT(ZoomDefault()), actionCollection());
    action->setIcon(QIcon::fromTheme("zoom-fit-best", QIcon(":/icons/breeze/default/zoom-fit-best.svg")));

    QAction *kundo = KStandardAction::undo(undoGroup, SLOT(undo()), actionCollection());
    kundo->setIcon(QIcon::fromTheme("edit-undo", QIcon(":/icons/breeze/default/edit-undo.svg")));
    
    QAction *kredo = KStandardAction::redo(undoGroup, SLOT(redo()), actionCollection());
    kredo->setIcon(QIcon::fromTheme("edit-redo", QIcon(":/icons/breeze/default/edit-redo.svg")));

    connect(undoGroup, SIGNAL(canUndoChanged(bool)), kundo, SLOT(setEnabled(bool)));
    connect(undoGroup, SIGNAL(canRedoChanged(bool)), kredo, SLOT(setEnabled(bool)));

    action = actionCollection()->addAction("image_stats");
    action->setIcon(QIcon::fromTheme("view-statistics", QIcon(":/icons/breeze/default/view-statistics.svg")));
    action->setText(i18n( "Statistics"));
    connect(action, SIGNAL(triggered(bool)), SLOT(statFITS()));

    action = actionCollection()->addAction("view_crosshair");
    action->setIcon(QIcon::fromTheme("crosshairs", QIcon(":/icons/breeze/default/crosshairs.svg")));
    action->setText(i18n( "Show Cross Hairs"));
    action->setCheckable(true);
    connect(action, SIGNAL(triggered(bool)), SLOT(toggleCrossHair()));

    action = actionCollection()->addAction("view_pixel_grid");
    action->setIcon(QIcon::fromTheme("map-flat", QIcon(":/icons/breeze/default/map-flat.svg")));
    action->setText(i18n( "Show Pixel Gridlines"));
    action->setCheckable(true);
    connect(action, SIGNAL(triggered(bool)), SLOT(togglePixelGrid()));

    action = actionCollection()->addAction("view_eq_grid");
    action->setIcon(QIcon::fromTheme("kstars_grid", QIcon(":/icons/breeze/default/kstars_grid.svg")));
    action->setText(i18n( "Show Equatorial Gridlines"));
    action->setCheckable(true);
    action->setDisabled(true);
    connect(action, SIGNAL(triggered(bool)), SLOT(toggleEQGrid()));

    action = actionCollection()->addAction("view_objects");
    action->setIcon(QIcon::fromTheme("help-hint", QIcon(":/icons/breeze/default/help-hint.svg")));
    action->setText(i18n( "Show Objects in Image"));
    action->setCheckable(true);
    action->setDisabled(true);
    connect(action, SIGNAL(triggered(bool)), SLOT(toggleObjects()));

    action = actionCollection()->addAction("center_telescope");
    action->setIcon(QIcon(":/icons/center_telescope.svg"));
    action->setText(i18n( "Center Telescope\n*No Telescopes Detected*"));
    action->setDisabled(true);
    action->setCheckable(true);
    connect(action, SIGNAL(triggered(bool)), SLOT(centerTelescope()));

    action = actionCollection()->addAction("view_zoom_fit");
    action->setIcon(QIcon::fromTheme("zoom-fit-width", QIcon(":/icons/breeze/default/zoom-fit-width.svg")));
    action->setText(i18n( "Zoom To Fit"));
    connect(action, SIGNAL(triggered(bool)), SLOT(ZoomToFit()));

    action = actionCollection()->addAction("mark_stars");
    action->setText(i18n( "Mark Stars"));
    connect(action, SIGNAL(triggered(bool)), SLOT(toggleStars()));

    QSignalMapper *filterMapper = new QSignalMapper(this);

    int filterCounter=1;

    foreach(QString filter, FITSViewer::filterTypes)
    {

        action = actionCollection()->addAction(QString("filter%1").arg(filterCounter));
        action->setText(i18n(filter.toUtf8().constData()));
        filterMapper->setMapping(action, filterCounter++);
        connect(action, SIGNAL(triggered()), filterMapper, SLOT(map()));


    }