Reorganized toolbars in preparation for tabbed interface.
This commit is contained in:
+55
-80
@@ -55,24 +55,19 @@ namespace glabels
|
|||||||
///
|
///
|
||||||
MainWindow::MainWindow()
|
MainWindow::MainWindow()
|
||||||
{
|
{
|
||||||
QWidget* editorPage = new QWidget;
|
|
||||||
|
|
||||||
mView = new View();
|
mView = new View();
|
||||||
mObjectEditor = new ObjectEditor();
|
mObjectEditor = new ObjectEditor();
|
||||||
|
|
||||||
QHBoxLayout* editorLayout = new QHBoxLayout;
|
|
||||||
editorLayout->addWidget( mView );
|
|
||||||
editorLayout->addWidget( mObjectEditor );
|
|
||||||
editorPage->setLayout( editorLayout );
|
|
||||||
|
|
||||||
setCentralWidget( editorPage );
|
|
||||||
mModel = 0;
|
|
||||||
|
|
||||||
createActions();
|
createActions();
|
||||||
createMenus();
|
createMenus();
|
||||||
createToolBars();
|
createToolBars();
|
||||||
createStatusBar();
|
createStatusBar();
|
||||||
|
|
||||||
|
QWidget* editorPage = createEditorPage();
|
||||||
|
|
||||||
|
setCentralWidget( editorPage );
|
||||||
|
mModel = 0;
|
||||||
|
|
||||||
setDocVerbsEnabled( false );
|
setDocVerbsEnabled( false );
|
||||||
setPasteVerbsEnabled( false );
|
setPasteVerbsEnabled( false );
|
||||||
setTitle();
|
setTitle();
|
||||||
@@ -267,20 +262,11 @@ namespace glabels
|
|||||||
viewFileToolBarAction->setStatusTip( tr("Change visibility of file toolbar in current window") );
|
viewFileToolBarAction->setStatusTip( tr("Change visibility of file toolbar in current window") );
|
||||||
connect( viewFileToolBarAction, SIGNAL(toggled(bool)), this, SLOT(viewFileToolBar(bool)) );
|
connect( viewFileToolBarAction, SIGNAL(toggled(bool)), this, SLOT(viewFileToolBar(bool)) );
|
||||||
|
|
||||||
viewObjectsToolBarAction = new QAction( tr("Objects"), this );
|
viewEditorToolBarAction = new QAction( tr("Editor"), this );
|
||||||
viewObjectsToolBarAction->setCheckable( true );
|
viewEditorToolBarAction->setCheckable( true );
|
||||||
viewObjectsToolBarAction->setStatusTip( tr("Change visibility of objects toolbar in current window") );
|
viewEditorToolBarAction->setStatusTip( tr("Change visibility of editor toolbar in current window") );
|
||||||
connect( viewObjectsToolBarAction, SIGNAL(toggled(bool)), this, SLOT(viewObjectsToolBar(bool)) );
|
connect( viewEditorToolBarAction, SIGNAL(toggled(bool)), this, SLOT(viewEditorToolBar(bool)) );
|
||||||
|
|
||||||
viewEditToolBarAction = new QAction( tr("Edit"), this );
|
|
||||||
viewEditToolBarAction->setCheckable( true );
|
|
||||||
viewEditToolBarAction->setStatusTip( tr("Change visibility of edit toolbar in current window") );
|
|
||||||
connect( viewEditToolBarAction, SIGNAL(toggled(bool)), this, SLOT(viewEditToolBar(bool)) );
|
|
||||||
|
|
||||||
viewViewToolBarAction = new QAction( tr("View"), this );
|
|
||||||
viewViewToolBarAction->setCheckable( true );
|
|
||||||
viewViewToolBarAction->setStatusTip( tr("Change visibility of view toolbar in current window") );
|
|
||||||
connect( viewViewToolBarAction, SIGNAL(toggled(bool)), this, SLOT(viewViewToolBar(bool)) );
|
|
||||||
|
|
||||||
viewGridAction = new QAction( tr("Grid"), this );
|
viewGridAction = new QAction( tr("Grid"), this );
|
||||||
viewGridAction->setCheckable( true );
|
viewGridAction->setCheckable( true );
|
||||||
@@ -477,9 +463,7 @@ namespace glabels
|
|||||||
viewMenu = menuBar()->addMenu( tr("&View") );
|
viewMenu = menuBar()->addMenu( tr("&View") );
|
||||||
viewToolBarsMenu = viewMenu->addMenu( tr("Toolbars") );
|
viewToolBarsMenu = viewMenu->addMenu( tr("Toolbars") );
|
||||||
viewToolBarsMenu->addAction( viewFileToolBarAction );
|
viewToolBarsMenu->addAction( viewFileToolBarAction );
|
||||||
viewToolBarsMenu->addAction( viewObjectsToolBarAction );
|
viewToolBarsMenu->addAction( viewEditorToolBarAction );
|
||||||
viewToolBarsMenu->addAction( viewEditToolBarAction );
|
|
||||||
viewToolBarsMenu->addAction( viewViewToolBarAction );
|
|
||||||
viewMenu->addSeparator();
|
viewMenu->addSeparator();
|
||||||
viewMenu->addAction( viewGridAction );
|
viewMenu->addAction( viewGridAction );
|
||||||
viewMenu->addAction( viewMarkupAction );
|
viewMenu->addAction( viewMarkupAction );
|
||||||
@@ -539,28 +523,24 @@ namespace glabels
|
|||||||
fileToolBar->addSeparator();
|
fileToolBar->addSeparator();
|
||||||
fileToolBar->addAction( filePrintAction );
|
fileToolBar->addAction( filePrintAction );
|
||||||
|
|
||||||
objectsToolBar = addToolBar( tr("&Objects") );
|
editorToolBar = new QToolBar( tr("&Editor") );
|
||||||
objectsToolBar->addAction( objectsArrowModeAction );
|
editorToolBar->addAction( objectsArrowModeAction );
|
||||||
objectsToolBar->addSeparator();
|
editorToolBar->addSeparator();
|
||||||
objectsToolBar->addAction( objectsCreateTextAction );
|
editorToolBar->addAction( objectsCreateTextAction );
|
||||||
objectsToolBar->addAction( objectsCreateBoxAction );
|
editorToolBar->addAction( objectsCreateBoxAction );
|
||||||
objectsToolBar->addAction( objectsCreateLineAction );
|
editorToolBar->addAction( objectsCreateLineAction );
|
||||||
objectsToolBar->addAction( objectsCreateEllipseAction );
|
editorToolBar->addAction( objectsCreateEllipseAction );
|
||||||
objectsToolBar->addAction( objectsCreateImageAction );
|
editorToolBar->addAction( objectsCreateImageAction );
|
||||||
objectsToolBar->addAction( objectsCreateBarcodeAction );
|
editorToolBar->addAction( objectsCreateBarcodeAction );
|
||||||
objectsToolBar->addSeparator();
|
editorToolBar->addSeparator();
|
||||||
objectsToolBar->addAction( objectsMergePropertiesAction );
|
editorToolBar->addAction( editCutAction );
|
||||||
|
editorToolBar->addAction( editCopyAction );
|
||||||
editToolBar = addToolBar( tr("&Edit") );
|
editorToolBar->addAction( editPasteAction );
|
||||||
editToolBar->addAction( editCutAction );
|
editorToolBar->addSeparator();
|
||||||
editToolBar->addAction( editCopyAction );
|
editorToolBar->addAction( viewZoomInAction );
|
||||||
editToolBar->addAction( editPasteAction );
|
editorToolBar->addAction( viewZoomOutAction );
|
||||||
|
editorToolBar->addAction( viewZoom1To1Action );
|
||||||
viewToolBar = addToolBar( tr("&View") );
|
editorToolBar->addAction( viewZoomToFitAction );
|
||||||
viewToolBar->addAction( viewZoomInAction );
|
|
||||||
viewToolBar->addAction( viewZoomOutAction );
|
|
||||||
viewToolBar->addAction( viewZoom1To1Action );
|
|
||||||
viewToolBar->addAction( viewZoomToFitAction );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -591,6 +571,27 @@ namespace glabels
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Create Editor Page
|
||||||
|
///
|
||||||
|
QWidget* MainWindow::createEditorPage()
|
||||||
|
{
|
||||||
|
QWidget* page = new QWidget;
|
||||||
|
|
||||||
|
QVBoxLayout* editorVLayout = new QVBoxLayout;
|
||||||
|
editorVLayout->addWidget( editorToolBar );
|
||||||
|
editorVLayout->addWidget( mView );
|
||||||
|
|
||||||
|
QHBoxLayout* editorHLayout = new QHBoxLayout;
|
||||||
|
editorHLayout->addLayout( editorVLayout );
|
||||||
|
editorHLayout->addWidget( mObjectEditor );
|
||||||
|
|
||||||
|
page->setLayout( editorHLayout );
|
||||||
|
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Set enabled state of actions associated with a document.
|
/// Set enabled state of actions associated with a document.
|
||||||
///
|
///
|
||||||
@@ -733,24 +734,18 @@ namespace glabels
|
|||||||
|
|
||||||
settings.beginGroup( "MainWindow" );
|
settings.beginGroup( "MainWindow" );
|
||||||
bool showFileToolBar = settings.value( "showFileToolBar", true ).toBool();
|
bool showFileToolBar = settings.value( "showFileToolBar", true ).toBool();
|
||||||
bool showObjectsToolBar = settings.value( "showObjectsToolBar", true ).toBool();
|
bool showEditorToolBar = settings.value( "showEditToolBar", true ).toBool();
|
||||||
bool showEditToolBar = settings.value( "showEditToolBar", true ).toBool();
|
|
||||||
bool showViewToolBar = settings.value( "showViewToolBar", true ).toBool();
|
|
||||||
bool showGrid = settings.value( "showGrid", true ).toBool();
|
bool showGrid = settings.value( "showGrid", true ).toBool();
|
||||||
bool showMarkup = settings.value( "showMarkup", true ).toBool();
|
bool showMarkup = settings.value( "showMarkup", true ).toBool();
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
viewFileToolBarAction ->setChecked( showFileToolBar );
|
viewFileToolBarAction ->setChecked( showFileToolBar );
|
||||||
viewObjectsToolBarAction->setChecked( showObjectsToolBar );
|
viewEditorToolBarAction ->setChecked( showEditorToolBar );
|
||||||
viewEditToolBarAction ->setChecked( showEditToolBar );
|
|
||||||
viewViewToolBarAction ->setChecked( showViewToolBar );
|
|
||||||
viewGridAction ->setChecked( showGrid );
|
viewGridAction ->setChecked( showGrid );
|
||||||
viewMarkupAction ->setChecked( showMarkup );
|
viewMarkupAction ->setChecked( showMarkup );
|
||||||
|
|
||||||
fileToolBar ->setVisible( showFileToolBar );
|
fileToolBar ->setVisible( showFileToolBar );
|
||||||
objectsToolBar->setVisible( showObjectsToolBar );
|
editorToolBar ->setVisible( showEditorToolBar );
|
||||||
editToolBar ->setVisible( showEditToolBar );
|
|
||||||
viewToolBar ->setVisible( showViewToolBar );
|
|
||||||
mView ->setGridVisible( showGrid );
|
mView ->setGridVisible( showGrid );
|
||||||
mView ->setMarkupVisible( showMarkup );
|
mView ->setMarkupVisible( showMarkup );
|
||||||
}
|
}
|
||||||
@@ -765,9 +760,7 @@ namespace glabels
|
|||||||
|
|
||||||
settings.beginGroup( "MainWindow" );
|
settings.beginGroup( "MainWindow" );
|
||||||
settings.setValue( "showFileToolBar", viewFileToolBarAction->isChecked() );
|
settings.setValue( "showFileToolBar", viewFileToolBarAction->isChecked() );
|
||||||
settings.setValue( "showObjectsToolBar", viewObjectsToolBarAction->isChecked() );
|
settings.setValue( "showEditorToolBar", viewEditorToolBarAction->isChecked() );
|
||||||
settings.setValue( "showEditToolBar", viewEditToolBarAction->isChecked() );
|
|
||||||
settings.setValue( "showViewToolBar", viewViewToolBarAction->isChecked() );
|
|
||||||
settings.setValue( "showGrid", viewGridAction->isChecked() );
|
settings.setValue( "showGrid", viewGridAction->isChecked() );
|
||||||
settings.setValue( "showMarkup", viewMarkupAction->isChecked() );
|
settings.setValue( "showMarkup", viewMarkupAction->isChecked() );
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
@@ -948,27 +941,9 @@ namespace glabels
|
|||||||
///
|
///
|
||||||
/// View->Objects Tool Bar Toggle Action
|
/// View->Objects Tool Bar Toggle Action
|
||||||
///
|
///
|
||||||
void MainWindow::viewObjectsToolBar( bool state )
|
void MainWindow::viewEditorToolBar( bool state )
|
||||||
{
|
{
|
||||||
objectsToolBar->setVisible( state );
|
editorToolBar->setVisible( state );
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// View->Edit Tool Bar Toggle Action
|
|
||||||
///
|
|
||||||
void MainWindow::viewEditToolBar( bool state )
|
|
||||||
{
|
|
||||||
editToolBar->setVisible( state );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// View->View Tool Bar Toggle Action
|
|
||||||
///
|
|
||||||
void MainWindow::viewViewToolBar( bool state )
|
|
||||||
{
|
|
||||||
viewToolBar->setVisible( state );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -98,9 +98,7 @@ namespace glabels
|
|||||||
void editPreferences();
|
void editPreferences();
|
||||||
|
|
||||||
void viewFileToolBar( bool );
|
void viewFileToolBar( bool );
|
||||||
void viewObjectsToolBar( bool );
|
void viewEditorToolBar( bool );
|
||||||
void viewEditToolBar( bool );
|
|
||||||
void viewViewToolBar( bool );
|
|
||||||
void viewGrid( bool );
|
void viewGrid( bool );
|
||||||
void viewMarkup( bool );
|
void viewMarkup( bool );
|
||||||
void viewZoomIn();
|
void viewZoomIn();
|
||||||
@@ -153,6 +151,8 @@ namespace glabels
|
|||||||
void createToolBars();
|
void createToolBars();
|
||||||
void createStatusBar();
|
void createStatusBar();
|
||||||
|
|
||||||
|
QWidget* createEditorPage();
|
||||||
|
|
||||||
void setDocVerbsEnabled( bool );
|
void setDocVerbsEnabled( bool );
|
||||||
void setDocModifiedVerbsEnabled( bool );
|
void setDocModifiedVerbsEnabled( bool );
|
||||||
void setPasteVerbsEnabled( bool );
|
void setPasteVerbsEnabled( bool );
|
||||||
@@ -184,9 +184,7 @@ namespace glabels
|
|||||||
QMenu* helpMenu;
|
QMenu* helpMenu;
|
||||||
|
|
||||||
QToolBar* fileToolBar;
|
QToolBar* fileToolBar;
|
||||||
QToolBar* objectsToolBar;
|
QToolBar* editorToolBar;
|
||||||
QToolBar* editToolBar;
|
|
||||||
QToolBar* viewToolBar;
|
|
||||||
|
|
||||||
LabelModel* mModel;
|
LabelModel* mModel;
|
||||||
View* mView;
|
View* mView;
|
||||||
@@ -216,9 +214,7 @@ namespace glabels
|
|||||||
QAction* editPreferencesAction;
|
QAction* editPreferencesAction;
|
||||||
|
|
||||||
QAction* viewFileToolBarAction;
|
QAction* viewFileToolBarAction;
|
||||||
QAction* viewObjectsToolBarAction;
|
QAction* viewEditorToolBarAction;
|
||||||
QAction* viewEditToolBarAction;
|
|
||||||
QAction* viewViewToolBarAction;
|
|
||||||
QAction* viewGridAction;
|
QAction* viewGridAction;
|
||||||
QAction* viewMarkupAction;
|
QAction* viewMarkupAction;
|
||||||
QAction* viewZoomInAction;
|
QAction* viewZoomInAction;
|
||||||
|
|||||||
Reference in New Issue
Block a user