mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-21 08:19:42 +01:00
TWK-885: Hide resize handle when in osx full-screen mode
This commit is contained in:
parent
ac46b080fe
commit
f947005666
@ -306,7 +306,7 @@ TomahawkApp::init()
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
// Make sure to do this after main window is inited
|
||||
Tomahawk::enableFullscreen();
|
||||
Tomahawk::enableFullscreen( m_mainwindow );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ TomahawkWindow::applyPlatformTweaks()
|
||||
if ( !QString( qApp->style()->metaObject()->className() ).toLower().contains( "qtcurve" ) )
|
||||
qApp->setStyle( new ProxyStyle() );
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
setUnifiedTitleAndToolBarOnMac( true );
|
||||
delete ui->hline1;
|
||||
delete ui->hline2;
|
||||
@ -272,7 +272,7 @@ TomahawkWindow::setupSideBar()
|
||||
sidebarWidget->layout()->setContentsMargins( 0, 0, 0, 0 );
|
||||
sidebarWidget->layout()->setMargin( 0 );
|
||||
|
||||
#ifndef Q_WS_MAC
|
||||
#ifndef Q_OS_MAC
|
||||
sidebarWidget->layout()->setSpacing( 0 );
|
||||
#endif
|
||||
|
||||
@ -287,11 +287,11 @@ TomahawkWindow::setupSideBar()
|
||||
void
|
||||
TomahawkWindow::setupUpdateCheck()
|
||||
{
|
||||
#ifndef Q_WS_MAC
|
||||
#ifndef Q_OS_MAC
|
||||
ui->menu_Help->insertSeparator( ui->actionAboutTomahawk );
|
||||
#endif
|
||||
|
||||
#if defined( Q_WS_MAC ) && defined( HAVE_SPARKLE )
|
||||
#if defined( Q_OS_MAC ) && defined( HAVE_SPARKLE )
|
||||
QAction* checkForUpdates = ui->menu_Help->addAction( tr( "Check For Updates..." ) );
|
||||
checkForUpdates->setMenuRole( QAction::ApplicationSpecificRole );
|
||||
connect( checkForUpdates, SIGNAL( triggered( bool ) ), SLOT( checkForUpdates() ) );
|
||||
@ -350,7 +350,7 @@ TomahawkWindow::setupSignals()
|
||||
connect( ui->actionNext, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( next() ) );
|
||||
connect( ui->actionPrevious, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( previous() ) );
|
||||
|
||||
#if defined( Q_WS_MAC )
|
||||
#if defined( Q_OS_MAC )
|
||||
connect( ui->actionMinimize, SIGNAL( triggered() ), SLOT( minimize() ) );
|
||||
connect( ui->actionZoom, SIGNAL( triggered() ), SLOT( maximize() ) );
|
||||
#else
|
||||
@ -399,7 +399,7 @@ TomahawkWindow::changeEvent( QEvent* e )
|
||||
void
|
||||
TomahawkWindow::closeEvent( QCloseEvent* e )
|
||||
{
|
||||
#ifndef Q_WS_MAC
|
||||
#ifndef Q_OS_MAC
|
||||
if ( e->spontaneous() && QSystemTrayIcon::isSystemTrayAvailable() )
|
||||
{
|
||||
hide();
|
||||
@ -419,7 +419,7 @@ TomahawkWindow::showEvent( QShowEvent* e )
|
||||
{
|
||||
QMainWindow::showEvent( e );
|
||||
|
||||
#if defined( Q_WS_MAC )
|
||||
#if defined( Q_OS_MAC )
|
||||
ui->actionMinimize->setDisabled( false );
|
||||
ui->actionZoom->setDisabled( false );
|
||||
#endif
|
||||
@ -431,7 +431,7 @@ TomahawkWindow::hideEvent( QHideEvent* e )
|
||||
{
|
||||
QMainWindow::hideEvent( e );
|
||||
|
||||
#if defined( Q_WS_MAC )
|
||||
#if defined( Q_OS_MAC )
|
||||
ui->actionMinimize->setDisabled( true );
|
||||
ui->actionZoom->setDisabled( true );
|
||||
#endif
|
||||
@ -442,7 +442,7 @@ void
|
||||
TomahawkWindow::keyPressEvent( QKeyEvent* e )
|
||||
{
|
||||
bool accept = true;
|
||||
#if ! defined ( Q_WS_MAC )
|
||||
#if ! defined ( Q_OS_MAC )
|
||||
#define KEY_PRESSED Q_FUNC_INFO << "Multimedia Key Pressed:"
|
||||
switch( e->key() )
|
||||
{
|
||||
@ -590,11 +590,25 @@ TomahawkWindow::showOfflineSources()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkWindow::fullScreenEntered()
|
||||
{
|
||||
statusBar()->setSizeGripEnabled( false );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkWindow::fullScreenExited()
|
||||
{
|
||||
statusBar()->setSizeGripEnabled( true );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkWindow::loadSpiff()
|
||||
{
|
||||
LoadXSPFDialog* diag = new LoadXSPFDialog( this, Qt::Sheet );
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
connect( diag, SIGNAL( finished( int ) ), this, SLOT( loadXspfFinished( int ) ) );
|
||||
diag->show();
|
||||
#else
|
||||
@ -719,7 +733,7 @@ void
|
||||
TomahawkWindow::createPlaylist()
|
||||
{
|
||||
PlaylistTypeSelectorDlg* playlistSelectorDlg = new PlaylistTypeSelectorDlg( TomahawkApp::instance()->mainWindow(), Qt::Sheet );
|
||||
#ifndef Q_WS_MAC
|
||||
#ifndef Q_OS_MAC
|
||||
playlistSelectorDlg->setModal( true );
|
||||
#endif
|
||||
connect( playlistSelectorDlg, SIGNAL( finished( int ) ), this, SLOT( playlistCreateDialogFinished( int ) ) );
|
||||
@ -863,7 +877,7 @@ TomahawkWindow::showAboutTomahawk()
|
||||
void
|
||||
TomahawkWindow::checkForUpdates()
|
||||
{
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_OS_MAC
|
||||
Tomahawk::checkForUpdates();
|
||||
#endif
|
||||
}
|
||||
|
@ -88,6 +88,9 @@ public slots:
|
||||
void pluginMenuRemoved(QMenu*);
|
||||
void showOfflineSources();
|
||||
|
||||
void fullScreenEntered();
|
||||
void fullScreenExited();
|
||||
|
||||
private slots:
|
||||
void onAccountAdded( Tomahawk::Accounts::Account* account );
|
||||
void onAccountConnected();
|
||||
|
@ -23,6 +23,7 @@
|
||||
// copyright David Sansome 2010
|
||||
|
||||
class QString;
|
||||
class QObject;
|
||||
|
||||
namespace Tomahawk {
|
||||
|
||||
@ -43,7 +44,9 @@ void setShortcutHandler(Tomahawk::MacShortcutHandler* engine);
|
||||
// used for opening files with tomahawk
|
||||
void setApplicationHandler(PlatformInterface* handler);
|
||||
void checkForUpdates();
|
||||
void enableFullscreen();
|
||||
|
||||
// Pass in a QObject with slots "fullScreenEntered() and fullScreenExited() in order to be notified
|
||||
void enableFullscreen( QObject* notifier );
|
||||
|
||||
};
|
||||
|
||||
|
@ -43,6 +43,8 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QApplication>
|
||||
#include <QObject>
|
||||
#include <QMetaObject>
|
||||
|
||||
@interface MacApplication :NSApplication {
|
||||
AppDelegate* delegate_;
|
||||
@ -255,7 +257,7 @@ void Tomahawk::checkForUpdates() {
|
||||
#define SET_LION_FULLSCREEN (NSUInteger)(1 << 7) // Defined as NSWindowCollectionBehaviorFullScreenPrimary in lion's NSWindow.h
|
||||
#endif
|
||||
|
||||
void Tomahawk::enableFullscreen()
|
||||
void Tomahawk::enableFullscreen( QObject* receiver )
|
||||
{
|
||||
// We don't support anything below leopard, so if it's not [snow] leopard it must be lion
|
||||
// Can't check for lion as Qt 4.7 doesn't have the enum val, not checking for Unknown as it will be lion
|
||||
@ -273,6 +275,26 @@ void Tomahawk::enableFullscreen()
|
||||
NSView *nsview = (NSView *)w->winId();
|
||||
NSWindow *nswindow = [nsview window];
|
||||
[nswindow setCollectionBehavior:SET_LION_FULLSCREEN];
|
||||
|
||||
#ifdef LION
|
||||
if ( !receiver )
|
||||
continue;
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:NSWindowWillEnterFullScreenNotification
|
||||
object:nswindow
|
||||
queue:nil
|
||||
usingBlock:^(NSNotification * note) {
|
||||
NSLog(@"Became Full Screen!");
|
||||
QMetaObject::invokeMethod( receiver, "fullScreenEntered", Qt::DirectConnection );
|
||||
}];
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:NSWindowDidExitFullScreenNotification
|
||||
object:nswindow
|
||||
queue:nil
|
||||
usingBlock:^(NSNotification * note) {
|
||||
NSLog(@"Left Full Screen!");
|
||||
QMetaObject::invokeMethod( receiver, "fullScreenExited", Qt::DirectConnection );
|
||||
}];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user