Commit dcae1998 authored by Edward Wang's avatar Edward Wang Committed by Jean-Baptiste Kempf

Qt: Allow fullscreen controller to be stacked at the bottom

Close #3120
Modified-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 8691e5de
......@@ -34,6 +34,7 @@
#include "dialogs_provider.hpp" /* Opening Dialogs */
#include "input_manager.hpp"
#include "main_interface.hpp" /* Show playlist */
#include "components/controller.hpp" /* Toggle FSC controller width */
ActionsManager * ActionsManager::instance = NULL;
......@@ -93,6 +94,10 @@ void ActionsManager::doAction( int id_action )
THEDP->mediaInfoDialog(); break;
case OPEN_SUB_ACTION:
THEDP->loadSubtitlesFile(); break;
case FULLWIDTH_ACTION:
if( p_intf->p_sys->p_mi )
p_intf->p_sys->p_mi->getFullscreenControllerWidget()->toggleFullwidth();
break;
default:
msg_Dbg( p_intf, "Action: %i", id_action );
break;
......
......@@ -41,6 +41,7 @@ typedef enum actionType_e
SLOWER_ACTION,
FASTER_ACTION,
FULLSCREEN_ACTION,
FULLWIDTH_ACTION,
EXTENDED_ACTION,
PLAYLIST_ACTION,
SNAPSHOT_ACTION,
......
......@@ -137,7 +137,8 @@ void AbstractController::parseAndCreate( const QString& config,
{
msg_Warn( p_intf, "Parsing error 3. Please, report this." );
continue;
} }
}
}
createAndAddWidget( controlLayout, -1, i_type, i_option );
}
......@@ -303,6 +304,10 @@ QWidget *AbstractController::createWidget( buttonType_e button, int options )
ENABLE_ON_VIDEO( FULLSCREENButton );
}
break;
case FULLWIDTH_BUTTON: {
NORMAL_BUTTON( FULLWIDTH );
}
break;
case EXTENDED_BUTTON:{
NORMAL_BUTTON( EXTENDED );
}
......@@ -719,6 +724,8 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, QWi
setWindowFlags( Qt::ToolTip );
setMinimumWidth( 600 );
setMinimumHeight( 72 );
isWideFSC = false;
setFrameShape( QFrame::StyledPanel );
setFrameStyle( QFrame::Sunken );
......@@ -875,6 +882,23 @@ void FullscreenControllerWidget::slowHideFSC()
#endif
}
void FullscreenControllerWidget::toggleFullwidth() {
int fswidth = QApplication::desktop()->screenGeometry( var_InheritInteger( p_intf, "qt-fullscreen-screennumber" ) ).width();
int fsheight = QApplication::desktop()->screenGeometry( var_InheritInteger( p_intf, "qt-fullscreen-screennumber" ) ).height();
if( !isWideFSC ) {
/* Dock at the bottom of the screen */
setMinimumWidth( fswidth );
setGeometry(0, fsheight-72, fswidth, 72);
} else {
/* Restore half-bar and re-centre */
setMinimumWidth( 600 );
setGeometry(fswidth/2 - 300, fsheight-72, 600, 72);
}
/* Toggle isWideFSC switch */
isWideFSC = !isWideFSC;
}
/**
* event handling
* events: show, hide, start timer for hiding
......@@ -953,6 +977,7 @@ void FullscreenControllerWidget::mouseMoveEvent( QMouseEvent *event )
*/
void FullscreenControllerWidget::mousePressEvent( QMouseEvent *event )
{
if( isWideFSC ) return;
i_mouse_last_x = event->globalX();
i_mouse_last_y = event->globalY();
event->accept();
......@@ -960,6 +985,7 @@ void FullscreenControllerWidget::mousePressEvent( QMouseEvent *event )
void FullscreenControllerWidget::mouseReleaseEvent( QMouseEvent *event )
{
if( isWideFSC ) return;
i_mouse_last_x = -1;
i_mouse_last_y = -1;
event->accept();
......
......@@ -38,7 +38,7 @@
#define MAIN_TB2_DEFAULT "0-2;64;3;1;4;64;7;9;64;10;20;19;64-4;37;65;35-4"
#define ADV_TB_DEFAULT "12;11;13;14"
#define INPT_TB_DEFAULT "5-1;15-1;33;6-1"
#define FSC_TB_DEFAULT "0-2;64;3;1;4;64;37;64;38;64;8;65;35-4;34"
#define FSC_TB_DEFAULT "0-2;64;3;1;4;64;37;64;38;64;8;65;25;35-4;34"
#define I_PLAY_TOOLTIP N_("Play\nIf the playlist is empty, open a medium")
......@@ -87,6 +87,7 @@ typedef enum buttonType_e
PREVIOUS_BUTTON,
NEXT_BUTTON,
OPEN_SUB_BUTTON,
FULLWIDTH_BUTTON,
BUTTON_MAX,
SPLITTER = 0x20,
......@@ -108,11 +109,12 @@ typedef enum buttonType_e
static const char* const nameL[BUTTON_MAX] = { N_("Play"), N_("Stop"), N_("Open"),
N_("Previous/Backward"), N_("Next/Forward"), N_("Slower"), N_("Faster"), N_("Fullscreen"),
N_("De-Fullscreen"), N_("Extended panel"), N_("Playlist"), N_("Snapshot"),
N_("Record"), N_("A->B Loop"), N_("Frame By Frame"), N_("Trickplay Reverse"),
N_("Step backward" ), N_("Step forward"), N_("Quit"), N_("Random"),
N_("Loop/Repeat mode"), N_("Information"), N_("Previous"), N_("Next"),
N_("Open subtitles file")};
N_("De-Fullscreen"), N_("Extended panel"), N_("Playlist"), N_("Snapshot"),
N_("Record"), N_("A->B Loop"), N_("Frame By Frame"), N_("Trickplay Reverse"),
N_("Step backward" ), N_("Step forward"), N_("Quit"), N_("Random"),
N_("Loop/Repeat mode"), N_("Information"), N_("Previous"), N_("Next"),
N_("Open subtitles file"), N_("Fullscreen controller width toggle")
};
static const char* const tooltipL[BUTTON_MAX] = { I_PLAY_TOOLTIP,
N_("Stop playback"), N_("Open a medium"),
N_("Previous media in the playlist, skip backward when keep-pressed"),
......@@ -124,7 +126,9 @@ static const char* const tooltipL[BUTTON_MAX] = { I_PLAY_TOOLTIP,
N_("Reverse"), N_("Step backward"), N_("Step forward"), N_("Quit"),
N_("Random"), N_("Change the loop and repeat modes"), N_("Information"),
N_("Previous media in the playlist"), N_("Next media in the playlist"),
N_("Open subtitles file")};
N_("Open subtitles file"),
N_("Dock/undock fullscreen controller to/from bottom of screen")
};
static const QString iconL[BUTTON_MAX] ={ ":/toolbar/play_b", ":/toolbar/stop_b",
":/toolbar/eject", ":/toolbar/previous_b", ":/toolbar/next_b",
":/toolbar/slower", ":/toolbar/faster", ":/toolbar/fullscreen",
......@@ -133,7 +137,8 @@ static const QString iconL[BUTTON_MAX] ={ ":/toolbar/play_b", ":/toolbar/stop_b"
":/toolbar/frame", ":/toolbar/reverse", ":/toolbar/skip_back",
":/toolbar/skip_fw", ":/toolbar/clear", ":/buttons/playlist/shuffle_on",
":/buttons/playlist/repeat_all", ":/menu/info",
":/toolbar/previous_b", ":/toolbar/next_b", "" };
":/toolbar/previous_b", ":/toolbar/next_b", "", ":/toolbar/space"
};
enum
{
......@@ -249,6 +254,7 @@ public:
/* Vout */
void fullscreenChanged( vout_thread_t *, bool b_fs, int i_timeout );
void mouseChanged( vout_thread_t *, int i_mousex, int i_mousey );
void toggleFullwidth();
signals:
void keyPressed( QKeyEvent * );
......@@ -298,6 +304,8 @@ private:
int i_hide_timeout; /* FSC hiding timeout, same as mouse hiding timeout */
int i_mouse_last_move_x;
int i_mouse_last_move_y;
bool isWideFSC;
};
#endif
......@@ -82,6 +82,7 @@ public:
/* Getters */
QSystemTrayIcon *getSysTray() { return sysTray; }
QMenu *getSysTrayMenu() { return systrayMenu; }
FullscreenControllerWidget* getFullscreenControllerWidget() { return fullscreenControls; }
int getControlsVisibilityStatus();
bool isPlDocked() { return ( b_plDocked != false ); }
bool isInterfaceFullScreen() { return b_interfaceFullScreen; }
......
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