OTHER: move togglePlaytime to Application class and some other small fixes
This commit is contained in:
parent
461106eb43
commit
786b745d55
17 changed files with 59 additions and 45 deletions
|
@ -1,4 +1,10 @@
|
|||
DEFINES += PROMOE_VERSION="\"\\\"0.1-dev\\\"\""
|
||||
|
||||
isEmpty(PREFIX): PREFIX = /usr/local
|
||||
isEmpty(BINDIR): BINDIR = $$PREFIX/bin
|
||||
isEmpty(DATADIR): DATADIR = $$PREFIX/share/promoe
|
||||
|
||||
DEFINES += DATADIR="\"\\\"$$DATADIR\\\"\""
|
||||
|
||||
DEPENDPATH += $PWD/src $PWD/lib
|
||||
INCLUDEPATH += $$PWD/src $$PWD/lib
|
||||
|
|
10
promoe.pro
10
promoe.pro
|
@ -4,11 +4,9 @@ SUBDIRS = lib src
|
|||
|
||||
include (config.pri)
|
||||
|
||||
isEmpty(PREFIX): PREFIX = /usr/local
|
||||
isEmpty(BINDIR): BINDIR = $$PREFIX/bin
|
||||
|
||||
message ( "Install path set to:" $$PREFIX )
|
||||
|
||||
binarys.path = $$BINDIR
|
||||
binarys.files = promoe
|
||||
INSTALLS += binarys
|
||||
binary.path = $$BINDIR
|
||||
binary.files = promoe
|
||||
|
||||
INSTALLS += binary
|
||||
|
|
|
@ -76,7 +76,7 @@ Skin::getPixmap (const QString& file, const QString &path)
|
|||
/* check for files in zip and check if file exists */
|
||||
|
||||
QDir dir (path);
|
||||
dir.setFilter (QDir::Files);
|
||||
dir.setFilter (QDir::Files|QDir::NoDotAndDotDot);
|
||||
|
||||
QFileInfoList list = dir.entryInfoList();
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
|
@ -120,7 +120,7 @@ Skin::ParsePLEdit (void)
|
|||
QString path;
|
||||
|
||||
dir.setPath (m_path);
|
||||
dir.setFilter (QDir::Files);
|
||||
dir.setFilter (QDir::Files|QDir::NoDotAndDotDot);
|
||||
|
||||
QFileInfoList list = dir.entryInfoList();
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
|
|
|
@ -60,11 +60,12 @@ SkinList::SkinList (QWidget *parent) : QListWidget (parent)
|
|||
path.append (QDir::homePath());
|
||||
path.append ("/.config/xmms2/clients/promoe/skins/");
|
||||
searchpath.append (path);
|
||||
searchpath.append (DATADIR "/skins");
|
||||
settings.setValue ("skin/searchpath", searchpath);
|
||||
}
|
||||
|
||||
QDir d;
|
||||
d.setFilter (QDir::Dirs|QDir::NoDotAndDotDot);
|
||||
d.setFilter (QDir::AllDirs|QDir::NoDotAndDotDot|QDir::Files);
|
||||
QFileInfoList list;
|
||||
foreach (QString path, searchpath) {
|
||||
d.setPath (path);
|
||||
|
|
|
@ -52,24 +52,35 @@ Application::Application (int &argc, char **argv) : QApplication (argc, argv)
|
|||
* open the skin and send the
|
||||
* SkinChanged signal that will cause
|
||||
* all widgets to get their pixmaps
|
||||
* TODO: Now the Skin class loads the skin itself. This call is necessarry until
|
||||
* all widgets that receive the skinChanged signal fetch their pixmaps themself
|
||||
* on startup
|
||||
* TODO: Now the Skin class loads the skin itself. This call is necessarry
|
||||
* until all widgets that receive the skinChanged signal fetch their
|
||||
* pixmaps themself on startup
|
||||
*/
|
||||
Skin::getInstance()->setSkin (settings.value("skin/path").toString ());
|
||||
|
||||
mw->show ();
|
||||
// The Playlist- and EqualizerWindow has to become visible after the mainwindow
|
||||
// because metacity (gnome-windowmanager) can't handle them correctly otherwise
|
||||
// The Playlist- and EqualizerWindow has to become visible after the
|
||||
// mainwindow because metacity (gnome-windowmanager) can't handle them
|
||||
// correctly otherwise
|
||||
mw->getEQ ()->setVisible (settings.value ("equalizer/visible", false).toBool ());
|
||||
mw->getPL ()->setVisible (settings.value ("playlist/visible", false).toBool ());
|
||||
|
||||
#ifdef HAVE_SERVERBROWSER
|
||||
ServerBrowserWindow *browser = new ServerBrowserWindow (mw);
|
||||
browser->show ();
|
||||
#endif
|
||||
|
||||
m_timemode_reverse = settings.value ("MainWindow/timemodereverse",
|
||||
false).toBool();
|
||||
}
|
||||
|
||||
void
|
||||
Application::cleanupHandler ()
|
||||
{
|
||||
QSettings s;
|
||||
|
||||
s.setValue("MainWindow/timemodereverse",m_timemode_reverse);
|
||||
|
||||
if (s.value ("promoe/quitonclose", false).toBool ())
|
||||
XMMSHandler::getInstance ().shutdownServer ();
|
||||
}
|
||||
|
@ -91,15 +102,12 @@ Application::handleDisconnected ()
|
|||
QApplication::quit ();
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
Application app(argc, argv);
|
||||
|
||||
|
||||
QSettings settings;
|
||||
|
||||
#ifdef Q_OS_MACX
|
||||
#ifdef Q_OS_MACX
|
||||
/** This is soooo wrong, there must exsist a flag for
|
||||
* static plugins
|
||||
Q_IMPORT_PLUGIN(QJpegPlugin);
|
||||
|
@ -107,10 +115,5 @@ main (int argc, char **argv)
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_SERVERBROWSER
|
||||
ServerBrowserWindow *browser = new ServerBrowserWindow (mw);
|
||||
browser->show ();
|
||||
#endif
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ class Application;
|
|||
#undef qApp
|
||||
#endif
|
||||
#define qApp (static_cast<Application *>(QCoreApplication::instance()))
|
||||
#define App (static_cast<Application *>(QCoreApplication::instance()))
|
||||
|
||||
class Application : public QApplication
|
||||
{
|
||||
|
@ -31,7 +32,19 @@ class Application : public QApplication
|
|||
public:
|
||||
Application (int &argc, char **argv);
|
||||
|
||||
|
||||
public slots:
|
||||
void cleanupHandler ();
|
||||
void handleDisconnected ();
|
||||
|
||||
// TODO: Search some better place for those methods
|
||||
public:
|
||||
bool isTimemodeReverse(void) {return m_timemode_reverse;}
|
||||
void setTimemodeReverse(bool b) {m_timemode_reverse = b;}
|
||||
|
||||
public slots:
|
||||
void toggleTime () {m_timemode_reverse = !m_timemode_reverse;}
|
||||
|
||||
private:
|
||||
bool m_timemode_reverse;
|
||||
};
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "xplayback.h"
|
||||
#include "xconfig.h"
|
||||
|
||||
#include "application.h"
|
||||
#include "maindisplay.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
|
@ -39,7 +40,6 @@
|
|||
#include <QFileDialog>
|
||||
#include <QSettings>
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
|
||||
MainDisplay::MainDisplay (MainWindow *parent) : SkinDisplay(parent)
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ MainDisplay::MainDisplay (MainWindow *parent) : SkinDisplay(parent)
|
|||
|
||||
m_time = new TimeDisplay(this);
|
||||
m_time->move (36, 26);
|
||||
connect (m_time, SIGNAL(clicked()), m_mw, SLOT(toggleTime()));
|
||||
connect (m_time, SIGNAL(clicked()), App, SLOT(toggleTime()));
|
||||
connect (this, SIGNAL (displayTime (int)), m_time, SLOT (setTime (int)));
|
||||
|
||||
m_kbps = new PixmapNumberDisplay (this);
|
||||
|
@ -197,7 +197,7 @@ void
|
|||
MainDisplay::setPlaytime (uint32_t time)
|
||||
{
|
||||
int32_t showtime;
|
||||
if (m_mw->isTimemodeReverse()) {
|
||||
if (App->isTimemodeReverse()) {
|
||||
uint maxtime = m_posbar->maximum ();
|
||||
showtime = (time/1000 - maxtime/1000);
|
||||
} else {
|
||||
|
|
|
@ -81,11 +81,9 @@ MainWindow::MainWindow (QWidget *parent) : BaseWindow (parent)
|
|||
setCentralWidget (m_display);
|
||||
m_display->show ();
|
||||
|
||||
//connects for timedisplay in playlistwindow
|
||||
//connect for timedisplay in playlistwindow
|
||||
connect (m_display, SIGNAL (displayTime (int)),
|
||||
m_playlistwin, SIGNAL (setDisplayTime (int)));
|
||||
connect (m_playlistwin, SIGNAL (toggleTime()),
|
||||
this, SLOT (toggleTime ()));
|
||||
|
||||
/*
|
||||
* MainDisplay's shaded mode
|
||||
|
|
|
@ -43,15 +43,11 @@ class MainWindow : public BaseWindow
|
|||
void raisePL (void);
|
||||
void moveEvent (QMoveEvent *event);
|
||||
|
||||
bool isTimemodeReverse(void) { QSettings s; return s.value("MainWindow/timemodereverse").toBool(); }
|
||||
void setTimemodeReverse(bool b) { QSettings s; s.setValue("MainWindow/timemodereverse",b); }
|
||||
|
||||
void attachWidgets ();
|
||||
|
||||
public slots:
|
||||
void switchDisplay ();
|
||||
void mouseMoveEvent (QMouseEvent *event);
|
||||
void toggleTime () { setTimemodeReverse (!isTimemodeReverse ()); }
|
||||
|
||||
private:
|
||||
bool isShaded (void) { QSettings s; return s.value("MainWindow/shaded").toBool(); }
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "xclientcache.h"
|
||||
#include "xplayback.h"
|
||||
|
||||
#include "application.h"
|
||||
#include "shadeddisplay.h"
|
||||
#include "titlebar.h"
|
||||
#include "pixmapbutton.h"
|
||||
|
@ -45,7 +46,7 @@ ShadedDisplay::ShadedDisplay (QWidget *parent) : SkinDisplay (parent)
|
|||
|
||||
m_time = new SmallTimeDisplay (this);
|
||||
m_time->move (130, 4);
|
||||
connect (m_time, SIGNAL(clicked()), m_mw, SLOT(toggleTime()));
|
||||
connect (m_time, SIGNAL(clicked()), App, SLOT(toggleTime()));
|
||||
|
||||
m_title = new TextScroller (this, 39, 7, "shaded");
|
||||
m_title->move (79, 4);
|
||||
|
@ -129,7 +130,7 @@ void
|
|||
ShadedDisplay::setPlaytime (uint32_t time)
|
||||
{
|
||||
int32_t showtime;
|
||||
if (m_mw->isTimemodeReverse()) {
|
||||
if (App->isTimemodeReverse()) {
|
||||
showtime = (time/1000 - m_duration/1000);
|
||||
} else {
|
||||
showtime = time/1000;
|
||||
|
|
|
@ -65,7 +65,7 @@ TextScroller::TextScroller (QWidget *parent, uint w,
|
|||
m_timer = new QTimer (this);
|
||||
m_timer->setInterval (40);
|
||||
connect (m_timer, SIGNAL (timeout()), this, SLOT (addOffset ()));
|
||||
connect (qApp, SIGNAL (settingsChanged ()),
|
||||
connect (App, SIGNAL (settingsChanged ()),
|
||||
this, SLOT (settingsChanged ()));
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ PlaylistShade::PlaylistShade (PlaylistWindow *parent) : QWidget (parent)
|
|||
connect (xmmsh.cache (), SIGNAL (activeEntryChanged (QVariantHash)),
|
||||
this, SLOT (setMediainfo (QVariantHash)));
|
||||
|
||||
connect (qApp, SIGNAL(settingsChanged ()),
|
||||
connect (App, SIGNAL(settingsChanged ()),
|
||||
this, SLOT(settingsChanged ()));
|
||||
|
||||
m_text = "Promoe " PROMOE_VERSION " - A very neat XMMS2 client";
|
||||
|
|
|
@ -138,7 +138,7 @@ PlaylistView::PlaylistView (QWidget *parent) : QListView (parent)
|
|||
|
||||
XMMSHandler &xmmsh = XMMSHandler::getInstance ();
|
||||
|
||||
connect (qApp, SIGNAL (settingsChanged ()),
|
||||
connect (App, SIGNAL (settingsChanged ()),
|
||||
this, SLOT (settingsChanged ()));
|
||||
|
||||
connect (xmmsh.xplayback (), SIGNAL(playbackStatusChanged(Xmms::Playback::Status)),
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "XMMSHandler.h"
|
||||
|
||||
#include "application.h"
|
||||
#include "mainwindow.h"
|
||||
#include "BrowseDialog.h"
|
||||
#include "playlistwindow.h"
|
||||
|
@ -38,7 +39,6 @@
|
|||
#include <QPoint>
|
||||
#include <QRect>
|
||||
#include <QIcon>
|
||||
#include <QApplication>
|
||||
#include <QSettings>
|
||||
#include <QFileDialog>
|
||||
#include <QPainter>
|
||||
|
@ -235,7 +235,7 @@ PlaylistWidget::PlaylistWidget (PlaylistWindow *parent) : QWidget (parent)
|
|||
client.xplayback (), SLOT (next ()));
|
||||
// TODO: eject
|
||||
connect (m_controls, SIGNAL (toggleTime ()),
|
||||
parent, SIGNAL (toggleTime()));
|
||||
App, SLOT (toggleTime()));
|
||||
connect (parent, SIGNAL (setDisplayTime (int)),
|
||||
m_controls, SIGNAL (setDisplayTime (int)));
|
||||
|
||||
|
|
|
@ -43,8 +43,6 @@ class PlaylistWindow : public BaseWindow {
|
|||
signals:
|
||||
void visibilityChanged(bool visible);
|
||||
|
||||
// connected to
|
||||
void toggleTime (); // toggle the playtime
|
||||
// setTime is used to set playtime in playlistcontrols
|
||||
void setDisplayTime (int seconds);
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ SettingsDialog::SettingsDialog (QWidget *parent) : QDialog (parent)
|
|||
resize (400, 500);
|
||||
|
||||
connect (this, SIGNAL (settingsChanged (void)),
|
||||
qApp, SIGNAL (settingsChanged (void)));
|
||||
App, SIGNAL (settingsChanged (void)));
|
||||
|
||||
QVBoxLayout *vbox = new QVBoxLayout (this);
|
||||
setLayout(vbox);
|
||||
|
|
|
@ -52,7 +52,7 @@ AbstractTimeDisplay::AbstractTimeDisplay (QWidget *parent) : QWidget (parent)
|
|||
void
|
||||
AbstractTimeDisplay::setTime (int time)
|
||||
{
|
||||
// Hack to make display hours and seconds instead of seconds and minutes
|
||||
// Hack to make display hours and minutes instead of minutes and seconds
|
||||
// if time (or reversetime) is 100 Minutes or longer
|
||||
if ((time >= 6000) || (time <= -6000)) {
|
||||
time /= 60;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue