OTHER: removed PixWidget

PixWidget sole purpose was to paint a given pixmap. Some of PixWidgets
child classes had to create that pixmap from some other pixmaps. Thus
PixWidget introduced some kind of unnecessary double buffering.
Furthermore, those pixmaps where created even if a widget wasn't
visible. Painting directly to the widget and calling the 'update ()'
method on changes might allow Qt to do some performance optimizations.
Most likely they will be to small to be noticable though.

I also disabled the shortcuts of the titlebarmenu. They were diplayed in
the menu but didn't work. As soon as I figure out how to get them
working again I will enable them again
This commit is contained in:
Thomas Frauendorfer 2008-10-03 01:22:40 +02:00
parent 6cf0ad2614
commit 096ac37121
11 changed files with 130 additions and 167 deletions

View file

@ -26,8 +26,9 @@
#include "Skin.h"
#include <QMenu>
#include <QPainter>
TitleBar::TitleBar (QWidget *parent, bool shaded) : PixWidget (parent)
TitleBar::TitleBar (QWidget *parent, bool shaded) : QWidget (parent)
{
MainWindow *mw = dynamic_cast<MainWindow*>(window ());
m_shaded = shaded;
@ -61,6 +62,9 @@ TitleBar::TitleBar (QWidget *parent, bool shaded) : PixWidget (parent)
m_closebtn->move (skin->getPos (Skin::BUTTON_MW_CLOSE));
connect (m_closebtn, SIGNAL (clicked()), qApp, SLOT (quit ()));
m_pixmap = QPixmap(0,0);
connect (skin, SIGNAL (skinChanged (Skin *)),
this, SLOT (setPixmaps(Skin *)));
}
void
@ -71,30 +75,30 @@ TitleBar::showMenu (void)
QAction *a;
a = new QAction (tr ("Medialib browser"), this);
a->setShortcut (tr ("Alt+M"));
// a->setShortcut (tr ("Alt+M"));
connect (a, SIGNAL (triggered ()), this, SLOT (showMlib ()));
a->setEnabled(false); // FIXME: disabled for now, as Mlib-browser doesn't work
qm.addAction (a);
a = new QAction (tr ("Server-side browser"), this);
a->setShortcut (tr ("Alt+S"));
// a->setShortcut (tr ("Alt+S"));
connect (a, SIGNAL (triggered ()), this, SLOT (showServerB ()));
qm.addAction (a);
qm.addSeparator ();
a = new QAction (tr ("Theme settings"), this);
a->setShortcut (tr ("Alt+T"));
// a->setShortcut (tr ("Alt+T"));
connect (a, SIGNAL (triggered ()), this, SLOT (showTheme ()));
qm.addAction (a);
a = new QAction (tr ("Application settings"), this);
a->setShortcut (tr ("Alt+A"));
// a->setShortcut (tr ("Alt+A"));
connect (a, SIGNAL (triggered ()), this, SLOT (showSettings ()));
qm.addAction (a);
a = new QAction (tr ("Server settings"), this);
a->setShortcut (tr ("Alt+S"));
// a->setShortcut (tr ("Alt+S"));
a->setEnabled(false); // FIXME: disabled for now, not yet implemented
qm.addAction (a);
qm.addSeparator ();
a = new QAction (tr ("Quit"), this);
a->setShortcut (tr ("Ctrl+Q"));
// a->setShortcut (tr ("Ctrl+Q"));
connect (a, SIGNAL (triggered ()), qApp, SLOT (quit ()));
qm.addAction (a);
@ -177,6 +181,15 @@ TitleBar::setActive (bool active)
}
}
void
TitleBar::paintEvent (QPaintEvent *event)
{
QPainter p;
p.begin (this);
p.drawPixmap (rect (), m_pixmap);
p.end ();
}
void
TitleBar::mouseDoubleClickEvent (QMouseEvent *event)
{