Commit d031db85 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

MainWindow: Cut and select tool are now in the toolbar (and the menu)

parent ab476658
......@@ -91,6 +91,7 @@ MainWindow::MainWindow( QWidget *parent ) :
createGlobalPreferences();
createProjectPreferences();
initializeDockWidgets();
initToolbar();
createStatusBar();
#ifdef WITH_CRASHBUTTON
setupCrashTester();
......@@ -176,14 +177,6 @@ void
MainWindow::initVlmcPreferences()
{
//Setup VLMC Keyboard Preference...
VLMC_CREATE_PREFERENCE_KEYBOARD( "keyboard/defaultmode", "n",
QT_TRANSLATE_NOOP( "PreferenceWidget", "Select mode" ),
QT_TRANSLATE_NOOP( "PreferenceWidget", "Select the selection tool in the timeline" ) );
VLMC_CREATE_PREFERENCE_KEYBOARD( "keyboard/cutmode", "x",
QT_TRANSLATE_NOOP( "PreferenceWidget", "Cut mode" ),
QT_TRANSLATE_NOOP( "PreferenceWidget", "Select the cut/razor tool in the timeline" ) );
VLMC_CREATE_PREFERENCE_KEYBOARD( "keyboard/mediapreview", "Ctrl+Return",
QT_TRANSLATE_NOOP( "PreferenceWidget", "Media preview" ),
QT_TRANSLATE_NOOP( "PreferenceWidget", "Preview the selected media, or pause the current preview" ) );
......@@ -252,6 +245,14 @@ MainWindow::initVlmcPreferences()
QT_TRANSLATE_NOOP( "PreferenceWidget", "Render the project" ),
QT_TRANSLATE_NOOP( "PreferenceWidget", "Render the project to a file" ), actionRender );
CREATE_MENU_SHORTCUT( "keyboard/defaultmode", "n",
QT_TRANSLATE_NOOP( "PreferenceWidget", "Selection mode" ),
QT_TRANSLATE_NOOP( "PreferenceWidget", "Select the selection tool in the timeline" ), actionSelection_mode );
CREATE_MENU_SHORTCUT( "keyboard/cutmode", "x",
QT_TRANSLATE_NOOP( "PreferenceWidget", "Cut mode" ),
QT_TRANSLATE_NOOP( "PreferenceWidget", "Select the cut/razor tool in the timeline" ), actionCut_mode );
//Setup VLMC Lang. Preferences...
VLMC_CREATE_PREFERENCE_LANGUAGE( "general/VLMCLang", "default",
QT_TRANSLATE_NOOP( "PreferenceWidget", "Language" ),
......@@ -380,38 +381,6 @@ MainWindow::createStatusBar()
//Notifications:
createNotificationZone();
// Mouse (default) tool
QToolButton* mouseTool = new QToolButton( this );
mouseTool->setAutoRaise( true );
mouseTool->setCheckable( true );
mouseTool->setIcon( QIcon( ":/images/mouse" ) );
mouseTool->setStatusTip( tr( "Use the mouse tool to manipulate regions in the timeline" ) );
m_ui.statusbar->addPermanentWidget( mouseTool );
// Cut/Split tool
QToolButton* splitTool = new QToolButton( this );
splitTool->setAutoRaise( true );
splitTool->setCheckable( true );
splitTool->setIcon( QIcon( ":/images/editcut" ) );
splitTool->setStatusTip( tr( "Use the scissors to cut regions in the timeline" ) );
m_ui.statusbar->addPermanentWidget( splitTool );
// Group the two previous buttons
QButtonGroup* toolButtonGroup = new QButtonGroup( this );
toolButtonGroup->addButton( mouseTool, TOOL_DEFAULT);
toolButtonGroup->addButton( splitTool, TOOL_CUT );
toolButtonGroup->setExclusive( true );
mouseTool->setChecked( true );
//Shortcut part:
KeyboardShortcutHelper* defaultModeShortcut = new KeyboardShortcutHelper( "keyboard/defaultmode", this );
KeyboardShortcutHelper* cutModeShortcut = new KeyboardShortcutHelper( "keyboard/cutmode", this );
connect( defaultModeShortcut, SIGNAL( activated() ), mouseTool, SLOT( click() ) );
connect( cutModeShortcut, SIGNAL( activated() ), splitTool, SLOT( click() ) );
connect( toolButtonGroup, SIGNAL( buttonClicked( int ) ),
this, SLOT( toolButtonClicked( int ) ) );
// Spacer
QWidget* spacer = new QWidget( this );
spacer->setFixedWidth( 20 );
......@@ -489,6 +458,19 @@ MainWindow::initializeDockWidgets( void )
setupLibrary();
}
void
MainWindow::initToolbar()
{
QActionGroup *mouseActions = new QActionGroup( m_ui.toolBar );
mouseActions->addAction( m_ui.actionSelection_mode );
mouseActions->addAction( m_ui.actionCut_mode );
m_ui.actionSelection_mode->setChecked( true );
m_ui.toolBar->addActions( mouseActions->actions() );
connect( mouseActions, SIGNAL( triggered(QAction*) ),
this, SLOT( toolButtonClicked( QAction* ) ) );
m_ui.menuTools->addActions( mouseActions->actions() );
}
void
MainWindow::createGlobalPreferences()
{
......@@ -679,9 +661,14 @@ MainWindow::registerWidgetInWindowMenu( QDockWidget* widget )
}
void
MainWindow::toolButtonClicked( int id )
MainWindow::toolButtonClicked( QAction *action )
{
emit toolChanged( (ToolButtons)id );
if ( action == m_ui.actionSelection_mode )
emit toolChanged( TOOL_DEFAULT );
else if ( action == m_ui.actionCut_mode )
emit toolChanged( TOOL_CUT );
else
qCritical() << "Unknown tool. This should not happen !";
}
void
......
......@@ -68,6 +68,7 @@ private:
void createProjectPreferences();
void initVlmcPreferences();
void loadVlmcPreferences( const QString& subPart );
void initToolbar();
#ifdef WITH_CRASHBUTTON
void setupCrashTester();
#endif
......@@ -125,7 +126,7 @@ private slots:
void on_actionRedo_triggered();
void on_actionCrash_triggered();
void on_actionImport_triggered();
void toolButtonClicked( int id );
void toolButtonClicked( QAction *action );
void projectUpdated( const QString& projectName, bool savedStatus );
void canUndoChanged( bool canUndo );
void canRedoChanged( bool canRedo );
......
......@@ -40,12 +40,6 @@
<addaction name="actionPreferences"/>
<addaction name="actionProject_Preferences"/>
</widget>
<widget class="QMenu" name="menuView">
<property name="title">
<string>&amp;View</string>
</property>
<addaction name="actionFullscreen"/>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>&amp;Help</string>
......@@ -54,11 +48,6 @@
<addaction name="separator"/>
<addaction name="actionAbout"/>
</widget>
<widget class="QMenu" name="menuWindow">
<property name="title">
<string>&amp;Window</string>
</property>
</widget>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>&amp;File</string>
......@@ -83,8 +72,25 @@
<addaction name="separator"/>
<addaction name="actionQuit"/>
</widget>
<widget class="QMenu" name="menuWindow">
<property name="title">
<string>&amp;Window</string>
</property>
</widget>
<widget class="QMenu" name="menuView">
<property name="title">
<string>&amp;View</string>
</property>
<addaction name="actionFullscreen"/>
</widget>
<widget class="QMenu" name="menuTools">
<property name="title">
<string>Tools</string>
</property>
</widget>
<addaction name="menuFile"/>
<addaction name="menuEdit"/>
<addaction name="menuTools"/>
<addaction name="menuView"/>
<addaction name="menuWindow"/>
<addaction name="menuHelp"/>
......@@ -116,6 +122,7 @@
<addaction name="actionPreferences"/>
<addaction name="actionProject_Preferences"/>
<addaction name="actionFullscreen"/>
<addaction name="separator"/>
</widget>
<action name="actionAbout">
<property name="icon">
......@@ -295,6 +302,39 @@
<string>&amp;Quit</string>
</property>
</action>
<action name="actionSelection_mode">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../../resources.qrc">
<normaloff>:/images/mouse</normaloff>:/images/mouse</iconset>
</property>
<property name="text">
<string>Selection mode</string>
</property>
<property name="toolTip">
<string>Use the mouse tool to manipulate regions in the timeline</string>
</property>
<property name="statusTip">
<string>Use the mouse tool to manipulate regions in the timeline</string>
</property>
</action>
<action name="actionCut_mode">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../../resources.qrc">
<normaloff>:/images/editcut</normaloff>:/images/editcut</iconset>
</property>
<property name="text">
<string>Cut mode</string>
</property>
<property name="toolTip">
<string>Use the scissors to cut regions in the timeline</string>
</property>
</action>
</widget>
<resources>
<include location="../../../resources.qrc"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment