OTHER: Moved some files around
Moved some files that belong to mainwindow into the appropriate subdir and changed them to lowercase. Changed the includes accordingly
This commit is contained in:
parent
63def9b10b
commit
6cf0ad2614
12 changed files with 20 additions and 20 deletions
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
#include "pixmapbutton.h"
|
||||
#include "pixmapslider.h"
|
||||
#include "TitleBar.h"
|
||||
#include "TextBar.h"
|
||||
#include "titlebar.h"
|
||||
#include "textbar.h"
|
||||
#include "timedisplay.h"
|
||||
#include "Skin.h"
|
||||
#include "pixmapnumberdisplay.h"
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class MainDisplay;
|
|||
#include <QHash>
|
||||
#include <QVariant>
|
||||
|
||||
#include "Display.h"
|
||||
#include "skindisplay.h"
|
||||
|
||||
typedef QHash<QString, QVariant> QVariantHash;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,11 @@ HEADERS += clutterbar.h \
|
|||
playstatus.h \
|
||||
posbar.h \
|
||||
shadeddisplay.h \
|
||||
skindisplay.h \
|
||||
stereomono.h \
|
||||
timedisplay.h
|
||||
textbar.h \
|
||||
timedisplay.h \
|
||||
titlebar.h
|
||||
|
||||
SOURCES += clutterbar.cpp \
|
||||
mainwindow.cpp \
|
||||
|
|
@ -13,8 +16,11 @@ SOURCES += clutterbar.cpp \
|
|||
playstatus.cpp \
|
||||
posbar.cpp \
|
||||
shadeddisplay.cpp \
|
||||
skindisplay.cpp \
|
||||
stereomono.cpp \
|
||||
timedisplay.cpp
|
||||
textbar.cpp \
|
||||
timedisplay.cpp \
|
||||
titlebar.cpp
|
||||
|
||||
INCLUDEPATH += $$PWD
|
||||
DEPENDPATH += $$PWD
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@
|
|||
#include "xplayback.h"
|
||||
|
||||
#include "shadeddisplay.h"
|
||||
#include "TitleBar.h"
|
||||
#include "titlebar.h"
|
||||
#include "pixmapbutton.h"
|
||||
|
||||
#include "timedisplay.h"
|
||||
#include "TextBar.h"
|
||||
#include "textbar.h"
|
||||
#include "Skin.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
class ShadedDisplay;
|
||||
|
||||
#include <xmmsclient/xmmsclient++.h>
|
||||
#include "Display.h"
|
||||
#include "skindisplay.h"
|
||||
#include <QHash>
|
||||
#include <QVariant>
|
||||
|
||||
|
|
|
|||
83
src/mainwindow/skindisplay.cpp
Normal file
83
src/mainwindow/skindisplay.cpp
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
/**
|
||||
* This file is a part of Promoe, an XMMS2 Client.
|
||||
*
|
||||
* Copyright (C) 2005-2008 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
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "XMMSHandler.h"
|
||||
#include "xcollection.h"
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "skindisplay.h"
|
||||
#include "Skin.h"
|
||||
|
||||
#include "titlebar.h"
|
||||
#include "FileDialog.h"
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
SkinDisplay::SkinDisplay (QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
Skin *skin = Skin::getInstance ();
|
||||
|
||||
m_mw = parent;
|
||||
|
||||
connect (skin, SIGNAL (skinChanged (Skin *)),
|
||||
this, SLOT (setPixmaps (Skin *)));
|
||||
}
|
||||
|
||||
void
|
||||
SkinDisplay::setPixmaps (Skin *skin)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
SkinDisplay::enterEvent (QEvent *event)
|
||||
{
|
||||
dynamic_cast<TitleBar *>(m_tbar)->setActive(true);
|
||||
}
|
||||
|
||||
void
|
||||
SkinDisplay::leaveEvent (QEvent *event)
|
||||
{
|
||||
dynamic_cast<TitleBar *>(m_tbar)->setActive(false);
|
||||
}
|
||||
|
||||
void
|
||||
SkinDisplay::paintEvent (QPaintEvent *event)
|
||||
{
|
||||
QPainter(paint);
|
||||
|
||||
paint.begin(this);
|
||||
paint.eraseRect(rect());
|
||||
paint.end();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SkinDisplay::fileOpen (void)
|
||||
{
|
||||
FileDialog fd (this, "main_addfiles");
|
||||
QStringList files;
|
||||
|
||||
files = fd.getFiles ();
|
||||
|
||||
XMMSHandler &xmmsh = XMMSHandler::getInstance();
|
||||
if (files.count() > 0) {
|
||||
xmmsh.xcollection ()->playlistClear ();
|
||||
}
|
||||
|
||||
for (int i = 0; i < files.count(); i++) {
|
||||
xmmsh.playlistAddURL ("file://" + files.value(i));
|
||||
}
|
||||
}
|
||||
|
||||
46
src/mainwindow/skindisplay.h
Normal file
46
src/mainwindow/skindisplay.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* This file is a part of Promoe, an XMMS2 Client.
|
||||
*
|
||||
* Copyright (C) 2005-2008 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
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef __SKINDISPLAY_H__
|
||||
#define __SKINDISPLAY_H__
|
||||
|
||||
#include <QWidget>
|
||||
class QEvent;
|
||||
class QPaintEvent;
|
||||
|
||||
class Skin;
|
||||
|
||||
class SkinDisplay : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SkinDisplay (QWidget *parent);
|
||||
QWidget *getMW () const { return m_mw; }
|
||||
|
||||
public slots:
|
||||
virtual void setPixmaps(Skin *skin);
|
||||
void fileOpen (void);
|
||||
|
||||
protected:
|
||||
void paintEvent (QPaintEvent *event);
|
||||
void enterEvent (QEvent *event);
|
||||
void leaveEvent (QEvent *event);
|
||||
|
||||
QWidget *m_mw;
|
||||
QWidget *m_tbar;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
257
src/mainwindow/textbar.cpp
Normal file
257
src/mainwindow/textbar.cpp
Normal file
|
|
@ -0,0 +1,257 @@
|
|||
/**
|
||||
* This file is a part of Promoe, an XMMS2 Client.
|
||||
*
|
||||
* Copyright (C) 2005-2008 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
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "skindisplay.h"
|
||||
#include "textbar.h"
|
||||
#include "Skin.h"
|
||||
|
||||
#include <QBrush>
|
||||
#include <QFont>
|
||||
#include <QPainter>
|
||||
#include <QPalette>
|
||||
#include <QPixmap>
|
||||
#include <QSettings>
|
||||
#include <QTimer>
|
||||
|
||||
TextScroller::TextScroller (QWidget *parent, uint w,
|
||||
uint h, const QString &name) :
|
||||
QWidget (parent)
|
||||
{
|
||||
//XMMSHandler *xmmsh = XMMSHandler::getInstance ();
|
||||
Skin *skin = Skin::getInstance ();
|
||||
|
||||
connect (skin, SIGNAL (skinChanged (Skin *)),
|
||||
this, SLOT (setPixmaps(Skin *)));
|
||||
|
||||
QSettings s;
|
||||
|
||||
s.beginGroup ("display_" + name);
|
||||
|
||||
if (!s.contains("scroll"))
|
||||
s.setValue("scroll", true);
|
||||
|
||||
if (!s.contains("fontsize"))
|
||||
s.setValue("fontsize", 8);
|
||||
|
||||
if (!s.contains("ttf"))
|
||||
s.setValue("ttf", true);
|
||||
|
||||
m_name = name;
|
||||
m_h = h;
|
||||
m_w = w;
|
||||
m_x_off = 0;
|
||||
m_x2_off = 0;
|
||||
m_fontsize = s.value ("fontsize").toInt ();
|
||||
m_ttf = s.value ("ttf").toBool ();
|
||||
m_text = "Promoe " PROMOE_VERSION;
|
||||
m_scroll = s.value ("scroll").toBool ();
|
||||
|
||||
s.endGroup ();
|
||||
|
||||
setMinimumSize(m_w + 2, m_h);
|
||||
setMaximumSize(m_w + 2, m_h);
|
||||
|
||||
m_timer = new QTimer (this);
|
||||
connect (m_timer, SIGNAL (timeout()), this, SLOT (addOffset ()));
|
||||
//connect (xmmsh, SIGNAL (settingsSaved ()), this, SLOT (settingsSaved ()));
|
||||
}
|
||||
|
||||
void
|
||||
TextScroller::settingsSaved (void)
|
||||
{
|
||||
QSettings s;
|
||||
s.beginGroup ("display_" + m_name);
|
||||
m_fontsize = s.value ("fontsize").toInt ();
|
||||
m_ttf = s.value ("ttf").toBool ();
|
||||
|
||||
if (m_scroll != s.value ("scroll").toBool ()) {
|
||||
m_x_off = 0;
|
||||
m_x2_off = 0;
|
||||
}
|
||||
|
||||
m_scroll = s.value ("scroll").toBool ();
|
||||
s.endGroup ();
|
||||
|
||||
setText (m_text);
|
||||
update ();
|
||||
}
|
||||
|
||||
void
|
||||
TextScroller::setPixmaps (Skin *skin)
|
||||
{
|
||||
QPalette pal = palette ();
|
||||
QBrush b = QBrush (skin->getItem (Skin::TEXTBG));
|
||||
pal.setBrush (QPalette::Window, b);
|
||||
setPalette (pal);
|
||||
|
||||
setText (m_text);
|
||||
update();
|
||||
}
|
||||
|
||||
void
|
||||
TextScroller::addOffset ()
|
||||
{
|
||||
if (m_x2_off > 0) {
|
||||
m_x2_off --;
|
||||
} else if (m_x_off < m_pixmap.size().width()) {
|
||||
m_x_off ++;
|
||||
} else {
|
||||
m_x_off = 0;
|
||||
m_x2_off = 0;
|
||||
}
|
||||
|
||||
repaint ();
|
||||
m_timer->start (40);
|
||||
}
|
||||
|
||||
void
|
||||
TextScroller::setText (QString text)
|
||||
{
|
||||
m_text = text;
|
||||
|
||||
if (m_ttf) {
|
||||
drawQtFont (text);
|
||||
} else {
|
||||
drawBitmapFont (text);
|
||||
}
|
||||
m_x_off = 0;
|
||||
m_x2_off = 0;
|
||||
update ();
|
||||
}
|
||||
|
||||
void
|
||||
TextScroller::drawBitmapFont (QString text)
|
||||
{
|
||||
Skin *skin = Skin::getInstance ();
|
||||
|
||||
int width = text.length() * 6;
|
||||
QString temp = text.toLower ();
|
||||
|
||||
if (width > m_w) {
|
||||
temp += QString::fromAscii (" -- ");
|
||||
m_pixmap = QPixmap (width + 6*6, m_h);
|
||||
|
||||
if (m_scroll) {
|
||||
m_timer->start (40);
|
||||
} else {
|
||||
m_timer->stop ();
|
||||
}
|
||||
} else {
|
||||
m_pixmap = QPixmap (m_w, m_h);
|
||||
m_timer->stop ();
|
||||
}
|
||||
QByteArray temp2 = temp.toLatin1();
|
||||
const char *t = temp2.data();
|
||||
|
||||
QPainter (paint);
|
||||
|
||||
paint.begin (&m_pixmap);
|
||||
|
||||
paint.drawPixmap (m_pixmap.rect (),
|
||||
skin->getItem (Skin::TEXTBG),
|
||||
skin->getItem (Skin::TEXTBG).rect ());
|
||||
|
||||
for (uint i = 0; i < strlen (t); i++) {
|
||||
QPixmap p = skin->getLetter (t[i]);
|
||||
if (p.isNull ()) {
|
||||
p = skin->getLetter(' ');
|
||||
}
|
||||
|
||||
paint.drawPixmap (QRect ((i * 6), 0, 4, 6),
|
||||
p, p.rect());
|
||||
}
|
||||
|
||||
paint.end();
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
TextScroller::drawQtFont (QString text)
|
||||
{
|
||||
Skin *skin = Skin::getInstance ();
|
||||
|
||||
QFont font(skin->getPLeditValue ("font"));
|
||||
font.setPixelSize (m_fontsize);
|
||||
|
||||
QFontMetrics fM(font);
|
||||
QRect rect = fM.boundingRect (text);
|
||||
|
||||
QString (temp) = text;
|
||||
|
||||
if (rect.width() > m_w) {
|
||||
temp += QString::fromAscii (" -- ");
|
||||
QRect rect = fM.boundingRect (temp);
|
||||
|
||||
m_pixmap = QPixmap (rect.width(), m_h);
|
||||
|
||||
if (m_scroll) {
|
||||
m_timer->start (40);
|
||||
} else {
|
||||
m_timer->stop ();
|
||||
}
|
||||
|
||||
} else {
|
||||
m_pixmap = QPixmap (m_w, m_h);
|
||||
m_timer->stop ();
|
||||
}
|
||||
|
||||
QPainter paint;
|
||||
paint.begin (&m_pixmap);
|
||||
paint.drawPixmap (m_pixmap.rect (),
|
||||
skin->getItem (Skin::TEXTBG),
|
||||
skin->getItem (Skin::TEXTBG).rect ());
|
||||
|
||||
paint.setFont (font);
|
||||
QColor c;
|
||||
c.setNamedColor (skin->getPLeditValue ("normal"));
|
||||
paint.setPen (c);
|
||||
paint.drawText (m_pixmap.rect (),
|
||||
Qt::AlignLeft | Qt::AlignVCenter,
|
||||
temp);
|
||||
paint.end ();
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
TextScroller::paintEvent (QPaintEvent *event)
|
||||
{
|
||||
int pad = 0;
|
||||
|
||||
if (m_pixmap.isNull ()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int w2 = m_pixmap.size().width() - m_x_off;
|
||||
if (w2 < m_w) {
|
||||
pad = m_w - w2;
|
||||
}
|
||||
|
||||
QPainter (paint);
|
||||
paint.begin (this);
|
||||
paint.drawPixmap (QRect (m_x2_off, 0, m_w - pad, m_h),
|
||||
m_pixmap,
|
||||
QRect (m_x_off, 0, m_w - pad, m_h));
|
||||
if (pad) {
|
||||
paint.drawPixmap (QRect (m_w - pad, 0, pad, m_h),
|
||||
m_pixmap,
|
||||
QRect (0, 0, pad, m_h));
|
||||
}
|
||||
paint.end ();
|
||||
}
|
||||
|
||||
TextScroller::~TextScroller ()
|
||||
{
|
||||
}
|
||||
|
||||
63
src/mainwindow/textbar.h
Normal file
63
src/mainwindow/textbar.h
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* This file is a part of Promoe, an XMMS2 Client.
|
||||
*
|
||||
* Copyright (C) 2005-2008 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
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef __TEXTBOX_H__
|
||||
#define __TEXTBOX_H__
|
||||
|
||||
#include <QWidget>
|
||||
class QPixmap;
|
||||
class QTimer;
|
||||
|
||||
class Skin;
|
||||
|
||||
class TextScroller : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TextScroller (QWidget *parent, uint, uint, const QString &);
|
||||
~TextScroller ();
|
||||
|
||||
void setText(QString text);
|
||||
void setFontSize (int i) { m_fontsize = i; }
|
||||
void setTTF (bool b) { m_ttf = b; }
|
||||
|
||||
public slots:
|
||||
void addOffset ();
|
||||
void setPixmaps(Skin *skin);
|
||||
void settingsSaved (void);
|
||||
|
||||
protected:
|
||||
QPixmap m_pixmap;
|
||||
void paintEvent (QPaintEvent *event);
|
||||
|
||||
private:
|
||||
int m_w;
|
||||
int m_h;
|
||||
int m_x_off;
|
||||
int m_x2_off;
|
||||
int m_fontsize;
|
||||
bool m_ttf;
|
||||
bool m_scroll;
|
||||
|
||||
QTimer *m_timer;
|
||||
QString m_text;
|
||||
QString m_name;
|
||||
|
||||
void drawBitmapFont (QString text);
|
||||
void drawQtFont (QString text);
|
||||
};
|
||||
|
||||
#endif
|
||||
186
src/mainwindow/titlebar.cpp
Normal file
186
src/mainwindow/titlebar.cpp
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
/**
|
||||
* This file is a part of Promoe, an XMMS2 Client.
|
||||
*
|
||||
* Copyright (C) 2005-2008 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
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "XMMSHandler.h"
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "titlebar.h"
|
||||
#include "skindisplay.h"
|
||||
#include "SkinChooser.h"
|
||||
// #include "MedialibWindow.h"
|
||||
#include "settingsdialog.h"
|
||||
#include "pixmapbutton.h"
|
||||
#include "BrowseDialog.h"
|
||||
#include "Skin.h"
|
||||
|
||||
#include <QMenu>
|
||||
|
||||
TitleBar::TitleBar (QWidget *parent, bool shaded) : PixWidget (parent)
|
||||
{
|
||||
MainWindow *mw = dynamic_cast<MainWindow*>(window ());
|
||||
m_shaded = shaded;
|
||||
Skin *skin = Skin::getInstance ();
|
||||
|
||||
setFixedSize (275, 14);
|
||||
|
||||
m_menubtn = new PixmapButton (this);
|
||||
m_menubtn->resize (skin->getSize (Skin::BUTTON_MW_MENU));
|
||||
m_menubtn->move (skin->getPos (Skin::BUTTON_MW_MENU));
|
||||
connect (m_menubtn, SIGNAL (clicked ()), this, SLOT (showMenu ()));
|
||||
|
||||
m_minimize = new PixmapButton (this);
|
||||
m_minimize->resize (skin->getSize (Skin::BUTTON_MW_MINIMIZE));
|
||||
m_minimize->move (skin->getPos (Skin::BUTTON_MW_MINIMIZE));
|
||||
connect (m_minimize, SIGNAL (clicked ()), mw, SLOT (showMinimized ()));
|
||||
|
||||
if (shaded) {
|
||||
m_shadebtn = new PixmapButton (this);
|
||||
m_shadebtn->resize (skin->getSize (Skin::BUTTON_MW_SHADED_UNSHADE));
|
||||
m_shadebtn->move (skin->getPos (Skin::BUTTON_MW_SHADED_UNSHADE));
|
||||
} else {
|
||||
m_shadebtn = new PixmapButton (this);
|
||||
m_shadebtn->resize (skin->getSize (Skin::BUTTON_MW_SHADE));
|
||||
m_shadebtn->move (skin->getPos (Skin::BUTTON_MW_SHADE));
|
||||
}
|
||||
connect (m_shadebtn, SIGNAL (clicked()), mw, SLOT (switchDisplay ()));
|
||||
|
||||
m_closebtn = new PixmapButton (this);
|
||||
m_closebtn->resize (skin->getSize (Skin::BUTTON_MW_CLOSE));
|
||||
m_closebtn->move (skin->getPos (Skin::BUTTON_MW_CLOSE));
|
||||
connect (m_closebtn, SIGNAL (clicked()), qApp, SLOT (quit ()));
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
TitleBar::showMenu (void)
|
||||
{
|
||||
QMenu qm(this);
|
||||
|
||||
QAction *a;
|
||||
|
||||
a = new QAction (tr ("Medialib browser"), this);
|
||||
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"));
|
||||
connect (a, SIGNAL (triggered ()), this, SLOT (showServerB ()));
|
||||
qm.addAction (a);
|
||||
qm.addSeparator ();
|
||||
a = new QAction (tr ("Theme settings"), this);
|
||||
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"));
|
||||
connect (a, SIGNAL (triggered ()), this, SLOT (showSettings ()));
|
||||
qm.addAction (a);
|
||||
a = new QAction (tr ("Server settings"), this);
|
||||
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"));
|
||||
connect (a, SIGNAL (triggered ()), qApp, SLOT (quit ()));
|
||||
qm.addAction (a);
|
||||
|
||||
qm.exec(QPoint (window()->pos().x()+6, window()->pos().y()+3));
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
TitleBar::showMlib ()
|
||||
{
|
||||
/*
|
||||
MedialibWindow *mw = new MedialibWindow (window ());
|
||||
mw->show ();
|
||||
*/
|
||||
}
|
||||
|
||||
void
|
||||
TitleBar::showServerB ()
|
||||
{
|
||||
BrowseDialog *bd = new BrowseDialog (window ());
|
||||
bd->show ();
|
||||
}
|
||||
|
||||
void
|
||||
TitleBar::showSettings ()
|
||||
{
|
||||
SettingsDialog *sw = new SettingsDialog (window ());
|
||||
sw->show ();
|
||||
}
|
||||
|
||||
void
|
||||
TitleBar::showTheme ()
|
||||
{
|
||||
SkinChooser *sk = new SkinChooser (window());
|
||||
sk->show();
|
||||
}
|
||||
|
||||
void
|
||||
TitleBar::setPixmaps (Skin *skin)
|
||||
{
|
||||
if (m_shaded) {
|
||||
m_pixmap_active = skin->getItem (Skin::STATUSBAR_0);
|
||||
m_pixmap_inactive = skin->getItem (Skin::STATUSBAR_1);
|
||||
} else {
|
||||
m_pixmap_active = skin->getItem (Skin::TITLEBAR_0);
|
||||
m_pixmap_inactive = skin->getItem (Skin::TITLEBAR_1);
|
||||
}
|
||||
|
||||
if (underMouse()) {
|
||||
m_pixmap = m_pixmap_active;
|
||||
} else {
|
||||
m_pixmap = m_pixmap_inactive;
|
||||
}
|
||||
|
||||
m_menubtn->setIcon (skin->getIcon (Skin::BUTTON_MW_MENU));
|
||||
m_minimize->setIcon (skin->getIcon (Skin::BUTTON_MW_MINIMIZE));
|
||||
if (m_shaded) {
|
||||
m_shadebtn->setIcon (skin->getIcon (Skin::BUTTON_MW_SHADED_UNSHADE));
|
||||
} else {
|
||||
m_shadebtn->setIcon (skin->getIcon (Skin::BUTTON_MW_SHADE));
|
||||
}
|
||||
m_closebtn->setIcon (skin->getIcon (Skin::BUTTON_MW_CLOSE));
|
||||
|
||||
update ();
|
||||
}
|
||||
|
||||
TitleBar::~TitleBar ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
TitleBar::setActive (bool active)
|
||||
{
|
||||
if (active) {
|
||||
m_pixmap = m_pixmap_active;
|
||||
update ();
|
||||
} else {
|
||||
m_pixmap = m_pixmap_inactive;
|
||||
update ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TitleBar::mouseDoubleClickEvent (QMouseEvent *event)
|
||||
{
|
||||
MainWindow *mw = dynamic_cast<MainWindow*>(window ());
|
||||
mw->switchDisplay ();
|
||||
}
|
||||
|
||||
57
src/mainwindow/titlebar.h
Normal file
57
src/mainwindow/titlebar.h
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* This file is a part of Promoe, an XMMS2 Client.
|
||||
*
|
||||
* Copyright (C) 2005-2008 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
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef __TITLEBAR_H__
|
||||
#define __TITLEBAR_H__
|
||||
|
||||
class TitleBar;
|
||||
|
||||
#include "PixWidget.h"
|
||||
|
||||
class PixmapButton;
|
||||
class Skin;
|
||||
|
||||
class TitleBar : public PixWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TitleBar (QWidget *parent, bool shaded);
|
||||
~TitleBar ();
|
||||
void setActive (bool active);
|
||||
|
||||
public slots:
|
||||
void setPixmaps (Skin *skin);
|
||||
void showMenu (void);
|
||||
void showServerB (void);
|
||||
void showTheme (void);
|
||||
void showMlib (void);
|
||||
void showSettings (void);
|
||||
|
||||
protected:
|
||||
void mouseDoubleClickEvent (QMouseEvent *event);
|
||||
|
||||
private:
|
||||
QPixmap m_pixmap_active;
|
||||
QPixmap m_pixmap_inactive;
|
||||
|
||||
PixmapButton *m_shadebtn;
|
||||
PixmapButton *m_menubtn;
|
||||
PixmapButton *m_closebtn;
|
||||
PixmapButton *m_minimize;
|
||||
|
||||
bool m_shaded;
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue