OTHER: select active window on click istead of on mouseover

This commit is contained in:
Thomas Frauendorfer 2010-03-06 11:40:24 +01:00
parent 5f4e2d89d7
commit 353b7314e6
13 changed files with 110 additions and 33 deletions

View file

@ -1,7 +1,7 @@
/**
* 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 it under the terms of the GNU General Public License
@ -35,6 +35,29 @@ BaseWindow::BaseWindow (QWidget *parent) : QMainWindow (parent)
// 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
BaseWindow::hideEvent (QHideEvent *event)
{

View file

@ -1,7 +1,7 @@
/**
* 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 it under the terms of the GNU General Public License
@ -51,6 +51,10 @@ class BaseWindow : public QMainWindow {
void mouseReleaseEvent (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 m_diff;
};

View file

@ -63,6 +63,8 @@ EqualizerWidget::EqualizerWidget (QWidget *parent) : QWidget (parent)
connect (SkinManager::instance (), SIGNAL(skinChanged(Skin *)),
this, SLOT(setPixmaps(Skin *)));
setActive (isActiveWindow ());
m_closebtn = new PixmapButton (this);
m_closebtn->resize (skin->getSize (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);
}
setActive (m_active);
update();
}
void
EqualizerWidget::setActive (bool active)
{
Skin *skin = SkinManager::instance ()->activeSkin ();
m_active = active;
}
void
EqualizerWidget::paintEvent (QPaintEvent *event)
{

View file

@ -34,16 +34,16 @@ class EqualizerSlider : public PixmapSlider
Q_OBJECT
public:
EqualizerSlider (QWidget*, int);
EqualizerSlider (QWidget*, int);
signals:
void numberedValueChanged (int value, int id);
void numberedValueChanged (int value, int id);
protected slots:
void on_self_value_changed (int value);
void on_self_value_changed (int value);
private:
int m_id;
int m_id;
};
class EqualizerWidget : public QWidget
@ -53,6 +53,8 @@ class EqualizerWidget : public QWidget
public:
EqualizerWidget(QWidget *parent);
~EqualizerWidget();
void setActive (bool);
void paintEvent (QPaintEvent *event);
public slots:
@ -68,6 +70,7 @@ class EqualizerWidget : public QWidget
private:
bool haveEqualizerEffect();
bool m_active;
XConfig *m_xconfig;
QPixmap m_pixmap;
QPixmap m_graph;

View file

@ -1,7 +1,7 @@
/**
* 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
* it under the terms of the GNU General Public License as published by
@ -38,9 +38,23 @@ EqualizerWindow::EqualizerWindow (QWidget *parent) : BaseWindow (parent)
}
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"

View file

@ -1,7 +1,7 @@
/**
* 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
* it under the terms of the GNU General Public License as published by
@ -30,7 +30,11 @@ class EqualizerWindow : public BaseWindow
~EqualizerWindow() {}
public slots:
void setEnabled (void);
void switchDisplay (void);
protected:
void activeWindowInEvent (QEvent *event);
void activeWindowOutEvent (QEvent *event);
private:
MainWindow *m_mw;

View file

@ -36,6 +36,7 @@
MainWindow::MainWindow (QWidget *parent) : BaseWindow (parent)
{
setObjectName ("MainWindow");
QSettings s;
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
MainWindow::raisePL (void)
{

View file

@ -1,7 +1,7 @@
/**
* 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
* it under the terms of the GNU General Public License as published by
@ -49,6 +49,10 @@ class MainWindow : public BaseWindow
void switchDisplay ();
void mouseMoveEvent (QMouseEvent *event);
protected:
void activeWindowInEvent (QEvent *event);
void activeWindowOutEvent (QEvent *event);
private:
bool isShaded (void) { QSettings s; return s.value("MainWindow/shaded").toBool(); }
void setShaded (bool b) { QSettings s; return s.setValue("MainWindow/shaded", b); }

View file

@ -30,15 +30,9 @@ SkinDisplay::SkinDisplay (QWidget *parent) : QWidget(parent)
}
void
SkinDisplay::enterEvent (QEvent *event)
SkinDisplay::setActive (bool b)
{
dynamic_cast<TitleBar *>(m_tbar)->setActive(true);
}
void
SkinDisplay::leaveEvent (QEvent *event)
{
dynamic_cast<TitleBar *>(m_tbar)->setActive(false);
dynamic_cast<TitleBar *>(m_tbar)->setActive (b);
}
void

View file

@ -1,7 +1,7 @@
/**
* 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
* it under the terms of the GNU General Public License as published by
@ -27,15 +27,14 @@ class SkinDisplay : public QWidget
public:
SkinDisplay (QWidget *parent);
void setActive (bool b);
public slots:
void fileOpen (void);
protected:
void enterEvent (QEvent *event);
void leaveEvent (QEvent *event);
QWidget *m_tbar;
};
#endif

View file

@ -180,7 +180,7 @@ PlaylistWidget::PlaylistWidget (PlaylistWindow *parent) : QWidget (parent)
connect (SkinManager::instance (), SIGNAL (skinChanged (Skin *)),
this, SLOT (setPixmaps(Skin *)));
setActive (underMouse ());
setActive (isActiveWindow ());
m_closebtn = new PixmapButton (this);
m_closebtn->resize (skin->getSize (Skin::BUTTON_PLS_CLOSE));

View file

@ -1,7 +1,7 @@
/**
* 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
* it under the terms of the GNU General Public License as published by
@ -100,18 +100,20 @@ PlaylistWindow::resizeEvent (QResizeEvent *event)
}
void
PlaylistWindow::enterEvent (QEvent *event)
PlaylistWindow::activeWindowInEvent (QEvent *event)
{
m_playlist->setActive (true);
m_shaded->setActive (true);
BaseWindow::activeWindowInEvent (event);
}
void
PlaylistWindow::leaveEvent (QEvent *event)
PlaylistWindow::activeWindowOutEvent (QEvent *event)
{
m_playlist->setActive (false);
m_shaded->setActive (false);
BaseWindow::activeWindowOutEvent (event);
}
#include "playlistwindow.moc"

View file

@ -1,7 +1,7 @@
/**
* 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
* it under the terms of the GNU General Public License as published by
@ -16,9 +16,9 @@
#ifndef __PLAYLISTWINDOW_H__
#define __PLAYLISTWINDOW_H__
// Qt classes
#include "basewindow.h"
// Qt classes
class QEvent;
class QResizeEvent;
class QPoint;
@ -45,8 +45,8 @@ class PlaylistWindow : public BaseWindow {
void switchDisplay (void);
protected:
void enterEvent (QEvent *event);
void leaveEvent (QEvent *event);
void activeWindowInEvent (QEvent *event);
void activeWindowOutEvent (QEvent *event);
void resizeEvent (QResizeEvent *event);
private: