Esempio n. 1
0
File: app.cpp Progetto: speakman/qlc
//////////////////////////////////////////////////////////
// Operational control functions                        //
//////////////////////////////////////////////////////////
//
// New document; destroy everything and start anew
//
bool App::slotFileNew()
{
  bool result = false;

  if (doc()->isModified())
    {
      QString msg;
      msg = "Are you sure you want to clear the current workspace?\n";
      msg += "There are unsaved changes.";
      if (QMessageBox::warning(this, KApplicationNameShort, msg,
			       QMessageBox::Yes, QMessageBox::No)
	  == QMessageBox::Yes)
	{
	  newDocument();
	  result = true;
	}
    }
  else
    {
      newDocument();
      result = true;
    }

  return result;
}
Esempio n. 2
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    setupUi(this);

    QWidget *w = documentTabs->widget(0);
    documentTabs->removeTab(0);
    delete w;

    connect(actionOpen, SIGNAL(triggered()), this, SLOT(openDocument()));
    connect(actionClose, SIGNAL(triggered()), this, SLOT(closeDocument()));
    connect(actionNew, SIGNAL(triggered()), this, SLOT(newDocument()));
    connect(actionSave, SIGNAL(triggered()), this, SLOT(saveDocument()));
    connect(actionExit, SIGNAL(triggered()), this, SLOT(close()));
    connect(actionRed, SIGNAL(triggered()), this, SLOT(setShapeColor()));
    connect(actionGreen, SIGNAL(triggered()), this, SLOT(setShapeColor()));
    connect(actionBlue, SIGNAL(triggered()), this, SLOT(setShapeColor()));
    connect(actionAddCircle, SIGNAL(triggered()), this, SLOT(addShape()));
    connect(actionAddRectangle, SIGNAL(triggered()), this, SLOT(addShape()));
    connect(actionAddTriangle, SIGNAL(triggered()), this, SLOT(addShape()));
    connect(actionRemoveShape, SIGNAL(triggered()), this, SLOT(removeShape()));
    connect(actionAddRobot, SIGNAL(triggered()), this, SLOT(addRobot()));
    connect(actionAddSnowman, SIGNAL(triggered()), this, SLOT(addSnowman()));
    connect(actionAbout, SIGNAL(triggered()), this, SLOT(about()));
    connect(actionAboutQt, SIGNAL(triggered()), this, SLOT(aboutQt()));

    connect(undoLimit, SIGNAL(valueChanged(int)), this, SLOT(updateActions()));
    connect(documentTabs, SIGNAL(currentChanged(int)), this, SLOT(updateActions()));

    actionOpen->setShortcut(QString("Ctrl+O"));
    actionClose->setShortcut(QString("Ctrl+W"));
    actionNew->setShortcut(QString("Ctrl+N"));
    actionSave->setShortcut(QString("Ctrl+S"));
    actionExit->setShortcut(QString("Ctrl+Q"));
    actionRemoveShape->setShortcut(QString("Del"));
    actionRed->setShortcut(QString("Alt+R"));
    actionGreen->setShortcut(QString("Alt+G"));
    actionBlue->setShortcut(QString("Alt+B"));
    actionAddCircle->setShortcut(QString("Alt+C"));
    actionAddRectangle->setShortcut(QString("Alt+L"));
    actionAddTriangle->setShortcut(QString("Alt+T"));

    m_undoGroup = new QUndoGroup(this);
    undoView->setGroup(m_undoGroup);
    undoView->setCleanIcon(QIcon(":/icons/ok.png"));

    QAction *undoAction = m_undoGroup->createUndoAction(this);
    QAction *redoAction = m_undoGroup->createRedoAction(this);
    undoAction->setIcon(QIcon(":/icons/undo.png"));
    redoAction->setIcon(QIcon(":/icons/redo.png"));
    menuShape->insertAction(menuShape->actions().at(0), undoAction);
    menuShape->insertAction(undoAction, redoAction);

    toolBar->addAction(undoAction);
    toolBar->addAction(redoAction);

    newDocument();
    updateActions();
};
Esempio n. 3
0
void VirtualConsole::initView(void)
{
  setCaption("Virtual Console");
  setIcon(_app->settings()->pixmapPath() + QString("virtualconsole.xpm"));

  m_layout = new QVBoxLayout(this);
  m_layout->setAutoAdd(false);
  
  m_menuBar = new QMenuBar(this);
  m_layout->setMenuBar(m_menuBar);

  newDocument();

  m_modeMenu = new QPopupMenu();
  m_modeMenu->setCheckable(true);
  m_modeMenu->insertItem("&Operate", ID_VC_MODE_OPERATE);
  m_modeMenu->insertItem("&Design", ID_VC_MODE_DESIGN);
  connect(m_modeMenu, SIGNAL(activated(int)), this, SLOT(slotMenuItemActivated(int)));

  m_addMenu = new QPopupMenu();
  m_addMenu->setCheckable(false);
  m_addMenu->insertItem("&Button", ID_VC_ADD_BUTTON);
  // m_addMenu->insertItem("&Slider", ID_VC_ADD_SLIDER);
  m_addMenu->insertItem("S&peed slider", ID_VC_ADD_SPEEDSLIDER);
  // m_addMenu->insertItem("&Monitor", ID_VC_ADD_MONITOR);
  m_addMenu->insertItem("&Frame", ID_VC_ADD_FRAME);
  connect(m_addMenu, SIGNAL(activated(int)), this, SLOT(slotMenuItemActivated(int)));

  m_menuBar->insertItem("&Mode", m_modeMenu, ID_VC_MODE);
  m_menuBar->insertItem("&Add", m_addMenu, ID_VC_ADD);

  m_menuBar->setItemEnabled(ID_VC_ADD, true);
  setMode(Design);
}
Esempio n. 4
0
/*!
    Constructs a NotesDemo dialog which is a child of \a parent and has the given window
    \a flags.
 */
NotesDemo::NotesDemo( QWidget *parent, Qt::WindowFlags flags )
    : QDialog( parent, flags )
{
    // Create a new document selector which lists documents with the MIME type text/plain
    // sorted so the most recently edited documents appear first.
    documentSelector = new QDocumentSelector;

    documentSelector->setFilter( QContentFilter::mimeType( "text/plain" ) );
    documentSelector->setSortMode( QDocumentSelector::ReverseChronological );

    // Enable the new document option so a 'New' document selection appears at the start of the
    // documents list and in the context menu.
    documentSelector->enableOptions( QDocumentSelector::NewDocument );

    // Connect to the newSelected() and documentSelected() signal so we're notified when the user
    // selects a document.
    connect( documentSelector, SIGNAL(newSelected()),
             this, SLOT(newDocument()) );
    connect( documentSelector, SIGNAL(documentSelected(QContent)),
             this, SLOT(openDocument(QContent)) );

    // Construct the text editor widget.
    editor = new QTextEdit;

    // Create a new stacked layout and add the document selector and text editor widgets to it.
    // As the layout is given the dialog as a parent it is automatically set as the layout for
    // the dialog, and the widgets added to it are re-parented to the dialog.  The document
    // will be the initial widget shown as it was added to the layout first.
    layout = new QStackedLayout( this );

    layout->addWidget( documentSelector );
    layout->addWidget( editor );
}
Esempio n. 5
0
void MainWindow2::openDocument()
{
    if ( maybeSave() )
    {
        QSettings settings( PENCIL2D, PENCIL2D );

        QString strLastOpenPath = settings.value( LAST_FILE_PATH, QDir::homePath() ).toString();
        QString fileName = QFileDialog::getOpenFileName( this,
                                                         tr( "Open File..." ),
                                                         strLastOpenPath,
                                                         tr( PFF_OPEN_ALL_FILE_FILTER ) );
        if ( fileName.isEmpty() )
        {
            return;
        }

        QFileInfo fileInfo( fileName );
        if ( fileInfo.isDir() )
        {
            return;
        }

        bool ok = openObject( fileName );

        if ( !ok )
        {
            QMessageBox::warning( this, tr("Warning"), tr("Pencil cannot read this file. If you want to import images, use the command import.") );
            newDocument();
        }
    }
}
Esempio n. 6
0
static void menu_cb_new (TextEditor me, EDITOR_ARGS_CMD) {
	if (my v_fileBased () && my dirty) {
		if (! my dirtyNewDialog) {
			int buttonWidth = 120, buttonSpacing = 20;
			my dirtyNewDialog = GuiDialog_create (my d_windowForm,
				150, 70, Gui_LEFT_DIALOG_SPACING + 3 * buttonWidth + 2 * buttonSpacing + Gui_RIGHT_DIALOG_SPACING,
					Gui_TOP_DIALOG_SPACING + Gui_TEXTFIELD_HEIGHT + Gui_VERTICAL_DIALOG_SPACING_SAME + 2 * Gui_BOTTOM_DIALOG_SPACING + Gui_PUSHBUTTON_HEIGHT,
				U"Text changed", nullptr, nullptr, GuiDialog_MODAL);
			GuiLabel_createShown (my dirtyNewDialog,
				Gui_LEFT_DIALOG_SPACING, - Gui_RIGHT_DIALOG_SPACING,
				Gui_TOP_DIALOG_SPACING, Gui_TOP_DIALOG_SPACING + Gui_LABEL_HEIGHT,
				U"The text has changed! Save changes?", 0);
			int x = Gui_LEFT_DIALOG_SPACING, y = - Gui_BOTTOM_DIALOG_SPACING;
			GuiButton_createShown (my dirtyNewDialog,
				x, x + buttonWidth, y - Gui_PUSHBUTTON_HEIGHT, y,
				U"Discard & New", gui_button_cb_discardAndNew, cmd, 0);
			x += buttonWidth + buttonSpacing;
			GuiButton_createShown (my dirtyNewDialog,
				x, x + buttonWidth, y - Gui_PUSHBUTTON_HEIGHT, y,
				U"Cancel", gui_button_cb_cancelNew, cmd, 0);
			x += buttonWidth + buttonSpacing;
			GuiButton_createShown (my dirtyNewDialog,
				x, x + buttonWidth, y - Gui_PUSHBUTTON_HEIGHT, y,
				U"Save & New", gui_button_cb_saveAndNew, cmd, 0);
		}
		GuiThing_show (my dirtyNewDialog);
	} else {
		newDocument (me);
	}
}
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: openDocument(); break;
        case 1: saveDocument(); break;
        case 2: closeDocument(); break;
        case 3: newDocument(); break;
        case 4: addShape(); break;
        case 5: removeShape(); break;
        case 6: setShapeColor(); break;
        case 7: addSnowman(); break;
        case 8: addRobot(); break;
        case 9: about(); break;
        case 10: aboutQt(); break;
        case 11: updateActions(); break;
        default: ;
        }
        _id -= 12;
    }
    return _id;
}
Esempio n. 8
0
void MainWindow::createActions() {
    connect(d->newAct, SIGNAL(triggered()), this, SLOT(newDocument()));
    connect(d->etchingAction, SIGNAL(triggered()), this, SLOT(showEtchMenu()));
    connect(d->viewGroup, SIGNAL(triggered(QAction*)), this, SLOT(changeVizType(QAction*)));
    connect(d->maskAction, SIGNAL(triggered()), this, SLOT(showMenuMask()));
    connect(d->exitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
    connect(d->aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
}
Esempio n. 9
0
/**
 * \fn MainWindow::MainWindow(QWidget *parent)
 * \brief Construction de la MainWindow
 * \param Widget parent de MainWindow. 'NULL' par defaut.
 */
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    id = 0;

    NoteManager::getInstance();

    //Configuration

    QWidget* spacer= new QWidget();
    spacer->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);


    //Action
    ui->actionArticle->setIcon(QIcon("/Users/Antoine/Documents/ProjetInfo/Github/Notify_Github/Icons/articleIcon48.png"));
    ui->actionDocument->setIcon(QIcon("/Users/Antoine/Documents/ProjetInfo/Github/Notify_Github/Icons/document1Icon48.png"));
    ui->actionImage_2->setIcon(QIcon("/Users/Antoine/Documents/ProjetInfo/Github/Notify_Github/Icons/imageIcon48.png"));
    ui->actionAudio->setIcon(QIcon("/Users/Antoine/Documents/ProjetInfo/Github/Notify_Github/Icons/audioIcon48.png"));
    ui->actionVideo->setIcon(QIcon("/Users/Antoine/Documents/ProjetInfo/Github/Notify_Github/Icons/videoIcon48.png"));
    ui->actionQuit->setIcon(QIcon("/Users/Antoine/Documents/ProjetInfo/Github/Notify_Github/Icons/stop_2_48.png"));

    //Toolbar
    ui->toolBar->addAction(ui->actionArticle);
    ui->toolBar->addAction(ui->actionDocument);
    ui->toolBar->addAction(ui->actionImage_2);
    ui->toolBar->addAction(ui->actionAudio);
    ui->toolBar->addAction(ui->actionVideo);
    ui->toolBar->addWidget(spacer);
    ui->toolBar->addAction(ui->actionQuit);

    //Connection
    QObject::connect(ui->actionQuit,SIGNAL(triggered()),qApp,SLOT(quit()));
    QObject::connect(ui->actionWorkspace,SIGNAL(triggered()),this,SLOT(newWorkspace()));
    QObject::connect(ui->actionArticle,SIGNAL(triggered()),this,SLOT(newArticle()));
    QObject::connect(ui->actionDocument,SIGNAL(triggered()),this,SLOT(newDocument()));
    QObject::connect(ui->actionVideo,SIGNAL(triggered()),this,SLOT(newVideo()));
    QObject::connect(ui->actionImage_2,SIGNAL(triggered()),this,SLOT(newImage()));
    QObject::connect(ui->actionAudio,SIGNAL(triggered()),this,SLOT(newAudio()));
    QObject::connect(ui->actionSave,SIGNAL(triggered()),this,SLOT(saveWorkspace()));
    QObject::connect(ui->actionSave_As,SIGNAL(triggered()),this,SLOT(saveWorkspaceAs()));

    QObject::connect(this,SIGNAL(clear()),&Workspace::getInstance(),SLOT(clear()));

    //Zone de travail

    gridLayout = new QGridLayout(ui->centralwidget);
    ui->centralwidget->setLayout(gridLayout);

    work = &Workspace::getInstance(ui->centralwidget);
    editor = &Editorspace::getInstance(ui->centralwidget);

    gridLayout->addWidget(work,0,0,1,1);
    gridLayout->addWidget(editor,0,1,2,1);
    gridLayout->addWidget(&Tags::TagManagerWidget::getInstance(ui->centralwidget),1,0,1,1);
}
Esempio n. 10
0
void MainWindow2::openFile( QString filename )
{
    qDebug() << "open recent file" << filename;
    bool ok = openObject( filename );
    if ( !ok )
    {
        QMessageBox::warning( this, tr("Warning"), tr("Pencil cannot read this file. If you want to import images, use the command import.") );
        newDocument();
    }
}
Esempio n. 11
0
File: app.cpp Progetto: speakman/qlc
bool App::slotFileNew()
{
	bool result = false;

	if (doc()->isModified())
	{
		QString msg;
		msg = "Do you wish to save the current workspace?\n";
		msg += "Changes will be lost if you don't save them.";
		int result = QMessageBox::warning(this, "New Workspace", msg,
						  QMessageBox::Yes,
						  QMessageBox::No,
						  QMessageBox::Cancel);
		if (result == QMessageBox::Yes)
		{
			slotFileSave();
			newDocument();
			result = true;
		}
		else if (result == QMessageBox::No)
		{
			newDocument();
			result = true;
		}
		else
		{
			result = false;
		}
	}
	else
	{
		newDocument();
		result = true;
	}

	return result;
}
Esempio n. 12
0
static void gui_button_cb_saveAndNew (EditorCommand cmd, GuiButtonEvent /* event */) {
	TextEditor me = (TextEditor) cmd -> d_editor;
	GuiThing_hide (my dirtyNewDialog);
	if (my name [0]) {
		try {
			saveDocument (me, & my file);
		} catch (MelderError) {
			Melder_flushError ();
			return;
		}
		newDocument (me);
	} else {
		menu_cb_saveAs (me, cmd, nullptr, 0, nullptr, nullptr, nullptr);
	}
}
Esempio n. 13
0
void MainWindow::removeDocument(Document *doc)
{
    int index = documentTabs->indexOf(doc);
    if (index == -1)
        return;

    documentTabs->removeTab(index);
    m_undoGroup->removeStack(doc->undoStack());
    disconnect(doc, SIGNAL(currentShapeChanged(QString)), this, SLOT(updateActions()));
    disconnect(doc->undoStack(), SIGNAL(indexChanged(int)), this, SLOT(updateActions()));
    disconnect(doc->undoStack(), SIGNAL(cleanChanged(bool)), this, SLOT(updateActions()));

    if (documentTabs->count() == 0) {
        newDocument();
        updateActions();
    }
}
Esempio n. 14
0
Document *DocumentBuilder::parse(const byte *bytes, int length, const char *codepage)
{
  entitiesHash.clear();
  extEntitiesHash.clear();

  entitiesHash.put(&DString("amp"), new SString("&"));
  entitiesHash.put(&DString("lt"), new SString("<"));
  entitiesHash.put(&DString("gt"), new SString(">"));
  entitiesHash.put(&DString("quot"), new SString("\""));
  entitiesHash.put(&DString("apos"), new SString("\'"));

  doc = newDocument();
  doc->line = 0;
  doc->pos = 0;

  ppos = opos = 0;
  src = DString(bytes, length, Encodings::getEncodingIndex(codepage));
  src_overflow = null;
  if (src[0] == Encodings::ENC_UTF16_BOM){
    ppos++;
  }

  try{
    consumeDocument();
  }catch(ParseException &e){
    free(doc);
    throw ParseException(*e.getMessage(), doc->line, doc->pos);
  }

  const String* st;
  for (st = entitiesHash.enumerate(); st != null; st = entitiesHash.next()){
    delete st;
  }
  for (st = extEntitiesHash.enumerate(); st != null; st = extEntitiesHash.next()){
    delete st;
  }

  return doc;

}
QString ParticleEffectEntityItem::getAnimationSettings() const {
    // the animations setting is a JSON string that may contain various animation settings.
    // if it includes fps, frameIndex, or running, those values will be parsed out and
    // will over ride the regular animation settings
    QString value = _animationSettings;

    QJsonDocument settingsAsJson = QJsonDocument::fromJson(value.toUtf8());
    QJsonObject settingsAsJsonObject = settingsAsJson.object();
    QVariantMap settingsMap = settingsAsJsonObject.toVariantMap();

    QVariant fpsValue(getAnimationFPS());
    settingsMap["fps"] = fpsValue;

    QVariant frameIndexValue(getAnimationFrameIndex());
    settingsMap["frameIndex"] = frameIndexValue;

    QVariant runningValue(getAnimationIsPlaying());
    settingsMap["running"] = runningValue;

    QVariant firstFrameValue(getAnimationFirstFrame());
    settingsMap["firstFrame"] = firstFrameValue;

    QVariant lastFrameValue(getAnimationLastFrame());
    settingsMap["lastFrame"] = lastFrameValue;

    QVariant loopValue(getAnimationLoop());
    settingsMap["loop"] = loopValue;

    QVariant holdValue(getAnimationHold());
    settingsMap["hold"] = holdValue;

    QVariant startAutomaticallyValue(getAnimationStartAutomatically());
    settingsMap["startAutomatically"] = startAutomaticallyValue;

    settingsAsJsonObject = QJsonObject::fromVariantMap(settingsMap);
    QJsonDocument newDocument(settingsAsJsonObject);
    QByteArray jsonByteArray = newDocument.toJson(QJsonDocument::Compact);
    QString jsonByteString(jsonByteArray);
    return jsonByteString;
}
Esempio n. 16
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QPixmap openFilePix("icons/document-open.svg");
    QPixmap closeFilePix("icons/process-stop.svg");

    btn1 = new QAction(QIcon(openFilePix), "Open Connection", this);
    btn2 = new QAction(QIcon(closeFilePix), "Close Connection", this);

    QObject::connect(btn1, SIGNAL(triggered()), this, SLOT(newDocument()) );
    QObject::connect(btn2, SIGNAL(triggered()), this, SLOT(closeDocument()) );

    ui->mainToolBar->addAction(btn1);
    ui->mainToolBar->addAction(btn2);
    ui->mainToolBar->addSeparator();

    QLineEdit *myLineEdit = new QLineEdit();
    ui->mainToolBar->addWidget(myLineEdit);
}
Esempio n. 17
0
void MinervaWindow::closeDocument(int nr){
    MinervaDocument *d=editors->at(nr);
    if(d->isModified()){
        QMessageBox msg;
        msg.setWindowTitle(tr("Save Document"));
        msg.setText(tr("Do you want to save %1?").arg(d->getName()));
        msg.setIcon(QMessageBox::Question);
        msg.setStandardButtons(QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel);
        int r=msg.exec();
        if(r==QMessageBox::Yes)
            d->save();
        else if(r==QMessageBox::Cancel)
            return;

    }
    //BAD code
    editors->removeAt(nr);
    if(editors->length()<1){
        newDocument();
    }
    ui->documentTabs->removeTab(nr);
}
Esempio n. 18
0
MinervaWindow::MinervaWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::MinervaWindow){
    window=this;
    psettings=NULL;
    ui->setupUi(this);
    setCentralWidget(ui->documentTabs);
    connect(ui->actionNew,SIGNAL(triggered()),this,SLOT(newDocument()));
    connect(ui->action_Open,SIGNAL(triggered()),this,SLOT(openDocument()));
    connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(close()));
    connect(ui->action_Save,SIGNAL(triggered()),this,SLOT(saveDocument()));
    connect(ui->actionSave_As,SIGNAL(triggered()),this,SLOT(saveDocumentAs()));
    connect(ui->actionAbout_Minerva,SIGNAL(triggered()),this,SLOT(about()));
    connect(ui->documentTabs,SIGNAL(tabCloseRequested(int)),this,SLOT(closeDocument(int)));
    connect(ui->actionPlugins,SIGNAL(triggered()),this,SLOT(openPluginsConfiguration()));
    formats = new QFormatScheme(QString("%1/share/minerva/qxs/formats.qxf").arg(ROOTDIR), this);
    QDocument::setDefaultFormatScheme(formats);
    QLineMarksInfoCenter::instance()->loadMarkTypes(QString("%1/share/minerva/qxs/marks.qxm").arg(ROOTDIR));
    languages = new QLanguageFactory(formats, this);
    languages->addDefinitionPath(QString("%1/share/minerva/qxs").arg(ROOTDIR));
    editors=new QList<MinervaDocument*>();


}
Esempio n. 19
0
void MainWindow2::openDocument()
{
    if ( maybeSave() )
    {
        QSettings settings("Pencil","Pencil");

        QString myPath = settings.value("lastFilePath", QVariant(QDir::homePath())).toString();
        QString fileName = QFileDialog::getOpenFileName(
                    this,
                    tr("Open File..."),
                    myPath,
                    tr("PCL (*.pcl);;Any files (*)"));

        if (fileName.isEmpty())
        {
            return ;
        }

        QFileInfo fileInfo(fileName);
        if ( fileInfo.isDir() )
        {
            return;
        }

        bool ok = openObject(fileName);

        if (!ok)
        {
            QMessageBox::warning(this, "Warning", "Pencil cannot read this file. If you want to import images, use the command import.");
            newDocument();
        }
        else
        {
            editor->updateMaxFrame();
        }

    }
}
Esempio n. 20
0
QTExamWindow::QTExamWindow( QWidget* parent, const char* name, WFlags f )
	: QMainWindow( parent, name, f )
{
	setCaption("QTExam");

	QAction *actFileNew  = new QAction( "New", "&New", CTRL+Key_N, this, "new" );
	QAction *actFileQuit = new QAction( "Quit", "&Quit", CTRL+Key_Q, this, "quit" );

	connect( actFileNew,  SIGNAL( activated() ), this, SLOT( newDocument() ) );
	connect( actFileQuit, SIGNAL( activated() ), qApp, SLOT( quit() ) );

	QPopupMenu *menuFile = new QPopupMenu( this );
	actFileNew->addTo( menuFile );
	menuFile->insertSeparator();
	actFileQuit->addTo( menuFile );

	QMenuBar *menuMain = menuBar();
	menuMain->insertItem( "&File", menuFile );

	table = new QTable( 52, 12, this );
	table->setFocus();
	setCentralWidget( table );
}
Esempio n. 21
0
File: app.cpp Progetto: speakman/qlc
//
// Open an existing document
//
void App::slotFileOpen()
{
  bool ok = true;

  if (doc()->isModified())
    {
      QString msg;
      msg = "Are you sure you want to clear the current workspace?\n";
      msg += "There are unsaved changes.";
      if (QMessageBox::warning(this, KApplicationNameShort, msg,
			       QMessageBox::Yes, QMessageBox::No)
	  == QMessageBox::No)
	{
	  ok = false;
	}
    }

  if (ok)
    {
      QString fn = QFileDialog::getOpenFileName(m_doc->fileName(), 
						"*.qlc", this);
      if (fn == QString::null)
	{
	  return;
	}
      else
	{
	  newDocument();
	  if (doc()->loadWorkspaceAs(fn) == false)
	    {
	      QMessageBox::critical(this, KApplicationNameShort, 
				    "Errors occurred while reading file.");
	    }
	}
    }
}
Esempio n. 22
0
void MainWindow::initMenuFile() {
	//connect menu "File" Action
	connect(actionNew, SIGNAL(triggered()), _documentManager, SLOT(newDocument()));
	connect(actionOpen, SIGNAL(triggered()), _documentManager, SLOT(open()));
	connect(actionSave, SIGNAL(triggered()), _documentManager, SLOT(save()));
	connect(actionSaveAs, SIGNAL(triggered()), _documentManager, SLOT(saveAs()));
	connect(actionSaveACopyAs, SIGNAL(triggered()), _documentManager, SLOT(saveACopyAs()));
	connect(actionSaveAll, SIGNAL(triggered()), _documentManager, SLOT(saveAll()));
	connect(actionClose, SIGNAL(triggered()), _documentManager, SLOT(close()));
	connect(actionCloseAll, SIGNAL(triggered()), _documentManager, SLOT(closeAll()));
	connect(actionCloseAllExceptCurrentDocument, SIGNAL(triggered()), _documentManager, SLOT(closeAllExceptCurrentDocument()));
	connect(actionReload, SIGNAL(triggered()), _documentManager, SLOT(reload()));
	connect(actionPrint, SIGNAL(triggered()), _documentManager, SLOT(print()));
	connect(actionExit, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));

	connect(actionExportAsHTML, SIGNAL(triggered()), this, SLOT(exportDocument()));

	connect(actionNewSession, SIGNAL(triggered()), _sessionManager, SLOT(newSession()));
	connect(actionOpenSession, SIGNAL(triggered()), _sessionManager, SLOT(openSession()));
	connect(actionSwitchSession, SIGNAL(triggered()), _sessionManager, SLOT(switchSession()));
	connect(actionSaveSession, SIGNAL(triggered()), _sessionManager, SLOT(saveSession()));
	connect(actionSaveSessionAs, SIGNAL(triggered()), _sessionManager, SLOT(saveSessionAs()));
	connect(actionManageSessions, SIGNAL(triggered()), _sessionManager, SLOT(manageSessions()));

	//recent file actions
	connect(actionEmptyRecentFilesList, SIGNAL(triggered()), this, SLOT(clearRecentFile()));
	connect(actionOpenAllRecentFiles, SIGNAL(triggered()), this, SLOT(openAllRecentFile()));
	_recentFileSeparator = menuRecentFiles->addSeparator();
	for (int i = 0; i < MaxRecentFiles; ++i) {
		_recentFileActions[i] = new QAction(this);
		_recentFileActions[i]->setVisible(false);
		connect(_recentFileActions[i], SIGNAL(triggered()),this, SLOT(openRecentFile()));
		menuRecentFiles->addAction(_recentFileActions[i]);
	}
	updateRecentFileActions();
}
Esempio n. 23
0
void MainWindow::createActions()
{
    // File menu
    m_newDocumentAction = new QAction(QIcon::fromTheme("document-new"), tr("&New"), this);
    m_newDocumentAction->setShortcut(QKeySequence::New);
    connect(m_newDocumentAction, SIGNAL(triggered()), this, SLOT(newDocument()));

    m_openDocumentAction = new QAction(QIcon::fromTheme("document-open"), tr("&Open"), this);
    m_openDocumentAction->setShortcuts(QKeySequence::Open);
    connect(m_openDocumentAction, SIGNAL(triggered()), this, SLOT(onOpenDocumentActionTriggered()));

    m_saveDocumentAction = new QAction(QIcon::fromTheme("document-save"), tr("&Save"), this);
    m_saveDocumentAction->setShortcuts(QKeySequence::Save);
    connect(m_saveDocumentAction, SIGNAL(triggered()), this, SLOT(onSaveActionTriggered()));

    m_saveAsDocumentAction = new QAction(QIcon::fromTheme("document-save-as"), tr("Save As..."), this);
    m_saveAsDocumentAction->setShortcuts(QKeySequence::SaveAs);
    connect(m_saveAsDocumentAction, SIGNAL(triggered()), this, SLOT(onSaveAsActionTriggered()));

    m_exportImageAction = new QAction(EXPORT_TO_MENU_FORMAT_STRING.arg(""), this);
    m_exportImageAction->setShortcut(Qt::CTRL + Qt::Key_E);
    connect(m_exportImageAction, SIGNAL(triggered()), this, SLOT(onExportImageActionTriggered()));

    m_exportAsImageAction = new QAction(tr("Export as ..."), this);
    m_exportAsImageAction->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_E);
    connect(m_exportAsImageAction, SIGNAL(triggered()), this, SLOT(onExportAsImageActionTriggered()));

    m_quitAction = new QAction(QIcon::fromTheme("application-exit"), tr("&Quit"), this);
    m_quitAction->setShortcuts(QKeySequence::Quit);
//    m_quitAction->setShortcut(Qt::CTRL + Qt::Key_Q);
    m_quitAction->setStatusTip(tr("Quit the application"));
    connect(m_quitAction, SIGNAL(triggered()), this, SLOT(close()));

    // Edit menu
    m_undoAction = new QAction(QIcon::fromTheme("edit-undo"), tr("&Undo"), this);
    m_undoAction->setShortcuts(QKeySequence::Undo);
    connect(m_undoAction, SIGNAL(triggered()), this, SLOT(undo()));

    m_redoAction = new QAction(QIcon::fromTheme("edit-redo"), tr("&Redo"), this);
    m_redoAction->setShortcuts(QKeySequence::Redo);
    connect(m_redoAction, SIGNAL(triggered()), this, SLOT(redo()));

    m_copyImageAction = new QAction(QIcon::fromTheme("copy"), tr("&Copy Image"), this);
    m_copyImageAction->setShortcuts(QList<QKeySequence>()
                                    << QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C)
                                    << QKeySequence::Copy
                                   );
    connect(m_copyImageAction, SIGNAL(triggered()), this, SLOT(copyImage()) );

    // Tools menu
    m_pngPreviewAction = new QAction(tr("PNG"), this);
    m_pngPreviewAction->setCheckable(true);
    m_pngPreviewAction->setStatusTip(tr("Tell PlantUML to produce PNG output"));
    connect(m_pngPreviewAction, SIGNAL(toggled(bool)), this, SLOT(changeImageFormat()));

    m_svgPreviewAction = new QAction(tr("SVG"), this);
    m_svgPreviewAction->setCheckable(true);
    m_svgPreviewAction->setStatusTip(tr("Tell PlantUML to produce SVG output"));
    connect(m_svgPreviewAction, SIGNAL(toggled(bool)), this, SLOT(changeImageFormat()));

    QActionGroup* output_action_group = new QActionGroup(this);
    output_action_group->setExclusive(true);
    output_action_group->addAction(m_pngPreviewAction);
    output_action_group->addAction(m_svgPreviewAction);
    m_svgPreviewAction->setChecked(true);

    m_refreshAction = new QAction(QIcon::fromTheme("view-refresh"), tr("Refresh"), this);
    m_refreshAction->setShortcuts(QKeySequence::Refresh);
    m_refreshAction->setStatusTip(tr("Call PlantUML to regenerate the UML image"));
    connect(m_refreshAction, SIGNAL(triggered()), this, SLOT(onRefreshActionTriggered()));

    m_autoRefreshAction = new QAction(tr("Auto-Refresh"), this);
    m_autoRefreshAction->setCheckable(true);

    m_autoSaveImageAction = new QAction(tr("Auto-Save image"), this);
    m_autoSaveImageAction->setCheckable(true);
    connect(m_autoRefreshAction, SIGNAL(toggled(bool)), this, SLOT(onAutoRefreshActionToggled(bool)));

    // Settings menu
    m_showMainToolbarAction = new QAction(tr("Show toolbar"), this);
    m_showMainToolbarAction->setCheckable(true);

    m_showStatusBarAction = new QAction(tr("Show statusbar"), this);
    m_showStatusBarAction->setCheckable(true);

    m_preferencesAction = new QAction(QIcon::fromTheme("preferences-other"), tr("Preferences"), this);
    connect(m_preferencesAction, SIGNAL(triggered()), this, SLOT(onPreferencesActionTriggered()));

    // Help menu
    m_aboutAction = new QAction(QIcon::fromTheme("help-about"), tr("&About"), this);
    m_aboutAction->setStatusTip(tr("Show the application's About box"));
    connect(m_aboutAction, SIGNAL(triggered()), this, SLOT(about()));

    m_aboutQtAction = new QAction(tr("About &Qt"), this);
    m_aboutQtAction->setStatusTip(tr("Show the Qt library's About box"));
    connect(m_aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));

    // focus actions
    QAction* focus_action = new QAction(this);
    focus_action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_0));
    connect(focus_action, SIGNAL(triggered()), m_editor, SLOT(setFocus()));
    this->addAction(focus_action);

    focus_action = new QAction(this);
    focus_action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_1));
    connect(focus_action, SIGNAL(triggered()), this, SLOT(onAssistantFocus()));
    this->addAction(focus_action);

    // assistant actions
    QAction* navigation_action = new QAction(this);
    navigation_action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Down));
    connect(navigation_action, SIGNAL(triggered()), this, SLOT(onNextAssistant()));
    addAction(navigation_action);

    navigation_action = new QAction(this);
    navigation_action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Up));
    connect(navigation_action, SIGNAL(triggered()), this, SLOT(onPrevAssistant()));
    addAction(navigation_action);

    // zoom action
    m_zoomInAction = new QAction(QIcon::fromTheme("zoom-in"), tr("Zoom In"), this);
    connect(m_zoomInAction, SIGNAL(triggered()), m_imageWidget, SLOT(zoomIn()));
    m_zoomOutAction = new QAction(QIcon::fromTheme("zoom-out"), tr("Zoom Out"), this);
    connect(m_zoomOutAction, SIGNAL(triggered()), m_imageWidget, SLOT(zoomOut()));
    m_zoomOriginalAction = new QAction(QIcon::fromTheme("zoom-original"), tr("1:1"), this);
    connect(m_zoomOriginalAction, SIGNAL(triggered()), m_imageWidget, SLOT(zoomOriginal()));
}
Esempio n. 24
0
File: app.cpp Progetto: speakman/qlc
QFile::FileError App::slotFileOpen()
{
	QString fileName;

	/* Check that the user is aware of losing previous changes */
	if (doc()->isModified() == true)
	{
		QString msg = tr("Do you wish to save the current workspace?\n"
				 "Otherwise you will lose changes.");
		int result = QMessageBox::warning(this, "Open Workspace", msg,
						  QMessageBox::Yes,
						  QMessageBox::No,
						  QMessageBox::Cancel);
		if (result == QMessageBox::Yes)
		{
			/* Save first, but don't proceed unless it succeeded. */
			QFile::FileError error = slotFileSaveAs();
			if (handleFileError(error) == false)
				return error;
		}
		else if (result == QMessageBox::Cancel)
		{
			/* Second thoughts... Cancel loading. */
			return QFile::NoError;
		}
	}

	/* Create a file open dialog */
	QFileDialog dialog(this);
	dialog.setWindowTitle(tr("Open Workspace"));
	dialog.setAcceptMode(QFileDialog::AcceptOpen);
	dialog.selectFile(m_doc->fileName());

	/* Append file filters to the dialog */
	QStringList filters;
	filters << QString("Workspaces (*%1)").arg(KExtWorkspace);
	filters << QString("All Files (*)");
	dialog.setNameFilters(filters);

	/* Append useful URLs to the dialog */
	QList <QUrl> sidebar;
	sidebar.append(QUrl::fromLocalFile(QDir::homePath()));
	sidebar.append(QUrl::fromLocalFile(QDir::rootPath()));
	dialog.setSidebarUrls(sidebar);

	/* Get file name */
	if (dialog.exec() != QDialog::Accepted)
		return QFile::NoError;

	fileName = dialog.selectedFiles().first();
	if (fileName.isEmpty() == true)
		return QFile::NoError;

	/* Clear existing document data */
	newDocument();

	/* Load the file */
	QFile::FileError error = doc()->loadXML(fileName, m_fixtureDefCache);
	if (handleFileError(error) == true)
		doc()->resetModified();

	/* Update these in any case, since they are at least emptied now as
	   a result of calling newDocument() a few lines ago. */
	if (FunctionManager::instance() != NULL)
		FunctionManager::instance()->updateTree();
	if (OutputManager::instance() != NULL)
		InputManager::instance()->updateTree();
	if (InputManager::instance() != NULL)
		InputManager::instance()->updateTree();

	return error;
}
Esempio n. 25
0
static void gui_button_cb_discardAndNew (EditorCommand cmd, GuiButtonEvent /* event */) {
	TextEditor me = (TextEditor) cmd -> d_editor;
	GuiThing_hide (my dirtyNewDialog);
	newDocument (me);
}
Esempio n. 26
0
File: app.cpp Progetto: speakman/qlc
//////////////////////////////////////////////////////////////////////
// Main initialization function                                     //
//                                                                  //
// This creates all items that are not saved in workspace files     //
//////////////////////////////////////////////////////////////////////
void App::init(QString openFile)
{
  //
  // Default size
  //
  resize(maximumSize());

  //
  // Settings has to be first
  //
  initSettings();

  //
  // Menus, toolbar, statusbar
  //
  initMenuBar();
  initStatusBar();
  initToolBar();

  //
  // The main view
  //
  initWorkspace();

  //
  // Plugins
  //
  initPlugins();

  //
  // Device classes
  //
  initDeviceClasses();

  //
  // Submasters & values
  //
  initSubmasters();
  initValues();

  //
  // Function consumer
  //
  initFunctionConsumer();

  //
  // Buses
  //
  Bus::init();

  //
  // Document
  //
  initDoc();

  //
  // Views
  //
  initDeviceManagerView();
  initVirtualConsole();


  // Trying to load workspace files
  // Either specified on command line or the last active workspace
  bool success = false;
  if (openFile != "")
    {
       success = doc()->loadWorkspaceAs(openFile);
       if (!success)
         {
            QString msg = "File: " + openFile + "\ncould'nt be opened. Please check path and spelling!\n";
	            msg += "We revert to the previously used workspace.";
	    QMessageBox::warning(this, KApplicationNameShort, msg,
			       QMessageBox::Ok, 0);
         }
    }
  //
  // Load the previous workspace
  //
  if (!success)
    {
      QString config;
      if (settings()->get(KEY_OPEN_LAST_WORKSPACE, config))
       {
         if (config == Settings::trueValue())
	  {
	    if (settings()->get(KEY_LAST_WORKSPACE_NAME, config))
	      {
	         success =  doc()->loadWorkspaceAs(config);
		 if (!success)
		   {
                      QString msg = "Previously used workspace file: " + config + "\ncould'nt be opened.";
	                      msg += "We start over with a new workspace.";
	              QMessageBox::warning(this, KApplicationNameShort, msg, QMessageBox::Ok, 0);
		   }
	      }
	  }
       }
    }
  if (!success)
    {
      newDocument();
    }
}
Esempio n. 27
0
void MainWindow2::createMenus()
{
    // ---------- File Menu -------------
    connect(ui->actionNew, SIGNAL(triggered()), this, SLOT(newDocument()));
    connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openDocument()));
    connect(ui->actionSave_as, SIGNAL(triggered()), this, SLOT(saveAsNewDocument()));
    connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(saveDocument()));
    connect(ui->actionPrint, SIGNAL(triggered()), editor, SLOT(print()));
    connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));

    /// --- Export Menu ---
    connect(ui->actionExport_X_sheet , SIGNAL(triggered()), editor, SLOT(exportX()));
    connect(ui->actionExport_Image_Sequence, SIGNAL(triggered()), editor, SLOT(exportSeq()));
    connect(ui->actionExport_Image, SIGNAL(triggered()), editor, SLOT(exportImage()));
    connect(ui->actionExport_Movie, SIGNAL(triggered()), editor, SLOT(exportMov()));

    //exportFlashAct = new QAction(tr("&Flash/SWF..."), this);
    //exportFlashAct->setShortcut(tr("Ctrl+Alt+F"));
    //connect(exportFlashAct, SIGNAL(triggered()), editor, SLOT(exportFlash()));

    connect(ui->actionExport_Palette, SIGNAL(triggered()), this, SLOT(exportPalette()));

    /// --- Import Menu ---
    connect(ui->actionExport_Svg_Image, SIGNAL(triggered()), editor, SLOT(saveSvg()));
    connect(ui->actionImport_Image, SIGNAL(triggered()), editor, SLOT(importImage()));
    connect(ui->actionImport_Image_Sequence, SIGNAL(triggered()), editor, SLOT(importImageSequence()));
    connect(ui->actionImport_Movie, SIGNAL(triggered()), editor, SLOT(importMov()));
    connect(ui->actionImport_Sound, SIGNAL(triggered()), editor, SLOT(importSound()));
    connect(ui->actionImport_Palette, SIGNAL(triggered()), this, SLOT(importPalette()));

    /// --- Edit Menu ---
    connect(ui->actionUndo, SIGNAL(triggered()), editor, SLOT(undo()));
    connect(ui->actionRedo, SIGNAL(triggered()), editor, SLOT(redo()));
    connect(ui->actionCut, SIGNAL(triggered()), editor, SLOT(cut()));
    connect(ui->actionCopy, SIGNAL(triggered()), editor, SLOT(copy()));
    connect(ui->actionPaste, SIGNAL(triggered()), editor, SLOT(paste()));
    connect(ui->actionDelete, SIGNAL(triggered()), editor, SLOT(clearCurrentFrame()));
    connect(ui->actionCrop, SIGNAL(triggered()), editor, SLOT(crop()));
    connect(ui->actionCrop_To_Selection, SIGNAL(triggered()), editor, SLOT(croptoselect()));
    connect(ui->actionSelect_All, SIGNAL(triggered()), editor, SIGNAL(selectAll()));
    connect(ui->actionDeselect_All, SIGNAL(triggered()), editor, SLOT(deselectAll()));
    connect(ui->actionPreference, SIGNAL(triggered()), this, SLOT(showPreferences()));

    ui->actionRedo->setEnabled(false);

    /// --- Layer Menu ---
    connect(ui->actionNew_Bitmap_Layer, SIGNAL(triggered()), editor, SLOT(newBitmapLayer()));
    connect(ui->actionNew_Vector_Layer, SIGNAL(triggered()), editor, SLOT(newVectorLayer()));
    connect(ui->actionNew_Sound_Layer, SIGNAL(triggered()), editor, SLOT(newSoundLayer()));
    connect(ui->actionNew_Camera_Layer, SIGNAL(triggered()), editor, SLOT(newCameraLayer()));
    connect(ui->actionDelete_Current_Layer, SIGNAL(triggered()), editor, SLOT(deleteCurrentLayer()));

    /// --- View Menu ---
    connect(ui->actionZoom_In, SIGNAL(triggered()), editor, SLOT(setzoom()));
    connect(ui->actionZoom_Out, SIGNAL(triggered()), editor, SLOT(setzoom1()));
    connect(ui->actionRotate_Clockwise, SIGNAL(triggered()), editor, SLOT(rotatecw()));
    connect(ui->actionRotate_Anticlosewise, SIGNAL(triggered()), editor, SLOT(rotateacw()));
    connect(ui->actionReset_Windows, SIGNAL(triggered()), this, SLOT(dockAllPalettes()));
    connect(ui->actionReset_View, SIGNAL(triggered()), editor, SLOT(resetView()));
    connect(ui->actionHorizontal_Flip, SIGNAL(triggered()), editor, SLOT(toggleMirror()));
    connect(ui->actionVertical_Flip, SIGNAL(triggered()), editor, SLOT(toggleMirrorV()));

    ui->actionPreview->setEnabled(false);
    //#	connect(previewAct, SIGNAL(triggered()), editor, SLOT(getCameraLayer()));//TODO: Preview view

    ui->actionGrid->setEnabled(false);
    connect(ui->actionGrid, SIGNAL(triggered()), editor, SLOT(gridview())); //TODO: Grid view

    connect(ui->actionOnionPrevious, SIGNAL(triggered(bool)), editor, SIGNAL(toggleOnionPrev(bool)));
    connect(editor, SIGNAL(onionPrevChanged(bool)), ui->actionOnionPrevious, SLOT(setChecked(bool)));

    connect(ui->actionOnionNext, SIGNAL(triggered(bool)), editor, SIGNAL(toggleOnionNext(bool)));
    connect(editor, SIGNAL(onionNextChanged(bool)), ui->actionOnionNext, SLOT(setChecked(bool)));

    /// --- Animation Menu ---
    connect(ui->actionPlay, SIGNAL(triggered()), editor, SLOT(play()));
    connect(ui->actionLoop, SIGNAL(triggered(bool)), editor, SLOT(setLoop(bool)));
    connect(ui->actionLoop, SIGNAL(toggled(bool)), editor, SIGNAL(toggleLoop(bool))); //TODO: WTF?
    connect(editor, SIGNAL(loopToggled(bool)), ui->actionLoop, SLOT(setChecked(bool)));

    connect(ui->actionAdd_Frame, SIGNAL(triggered()), editor, SLOT(addKey()));
    connect(ui->actionRemove_Frame, SIGNAL(triggered()), editor, SLOT(removeKey()));
    connect(ui->actionNext_Frame, SIGNAL(triggered()), editor, SLOT(playNextFrame()));
    connect(ui->actionPrevious_Frame, SIGNAL(triggered()), editor, SLOT(playPrevFrame()));
    connect(ui->actionNext_Keyframe, SIGNAL(triggered()), editor, SLOT(scrubNextKeyframe()));
    connect(ui->actionPrev_Keyframe, SIGNAL(triggered()), editor, SLOT(scrubPreviousKeyframe()));
    connect(ui->actionDuplicate_Frame, SIGNAL(triggered()), editor, SLOT(duplicateKey()));

    /// --- Tool Menu ---
    connect(ui->actionClear, SIGNAL(triggered()), editor, SLOT(clearCurrentFrame()));

    connect(ui->actionMove, SIGNAL(triggered()), m_toolSet, SLOT(moveOn()));
    connect(ui->actionSelect, SIGNAL(triggered()), m_toolSet, SLOT(selectOn()));
    connect(ui->actionBrush, SIGNAL(triggered()), m_toolSet, SLOT(brushOn()));
    connect(ui->actionPolyline, SIGNAL(triggered()), m_toolSet, SLOT(polylineOn()));
    connect(ui->actionSmudge, SIGNAL(triggered()), m_toolSet, SLOT(smudgeOn()));
    connect(ui->actionPen, SIGNAL(triggered()), m_toolSet, SLOT(penOn()));
    connect(ui->actionHand, SIGNAL(triggered()), m_toolSet, SLOT(handOn()));
    connect(ui->actionPencil, SIGNAL(triggered()), m_toolSet, SLOT(pencilOn()));
    connect(ui->actionBucket, SIGNAL(triggered()), m_toolSet, SLOT(bucketOn()));
    connect(ui->actionEyedropper, SIGNAL(triggered()), m_toolSet, SLOT(eyedropperOn()));
    connect(ui->actionEraser, SIGNAL(triggered()), m_toolSet, SLOT(eraserOn()));

    connect(ui->actionResetToolsDefault, SIGNAL(triggered()), this, SLOT(resetToolsSettings()));

    /// --- Help Menu ---
    connect(ui->actionHelp, SIGNAL(triggered()), this, SLOT(helpBox()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(aboutPencil()));

    // --------------- Menus ------------------
    openRecentMenu = new QMenu(tr("Open recent"), this);

    connect(ui->menuEdit, SIGNAL(aboutToShow()), this, SLOT(undoActSetText()));
    connect(ui->menuEdit, SIGNAL(aboutToHide()), this, SLOT(undoActSetEnabled()));


}
Esempio n. 28
0
Fenetre::Fenetre(QWidget *parent) : courant(0), QMainWindow(parent)
{
    //*************************
    courant = NULL;
    folder = NULL;
    resize(1200, 512);
    //*************************** Menu ***************************
    QMenu* mFile = menuBar()->addMenu("&File");
    QMenu* mEdit = menuBar()->addMenu("&Edit");
    QMenu* mView = menuBar()->addMenu("&View");


    QMenu* mNouveau = mFile->addMenu("New");
    QAction* mactionAnnuler = mEdit->addAction("Annuler");
    QAction* mactionRefaire = mEdit->addAction("Refaire");
    QAction* mactionSupprimer = mEdit->addAction("Supprimer");
    QMenu* mTag = mEdit->addMenu("Tags");
    QAction* mactionSupprimerTag = mTag->addAction("Supprimer");
    QMenu* mDocument = mEdit->addMenu("Documents");
    QAction* mactionUp = mDocument->addAction("Monter");
    QAction* mactionDown = mDocument->addAction("Descendre");
    QMenu* mExport = mEdit->addMenu("Exporter");
    QAction* mactionOuvrir = mFile->addAction("Ouvrir un espace de travail");
    QAction* mactionNew = mFile->addAction("Nouvel espace de travail");
    QAction* mactionSaveAs = mFile->addAction("Enregistrer sous...");
    QAction* mactionNewArticle = mNouveau->addAction("Article");
    QAction* mactionNewImage = mNouveau->addAction("Image");
    QAction* mactionNewAudio = mNouveau->addAction("Audio");
    QAction* mactionNewVideo = mNouveau->addAction("Video");
    QAction* mactionNewDocument = mNouveau->addAction("Document");

    QAction* mactionExportHTML = mExport->addAction("Html");
    QAction* mactionExportTex = mExport->addAction("Tex");
    QAction* mactionExportTexte = mExport->addAction("Texte");
    QAction* mactionOption=mEdit->addAction("Setting");

    QAction* mactionAddTag = mNouveau->addAction("Tag");

    QAction* mactionSave = mFile->addAction("Sauvegarder");
    mFile->addSeparator();
    QMenu* ouvrirCorbeille = mFile->addMenu("Corbeille");
    QAction* mactionRestaurer = ouvrirCorbeille->addAction("Restaurer");
    QAction* mactionVider = ouvrirCorbeille->addAction("Vider la Corbeille");

    mactionViewEdit = mView->addAction("Onglet Editeur");
    mactionViewHTML = mView->addAction("Onglet Html");
    mactionViewTex = mView->addAction("Onglet Tex");
    mactionViewTexte = mView->addAction("Onglet Texte");

    mFile->addSeparator();
    QAction* actionQuitter = mFile->addAction("&Quitter");
    actionQuitter->setIcon(QIcon("icon/quitter.png"));
    mactionNewArticle->setIcon(QIcon("icon/article.png"));
    mactionNewImage->setIcon(QIcon("icon/image.png"));
    mactionNewAudio->setIcon(QIcon("icon/audio.png"));
    mactionNewVideo->setIcon(QIcon("icon/video.png"));
    mNouveau->setIcon(QIcon("icon/plus.png"));
    mactionDown->setIcon(QIcon("icon/down.png"));
    mactionUp->setIcon(QIcon("icon/up.png"));
    mactionAddTag->setIcon(QIcon("icon/tag.png"));
    mactionSave->setIcon(QIcon("icon/save.png"));

    mactionExportHTML->setIcon(QIcon("icon/html.png"));
    mactionExportTex->setIcon(QIcon("icon/tex.png"));
    mactionExportTexte->setIcon(QIcon("icon/texte.png"));

    mactionAnnuler->setIcon(QIcon("icon/undo.png"));
    mactionRefaire->setIcon(QIcon("icon/redo.png"));
    mactionSupprimer->setIcon(QIcon("icon/cross.png"));
    mactionRestaurer->setIcon(QIcon("icon/corbeille.png"));
    mactionNewDocument->setIcon(QIcon("icon/document.png"));
    mactionOption->setIcon(QIcon("icon/setting.png"));


    mactionOuvrir->setShortcut(QKeySequence("Ctrl+O"));
    actionQuitter->setShortcut(QKeySequence("Ctrl+Q"));
    mactionSave->setShortcut(QKeySequence("Ctrl+S"));

    mactionAnnuler->setShortcut(QKeySequence("Ctrl+Z"));
    mactionRefaire->setShortcut(QKeySequence("Ctrl+Y"));
    mactionSupprimer->setShortcut(tr("Delete"));

    //** VIEW **//
    mactionViewEdit->setCheckable(true);
    mactionViewEdit->setChecked(true);
    mactionViewHTML->setCheckable(true);
    mactionViewTex->setCheckable(true);
    mactionViewTexte->setCheckable(true);


    //Bar de statue
    QStatusBar* statusBar = new QStatusBar;
    statusBar->addWidget(new QLabel("Projet Lo21 - Pauline Crouillère / Emilien Notarianni"));
    this->setStatusBar(statusBar);
    // Création de la barre d'outils
    QToolBar *toolBarFichier = addToolBar("Fichier");

    toolBarFichier->addAction(mactionNewArticle);
    toolBarFichier->addAction(mactionNewImage);
    toolBarFichier->addAction(mactionNewAudio);
    toolBarFichier->addAction(mactionNewVideo);
    toolBarFichier->addAction(mactionNewDocument);
    toolBarFichier->addSeparator();
    toolBarFichier->addAction(mactionAddTag);
    toolBarFichier->addSeparator();
    toolBarFichier->addAction(mactionUp);
    toolBarFichier->addAction(mactionDown);
    toolBarFichier->addSeparator();

    toolBarFichier->addAction(mactionExportHTML);
    toolBarFichier->addAction(mactionExportTex);
    toolBarFichier->addAction(mactionExportTexte);
    toolBarFichier->addSeparator();
    toolBarFichier->addAction(mactionRestaurer);
    toolBarFichier->addSeparator();
    toolBarFichier->addAction(mactionSupprimer);
    toolBarFichier->addSeparator();
    toolBarFichier->addAction(actionQuitter);

    /*************************************************************/
    couche = new QHBoxLayout();
    lw = new LeftWindows();
    ow = new OngletWindows();
    couche->addWidget(lw);
    couche->addWidget(ow);
    couche->setMargin(0);
    couche->setAlignment(Qt::AlignTop);
    centerWindows = new QWidget();
    centerWindows->setLayout(couche);
    setCentralWidget(centerWindows);

    //************************** CONNECT **************************/
    QObject::connect(mactionNewArticle, SIGNAL(triggered()), this, SLOT(newArticle()));
    QObject::connect(mactionNewDocument, SIGNAL(triggered()), this, SLOT(newDocument()));
    QObject::connect(mactionNewImage, SIGNAL(triggered()), this, SLOT(newImage()));
    QObject::connect(mactionNewAudio, SIGNAL(triggered()), this, SLOT(newAudio()));
    QObject::connect(mactionNewVideo, SIGNAL(triggered()), this, SLOT(newVideo()));
    QObject::connect(mactionAddTag, SIGNAL(triggered()), this, SLOT(newTag()));
    QObject::connect(mactionOuvrir,SIGNAL(triggered()),this, SLOT(ouvrirDialogue()));
    QObject::connect(actionQuitter,SIGNAL(triggered()),qApp, SLOT(quit()));

    QObject::connect(mactionUp,SIGNAL(triggered()),this, SLOT(docUp()));
    QObject::connect(mactionDown,SIGNAL(triggered()),this, SLOT(docDown()));

    QObject::connect(mactionRestaurer, SIGNAL(triggered()), this, SLOT(ouvrirCorbeille()));

    QObject::connect(mactionSave, SIGNAL(triggered()), this, SLOT(asave()));

    QObject::connect(mactionExportHTML, SIGNAL(triggered()), this, SLOT(exportHTML()));
    QObject::connect(mactionExportTex, SIGNAL(triggered()), this, SLOT(exportTex()));
    QObject::connect(mactionExportTexte, SIGNAL(triggered()), this, SLOT(exportTexte()));

    QObject::connect(mactionSupprimer, SIGNAL(triggered()), this, SLOT(deleteInCorbeille()));
    QObject::connect(mactionVider, SIGNAL(triggered()), this, SLOT(viderLaCorbeille()));
    //TODO
    QObject::connect(mactionAnnuler, SIGNAL(triggered()), qApp, SLOT(undo()));
    QObject::connect(mactionRefaire, SIGNAL(triggered()), qApp, SLOT(redo()));
    //
    QObject::connect(mactionSaveAs, SIGNAL(triggered()), this, SLOT(copieWorkSpace()));
    QObject::connect(mactionNew, SIGNAL(triggered()), this, SLOT(newWorkSpace()));
    QObject::connect(mactionOption, SIGNAL(triggered()), this, SLOT(setting()));



    QObject::connect(mactionViewEdit, SIGNAL(triggered()), this, SLOT(changeEdit()));
    QObject::connect(mactionViewHTML, SIGNAL(triggered()), this, SLOT(changeHtml()));
    QObject::connect(mactionViewTex,SIGNAL(triggered()),this, SLOT(changeTex()));
    QObject::connect(mactionViewTexte,SIGNAL(triggered()),this, SLOT(changeTexte()));
    QObject::connect(ow, SIGNAL(currentChanged(int)), this, SLOT(changeOnglet(int)));
    QObject::connect(mactionSupprimerTag, SIGNAL(triggered()), this, SLOT(supprimeTag()));

}
Esempio n. 29
0
File: doc.cpp Progetto: speakman/qlc
bool Doc::loadWorkspaceAs(QString &fileName)
{
  bool success = false;

  QString buf;
  QString s;
  QString t;
  QList<QString> list;

  newDocument();

  if (FileHandler::readFileToList(fileName, list) == true)
    {
      m_workspaceFileName = QString(fileName);
      
      // Create devices and functions from the list
      for (QString* string = list.first(); string != NULL; string = list.next())
	{
	  if (*string == QString("Entry"))
	    {
	      string = list.next();
	      
	      if (*string == QString("Device"))
		{
		  DMXDevice* d = createDevice(list);
		  
		  if (d != NULL)
		    {
		      addDevice(d);
		    }
		}
	      else if (*string == QString("Function"))
		{
		  // Only create the function but don't care for
		  // its contents yet
		  Function* f = createFunction(list);

		  if (f != NULL)
		    {
		      // Add function to function pool
		      addFunction(f);
		    }
		}
	      else if (*string == QString("Bus"))
		{
		  Bus* bus = new Bus();
		  bus->createContents(list);
		  addBus(bus);

		  _app->virtualConsole()->setDefaultSpeedBus(bus);
		}
	      else if (*string == QString("Joystick"))
		{
		  createJoystickContents(list);
		}
	      else if (*string == QString("Virtual Console"))
		{
		  // Virtual console wants it all, go to "Entry"
		  list.prev();
		  list.prev();

		  _app->virtualConsole()->createContents(list);
		}
	      else
		{
		  // Unknown keyword, do nothing
		}
	    }
	}

      // Now put contents to functions
      // The functions are given their contents after every function
      // object has been created. Otherwise some functions can not
      // be created.
      for (QString* string = list.first(); string != NULL; string = list.next())
	{
	  if (*string == QString("Entry"))
	    {
	      string = list.next();
	      if (*string == QString("Function"))
		{
		  createFunctionContents(list);
		}
	      else
		{
		  // Reel back one step, it might contain the keyword
		  // "Entry"
		  string = list.prev();
		}
	    }
	}

      success = true;
    }
  else
    {
      success = false;
    }
  
  setModified(false);

  return success;
}
Esempio n. 30
0
CMagnumWin::CMagnumWin() : m_shortcutFind( this ){

    m_documentTabs.setTabsClosable( true );
    connect( &m_documentTabs , SIGNAL(tabCloseRequested(int)) , this , SLOT(tabClose(int)) );
    connect( &m_documentTabs , SIGNAL(currentChanged(int)) , this , SLOT(currentDocumentChanged(int)) );
    setCentralWidget( &m_documentTabs );

    QMenu* file = m_mainMenu.addMenu( "File" );
    connect( file->addAction( "New" ) , SIGNAL(triggered()) , this , SLOT(newDocument()) );
    connect( file->addAction( "Open" ) , SIGNAL(triggered()) , this , SLOT(loadDocument()) );

    m_menuLastOpened.setTitle("Open recent");
    connect( &m_menuLastOpened , SIGNAL(triggered(QAction*)) , this , SLOT(lastOpened_Action(QAction*)) );
    file->addMenu( &m_menuLastOpened );
    file->addSeparator();

    connect( file->addAction( "Save" ) , SIGNAL(triggered()) , this , SLOT(saveCurrentDocument()) );
    connect( file->addAction( "Save As..." ) , SIGNAL(triggered()) , this , SLOT(saveCurrentDocumentAs()) );
    connect( file->addAction( "Save All" ) , SIGNAL(triggered()) , this , SLOT(saveAllDocument()) );

    file->addSeparator();
    connect( file->addAction( "Close" ) , SIGNAL(triggered()) , this , SLOT(closeCurrentDocument()) );
    connect( file->addAction( "Close All" ) , SIGNAL(triggered()) , this , SLOT(closeAllDocument()) );

    file->addSeparator();
    connect( file->addAction( tr( "About" ) ) , SIGNAL(triggered()) , this , SLOT(aboutDialog()) );

    setMenuBar( &m_mainMenu );

    m_mainToolbar.setObjectName( "mainWindowToolBar" );

    connect( m_mainToolbar.addAction( QIcon(":doc_new") , "New" ) , SIGNAL(triggered()) , this , SLOT(newDocument()) );
    connect( m_mainToolbar.addAction( QIcon(":doc_open") , "Open" ) , SIGNAL(triggered()) , this , SLOT(loadDocument()) );
    connect( m_mainToolbar.addAction( QIcon(":doc_filesave") , "Save" ) , SIGNAL(triggered()) , this , SLOT(saveCurrentDocument()) );
    connect( m_mainToolbar.addAction( QIcon(":doc_filesaveas") , "Save as..." ) , SIGNAL(triggered()) , this , SLOT(saveCurrentDocumentAs()) );
    connect( m_mainToolbar.addAction( QIcon(":doc_filesaveall") , "Save All" ) , SIGNAL(triggered()) , this , SLOT(saveAllDocument()) );

    //connect( m_mainToolbar.addAction("TEST") , SIGNAL(triggered()) , this , SLOT(testEvent()) );

    addToolBar( &m_mainToolbar );

    m_findWidget = new CFindWindow( this );
    connect( m_findWidget , SIGNAL(goTo(CDocument*,int)),this,SLOT(findWin_goTo(CDocument*,int)));
    addDockWidget( Qt::LeftDockWidgetArea , m_findWidget );

    newDocument();

    m_projectManager = new CProject( this );
    connect( m_projectManager, SIGNAL(gotoDocumentLine(CDocument*,int)), this, SLOT(findWin_goTo(CDocument*,int)) );
    addDockWidget( Qt::LeftDockWidgetArea, m_projectManager );

    m_shortcutFind.setKey( Qt::CTRL + Qt::Key_F );
    connect( &m_shortcutFind , SIGNAL(activated()) , this , SLOT( shortcutFind() ) );

    loadSettings();

    connect( &m_fileSystemNotification , SIGNAL(fileChanged(QString)) ,
             this , SLOT(fsNotify(QString)) );

    QString aboutString( "Magnum\n" );
    aboutString += "Kuka software editor\nRelease: 0.1\n\n";
    aboutString += "For information or suggestion contact [email protected]";

    m_aboutDialog = new CAboutWindow( ":PROGICO" , aboutString , this );

    setAcceptDrops( true );
}