Skip to content

Commit

Permalink
Larger resize bar for touch screens
Browse files Browse the repository at this point in the history
  • Loading branch information
zaps166 committed Jun 5, 2015
1 parent 9b7db11 commit a0ee978
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 4 deletions.
3 changes: 2 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Zmiany w QMPlay2 build 15.06.05:
Zmiany w QMPlay2 build 15.06.06:
- większy pasek zmiany rozmiatu okien dla ekranów dotykowych,
- zoom na ekranie dotykowym (pinch gesture),
- poprawiony odczyt okładek płyt z katalogu,
- kompatybilność z FFMpeg 2.0 oraz 2.1,
Expand Down
42 changes: 40 additions & 2 deletions src/gui/MainWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,24 @@ using Functions::timeToStr;

#include <math.h>

/* Qt5 or Qt4 in Windows */
#define UseMainWidgetTmpStyle (QT_VERSION >= 0x050000 || defined Q_OS_WIN)

#if UseMainWidgetTmpStyle
/* MainWidgetTmpStyle - dock widget separator extent must be larger for touch screens */
class MainWidgetTmpStyle : public QCommonStyle
{
public:
int pixelMetric( PixelMetric metric, const QStyleOption *option, const QWidget *widget ) const
{
const int pM = QCommonStyle::pixelMetric( metric, option, widget );
if ( metric == QStyle::PM_DockWidgetSeparatorExtent )
return pM * 5 / 2;
return pM;
}
};
#endif

/* MainWidget */
MainWidget::MainWidget( QPair< QStringList, QStringList > &QMPArguments )
#ifdef UPDATER
Expand All @@ -52,6 +70,26 @@ MainWidget::MainWidget( QPair< QStringList, QStringList > &QMPArguments )
{
QMPlay2GUI.mainW = this;

#if UseMainWidgetTmpStyle
#if QT_VERSION >= 0x050000
bool createTmpStyle = false;
/* Looking for touch screen */
foreach ( const QTouchDevice *touchDev, QTouchDevice::devices() )
{
/* Touchscreen found */
if ( touchDev->type() == QTouchDevice::TouchScreen )
{
createTmpStyle = true;
break;
}
}
if ( createTmpStyle )
#elif defined Q_OS_WIN
if ( QSysInfo::windowsVersion() > QSysInfo::WV_6_1 ) //Qt4 can't detect touchscreen, so MainWidgetTmpStyle will be used only with Windows >= 8.0
#endif
setStyle( QScopedPointer< MainWidgetTmpStyle >( new MainWidgetTmpStyle ).data() ); //Is it always OK?
#endif

setObjectName( "MainWidget" );

settingsW = NULL;
Expand Down Expand Up @@ -1024,8 +1062,8 @@ void MainWidget::mouseMoveEvent( QMouseEvent *e )
{
if ( fullScreen )
{
int trigger1 = qMax( 3, ( int )ceil( 0.002 * width() ) );
int trigger2 = qMax( 15, ( int )ceil( 0.015 * width() ) );
int trigger1 = qMax< int >( 3, ceil( 0.002 * width() ) );
int trigger2 = qMax< int >( 15, ceil( 0.025 * width() ) );

int mPosX = 0;
if ( videoDock->x() >= 0 )
Expand Down
2 changes: 1 addition & 1 deletion src/qmplay2/headers/QMPlay2Core.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef QMPLAY2CORE_HPP
#define QMPLAY2CORE_HPP

#define QMPlay2Version "15.06.05"
#define QMPlay2Version "15.06.06"

#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || (__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
#define QMPLAY2_CPU_X86
Expand Down

0 comments on commit a0ee978

Please sign in to comment.