Mercurial > hg > octave-lyh
comparison gui/src/editor/FileEditor.cpp @ 14681:66ff321cb62e gui
Integrated the editor to be docked with the other widgets.
* FilesDockWidget: Some code style corrections.
* MainWindow: Added a checkable menu entry for the editor and added file editor as dockable widget.
* FileEditor: Moved setting the object name to the interface.
* FileEditorInterface: Added routines to correctly handle closing and opening the dock widget.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Thu, 24 May 2012 13:20:27 +0200 |
parents | 628eeaf879f7 |
children | ca733a66be7a |
comparison
equal
deleted
inserted
replaced
14680:628eeaf879f7 | 14681:66ff321cb62e |
---|---|
251 } | 251 } |
252 | 252 |
253 void | 253 void |
254 FileEditor::construct () | 254 FileEditor::construct () |
255 { | 255 { |
256 QWidget *widget = new QWidget (this); | |
256 QSettings *settings = ResourceManager::instance ()->settings (); | 257 QSettings *settings = ResourceManager::instance ()->settings (); |
257 QStyle *style = QApplication::style (); | 258 QStyle *style = QApplication::style (); |
258 | 259 |
259 m_menuBar = new QMenuBar (this); | 260 m_menuBar = new QMenuBar (widget); |
260 m_toolBar = new QToolBar (this); | 261 m_toolBar = new QToolBar (widget); |
261 m_tabWidget = new QTabWidget (this); | 262 m_tabWidget = new QTabWidget (widget); |
262 m_tabWidget->setTabsClosable (true); | 263 m_tabWidget->setTabsClosable (true); |
263 //m_longTitle = settings->value ("editor/longWindowTitle",true).toBool (); | 264 //m_longTitle = settings->value ("editor/longWindowTitle",true).toBool (); |
264 | 265 |
265 // Theme icons with QStyle icons as fallback | 266 // Theme icons with QStyle icons as fallback |
266 QAction *newAction = new QAction ( | 267 QAction *newAction = new QAction ( |
285 | 286 |
286 QAction *redoAction = new QAction ( | 287 QAction *redoAction = new QAction ( |
287 QIcon::fromTheme("edit-redo",style->standardIcon (QStyle::SP_ArrowRight)), | 288 QIcon::fromTheme("edit-redo",style->standardIcon (QStyle::SP_ArrowRight)), |
288 tr("&Redo"), m_toolBar); | 289 tr("&Redo"), m_toolBar); |
289 | 290 |
290 m_copyAction = new QAction (QIcon::fromTheme("edit-copy"), tr("&Copy"),m_toolBar); | 291 m_copyAction = new QAction (QIcon::fromTheme ("edit-copy"), tr ("&Copy"), m_toolBar); |
291 m_cutAction = new QAction (QIcon::fromTheme("edit-cut"), tr("Cu&t"),m_toolBar); | 292 m_cutAction = new QAction (QIcon::fromTheme ("edit-cut"), tr ("Cu&t"), m_toolBar); |
292 | 293 |
293 QAction *pasteAction = new QAction (QIcon::fromTheme ("edit-paste"), tr ("&Paste"),m_toolBar); | 294 QAction *pasteAction = new QAction (QIcon::fromTheme ("edit-paste"), tr ("&Paste"),m_toolBar); |
294 QAction *nextBookmarkAction = new QAction (tr ("&Next Bookmark"),m_toolBar); | 295 QAction *nextBookmarkAction = new QAction (tr ("&Next Bookmark"),m_toolBar); |
295 QAction *prevBookmarkAction = new QAction (tr ("Pre&vious Bookmark"),m_toolBar); | 296 QAction *prevBookmarkAction = new QAction (tr ("Pre&vious Bookmark"),m_toolBar); |
296 QAction *toggleBookmarkAction = new QAction (tr ("Toggle &Bookmark"),m_toolBar); | 297 QAction *toggleBookmarkAction = new QAction (tr ("Toggle &Bookmark"),m_toolBar); |
370 QVBoxLayout *layout = new QVBoxLayout (); | 371 QVBoxLayout *layout = new QVBoxLayout (); |
371 layout->addWidget (m_menuBar); | 372 layout->addWidget (m_menuBar); |
372 layout->addWidget (m_toolBar); | 373 layout->addWidget (m_toolBar); |
373 layout->addWidget (m_tabWidget); | 374 layout->addWidget (m_tabWidget); |
374 layout->setMargin (0); | 375 layout->setMargin (0); |
375 setLayout (layout); | 376 widget->setLayout (layout); |
377 setWidget (widget); | |
376 | 378 |
377 connect (newAction, SIGNAL (triggered ()), this, SLOT (requestNewFile ())); | 379 connect (newAction, SIGNAL (triggered ()), this, SLOT (requestNewFile ())); |
378 connect (openAction, SIGNAL (triggered ()), this, SLOT (requestOpenFile ())); | 380 connect (openAction, SIGNAL (triggered ()), this, SLOT (requestOpenFile ())); |
379 connect (undoAction, SIGNAL (triggered ()), this, SLOT (requestUndo ())); | 381 connect (undoAction, SIGNAL (triggered ()), this, SLOT (requestUndo ())); |
380 connect (redoAction, SIGNAL (triggered ()), this, SLOT (requestRedo ())); | 382 connect (redoAction, SIGNAL (triggered ()), this, SLOT (requestRedo ())); |