OTHER: select active window on click istead of on mouseover
This commit is contained in:
parent
5f4e2d89d7
commit
353b7314e6
13 changed files with 110 additions and 33 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file is a part of Promoe, an XMMS2 Client
|
* This file is a part of Promoe, an XMMS2 Client
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005-2008 XMMS2 Team
|
* Copyright (C) 2005-2010 XMMS2 Team
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
@ -35,6 +35,29 @@ BaseWindow::BaseWindow (QWidget *parent) : QMainWindow (parent)
|
||||||
|
|
||||||
|
|
||||||
// Qt Event Handlers
|
// Qt Event Handlers
|
||||||
|
bool
|
||||||
|
BaseWindow::event (QEvent *event)
|
||||||
|
{
|
||||||
|
if (event->type () == QEvent::ActivationChange) {
|
||||||
|
if (isActiveWindow()) {
|
||||||
|
activeWindowInEvent (event);
|
||||||
|
} else {
|
||||||
|
activeWindowOutEvent (event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QMainWindow::event (event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BaseWindow::activeWindowInEvent (QEvent *event)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BaseWindow::activeWindowOutEvent (QEvent *event)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BaseWindow::hideEvent (QHideEvent *event)
|
BaseWindow::hideEvent (QHideEvent *event)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file is a part of Promoe, an XMMS2 Client
|
* This file is a part of Promoe, an XMMS2 Client
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005-2008 XMMS2 Team
|
* Copyright (C) 2005-2010 XMMS2 Team
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
@ -51,6 +51,10 @@ class BaseWindow : public QMainWindow {
|
||||||
void mouseReleaseEvent (QMouseEvent *event);
|
void mouseReleaseEvent (QMouseEvent *event);
|
||||||
void mouseMoveEvent (QMouseEvent *event);
|
void mouseMoveEvent (QMouseEvent *event);
|
||||||
|
|
||||||
|
bool event (QEvent *event);
|
||||||
|
virtual void activeWindowInEvent (QEvent *event);
|
||||||
|
virtual void activeWindowOutEvent (QEvent *event);
|
||||||
|
|
||||||
QPoint snapWindow (QPoint pos, AttachedWindowMap attached = AttachedWindowMap());
|
QPoint snapWindow (QPoint pos, AttachedWindowMap attached = AttachedWindowMap());
|
||||||
QPoint m_diff;
|
QPoint m_diff;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,8 @@ EqualizerWidget::EqualizerWidget (QWidget *parent) : QWidget (parent)
|
||||||
connect (SkinManager::instance (), SIGNAL(skinChanged(Skin *)),
|
connect (SkinManager::instance (), SIGNAL(skinChanged(Skin *)),
|
||||||
this, SLOT(setPixmaps(Skin *)));
|
this, SLOT(setPixmaps(Skin *)));
|
||||||
|
|
||||||
|
setActive (isActiveWindow ());
|
||||||
|
|
||||||
m_closebtn = new PixmapButton (this);
|
m_closebtn = new PixmapButton (this);
|
||||||
m_closebtn->resize (skin->getSize (Skin::BUTTON_EQ_CLOSE));
|
m_closebtn->resize (skin->getSize (Skin::BUTTON_EQ_CLOSE));
|
||||||
m_closebtn->move (skin->getPos (Skin::BUTTON_EQ_CLOSE));
|
m_closebtn->move (skin->getPos (Skin::BUTTON_EQ_CLOSE));
|
||||||
|
|
@ -157,9 +159,19 @@ EqualizerWidget::setPixmaps (Skin *skin)
|
||||||
m_bands[i]->setBackground (bgslist);
|
m_bands[i]->setBackground (bgslist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setActive (m_active);
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
EqualizerWidget::setActive (bool active)
|
||||||
|
{
|
||||||
|
Skin *skin = SkinManager::instance ()->activeSkin ();
|
||||||
|
|
||||||
|
m_active = active;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EqualizerWidget::paintEvent (QPaintEvent *event)
|
EqualizerWidget::paintEvent (QPaintEvent *event)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,8 @@ class EqualizerWidget : public QWidget
|
||||||
public:
|
public:
|
||||||
EqualizerWidget(QWidget *parent);
|
EqualizerWidget(QWidget *parent);
|
||||||
~EqualizerWidget();
|
~EqualizerWidget();
|
||||||
|
|
||||||
|
void setActive (bool);
|
||||||
void paintEvent (QPaintEvent *event);
|
void paintEvent (QPaintEvent *event);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
@ -68,6 +70,7 @@ class EqualizerWidget : public QWidget
|
||||||
private:
|
private:
|
||||||
bool haveEqualizerEffect();
|
bool haveEqualizerEffect();
|
||||||
|
|
||||||
|
bool m_active;
|
||||||
XConfig *m_xconfig;
|
XConfig *m_xconfig;
|
||||||
QPixmap m_pixmap;
|
QPixmap m_pixmap;
|
||||||
QPixmap m_graph;
|
QPixmap m_graph;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file is a part of Promoe, an XMMS2 Client.
|
* This file is a part of Promoe, an XMMS2 Client.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005-2008 XMMS2 Team
|
* Copyright (C) 2005-2010 XMMS2 Team
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -38,9 +38,23 @@ EqualizerWindow::EqualizerWindow (QWidget *parent) : BaseWindow (parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EqualizerWindow::setEnabled (void)
|
EqualizerWindow::activeWindowInEvent (QEvent *event)
|
||||||
{
|
{
|
||||||
qDebug ("test");
|
m_equalizer->setActive (true);
|
||||||
|
BaseWindow::activeWindowInEvent (event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
EqualizerWindow::activeWindowOutEvent (QEvent *event)
|
||||||
|
{
|
||||||
|
m_equalizer->setActive (false);
|
||||||
|
BaseWindow::activeWindowOutEvent (event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
EqualizerWindow::switchDisplay (void)
|
||||||
|
{
|
||||||
|
qDebug("switchDisplay not implemented for equalizer");
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "equalizerwindow.moc"
|
#include "equalizerwindow.moc"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file is a part of Promoe, an XMMS2 Client.
|
* This file is a part of Promoe, an XMMS2 Client.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005-2008 XMMS2 Team
|
* Copyright (C) 2005-2010 XMMS2 Team
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -30,7 +30,11 @@ class EqualizerWindow : public BaseWindow
|
||||||
~EqualizerWindow() {}
|
~EqualizerWindow() {}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setEnabled (void);
|
void switchDisplay (void);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void activeWindowInEvent (QEvent *event);
|
||||||
|
void activeWindowOutEvent (QEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MainWindow *m_mw;
|
MainWindow *m_mw;
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@
|
||||||
|
|
||||||
MainWindow::MainWindow (QWidget *parent) : BaseWindow (parent)
|
MainWindow::MainWindow (QWidget *parent) : BaseWindow (parent)
|
||||||
{
|
{
|
||||||
|
setObjectName ("MainWindow");
|
||||||
QSettings s;
|
QSettings s;
|
||||||
|
|
||||||
setWindowTitle (App->applicationName ());
|
setWindowTitle (App->applicationName ());
|
||||||
|
|
@ -126,6 +127,23 @@ MainWindow::switchDisplay ()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MainWindow::activeWindowInEvent (QEvent *event)
|
||||||
|
{
|
||||||
|
m_display->setActive (true);
|
||||||
|
m_shaded->setActive (true);
|
||||||
|
BaseWindow::activeWindowInEvent (event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MainWindow::activeWindowOutEvent (QEvent *event)
|
||||||
|
{
|
||||||
|
m_display->setActive (false);
|
||||||
|
m_shaded->setActive (false);
|
||||||
|
BaseWindow::activeWindowOutEvent (event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWindow::raisePL (void)
|
MainWindow::raisePL (void)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file is a part of Promoe, an XMMS2 Client.
|
* This file is a part of Promoe, an XMMS2 Client.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005-2008 XMMS2 Team
|
* Copyright (C) 2005-2010 XMMS2 Team
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -49,6 +49,10 @@ class MainWindow : public BaseWindow
|
||||||
void switchDisplay ();
|
void switchDisplay ();
|
||||||
void mouseMoveEvent (QMouseEvent *event);
|
void mouseMoveEvent (QMouseEvent *event);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void activeWindowInEvent (QEvent *event);
|
||||||
|
void activeWindowOutEvent (QEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isShaded (void) { QSettings s; return s.value("MainWindow/shaded").toBool(); }
|
bool isShaded (void) { QSettings s; return s.value("MainWindow/shaded").toBool(); }
|
||||||
void setShaded (bool b) { QSettings s; return s.setValue("MainWindow/shaded", b); }
|
void setShaded (bool b) { QSettings s; return s.setValue("MainWindow/shaded", b); }
|
||||||
|
|
|
||||||
|
|
@ -30,15 +30,9 @@ SkinDisplay::SkinDisplay (QWidget *parent) : QWidget(parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SkinDisplay::enterEvent (QEvent *event)
|
SkinDisplay::setActive (bool b)
|
||||||
{
|
{
|
||||||
dynamic_cast<TitleBar *>(m_tbar)->setActive(true);
|
dynamic_cast<TitleBar *>(m_tbar)->setActive (b);
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
SkinDisplay::leaveEvent (QEvent *event)
|
|
||||||
{
|
|
||||||
dynamic_cast<TitleBar *>(m_tbar)->setActive(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file is a part of Promoe, an XMMS2 Client.
|
* This file is a part of Promoe, an XMMS2 Client.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005-2008 XMMS2 Team
|
* Copyright (C) 2005-2010 XMMS2 Team
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -27,13 +27,12 @@ class SkinDisplay : public QWidget
|
||||||
public:
|
public:
|
||||||
SkinDisplay (QWidget *parent);
|
SkinDisplay (QWidget *parent);
|
||||||
|
|
||||||
|
void setActive (bool b);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void fileOpen (void);
|
void fileOpen (void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void enterEvent (QEvent *event);
|
|
||||||
void leaveEvent (QEvent *event);
|
|
||||||
|
|
||||||
QWidget *m_tbar;
|
QWidget *m_tbar;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@ PlaylistWidget::PlaylistWidget (PlaylistWindow *parent) : QWidget (parent)
|
||||||
connect (SkinManager::instance (), SIGNAL (skinChanged (Skin *)),
|
connect (SkinManager::instance (), SIGNAL (skinChanged (Skin *)),
|
||||||
this, SLOT (setPixmaps(Skin *)));
|
this, SLOT (setPixmaps(Skin *)));
|
||||||
|
|
||||||
setActive (underMouse ());
|
setActive (isActiveWindow ());
|
||||||
|
|
||||||
m_closebtn = new PixmapButton (this);
|
m_closebtn = new PixmapButton (this);
|
||||||
m_closebtn->resize (skin->getSize (Skin::BUTTON_PLS_CLOSE));
|
m_closebtn->resize (skin->getSize (Skin::BUTTON_PLS_CLOSE));
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file is a part of Promoe, an XMMS2 Client.
|
* This file is a part of Promoe, an XMMS2 Client.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005-2008 XMMS2 Team
|
* Copyright (C) 2005-2010 XMMS2 Team
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -100,18 +100,20 @@ PlaylistWindow::resizeEvent (QResizeEvent *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PlaylistWindow::enterEvent (QEvent *event)
|
PlaylistWindow::activeWindowInEvent (QEvent *event)
|
||||||
{
|
{
|
||||||
m_playlist->setActive (true);
|
m_playlist->setActive (true);
|
||||||
m_shaded->setActive (true);
|
m_shaded->setActive (true);
|
||||||
|
BaseWindow::activeWindowInEvent (event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PlaylistWindow::leaveEvent (QEvent *event)
|
PlaylistWindow::activeWindowOutEvent (QEvent *event)
|
||||||
{
|
{
|
||||||
m_playlist->setActive (false);
|
m_playlist->setActive (false);
|
||||||
m_shaded->setActive (false);
|
m_shaded->setActive (false);
|
||||||
|
BaseWindow::activeWindowOutEvent (event);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "playlistwindow.moc"
|
#include "playlistwindow.moc"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file is a part of Promoe, an XMMS2 Client.
|
* This file is a part of Promoe, an XMMS2 Client.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005-2008 XMMS2 Team
|
* Copyright (C) 2005-2010 XMMS2 Team
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -16,9 +16,9 @@
|
||||||
#ifndef __PLAYLISTWINDOW_H__
|
#ifndef __PLAYLISTWINDOW_H__
|
||||||
#define __PLAYLISTWINDOW_H__
|
#define __PLAYLISTWINDOW_H__
|
||||||
|
|
||||||
// Qt classes
|
|
||||||
#include "basewindow.h"
|
#include "basewindow.h"
|
||||||
|
|
||||||
|
// Qt classes
|
||||||
class QEvent;
|
class QEvent;
|
||||||
class QResizeEvent;
|
class QResizeEvent;
|
||||||
class QPoint;
|
class QPoint;
|
||||||
|
|
@ -45,8 +45,8 @@ class PlaylistWindow : public BaseWindow {
|
||||||
void switchDisplay (void);
|
void switchDisplay (void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void enterEvent (QEvent *event);
|
void activeWindowInEvent (QEvent *event);
|
||||||
void leaveEvent (QEvent *event);
|
void activeWindowOutEvent (QEvent *event);
|
||||||
void resizeEvent (QResizeEvent *event);
|
void resizeEvent (QResizeEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue