Commit 8cecd422 authored by Scott Wheeler's avatar Scott Wheeler

Hopefully the last in the big round of API cleanups.

All slots now start with slotFoo()
All signals now start with signalBar()
All member variable are prefixed with m_quux

svn path=/trunk/kdemultimedia/juk/; revision=209966
parent 34c906c5
......@@ -29,8 +29,8 @@ DirectoryList::DirectoryList(QStringList &directories, QWidget* parent, const ch
m_dirList(directories)
{
directoryListView->setFullWidth(true);
connect(addDirectoryButton, SIGNAL(clicked()), this, SLOT(addDirectory()));
connect(removeDirectoryButton, SIGNAL(clicked()), this, SLOT(removeDirectory()));
connect(addDirectoryButton, SIGNAL(clicked()), this, SLOT(slotAddDirectory()));
connect(removeDirectoryButton, SIGNAL(clicked()), this, SLOT(slotRemoveDirectory()));
for(QStringList::ConstIterator it = directories.begin(); it != directories.end(); ++it)
new KListViewItem(directoryListView, *it);
......@@ -45,24 +45,24 @@ DirectoryList::~DirectoryList()
// private slots
////////////////////////////////////////////////////////////////////////////////
void DirectoryList::addDirectory()
void DirectoryList::slotAddDirectory()
{
QString dir = KFileDialog::getExistingDirectory();
if(!dir.isEmpty() && m_dirList.find(dir) == m_dirList.end()) {
m_dirList.append(dir);
new KListViewItem(directoryListView, dir);
emit(directoryAdded(dir));
emit signalDirectoryAdded(dir);
}
}
void DirectoryList::removeDirectory()
void DirectoryList::slotRemoveDirectory()
{
if(!directoryListView->selectedItem())
return;
QString dir = directoryListView->selectedItem()->text(0);
m_dirList.remove(dir);
emit(directoryRemoved(dir));
emit signalDirectoryRemoved(dir);
delete directoryListView->selectedItem();
}
......
......@@ -31,12 +31,12 @@ public:
virtual ~DirectoryList();
signals:
void directoryAdded(const QString &directory);
void directoryRemoved(const QString &directory);
void signalDirectoryAdded(const QString &directory);
void signalDirectoryRemoved(const QString &directory);
private slots:
void addDirectory();
void removeDirectory();
void slotAddDirectory();
void slotRemoveDirectory();
private:
QStringList m_dirList;
......
......@@ -78,7 +78,7 @@ void GenreListEditor::updateGenreList()
// private slots
////////////////////////////////////////////////////////////////////////////////
void GenreListEditor::updateGenreBoxes(QListViewItem *item)
void GenreListEditor::slotUpdateGenreBoxes(QListViewItem *item)
{
if(item) {
genreNameBox->setText(item->text(0));
......@@ -86,7 +86,7 @@ void GenreListEditor::updateGenreBoxes(QListViewItem *item)
}
}
void GenreListEditor::updateGenreName(const QString &name)
void GenreListEditor::slotUpdateGenreName(const QString &name)
{
QListViewItem *current = genreList->currentItem();
if(!name.isEmpty() && current)
......
......@@ -38,8 +38,8 @@ private:
void updateGenreList();
private slots:
virtual void updateGenreBoxes(QListViewItem *item);
virtual void updateGenreName(const QString &name);
virtual void slotUpdateGenreBoxes(QListViewItem *item);
virtual void slotUpdateGenreName(const QString &name);
private:
QDict<GenreList> m_listDict;
......
......@@ -285,18 +285,18 @@
<sender>genreList</sender>
<signal>executed(QListViewItem*)</signal>
<receiver>listEditor</receiver>
<slot>updateGenreBoxes(QListViewItem*)</slot>
<slot>slotUpdateGenreBoxes(QListViewItem*)</slot>
</connection>
<connection>
<sender>genreNameBox</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>listEditor</receiver>
<slot>updateGenreName(const QString&amp;)</slot>
<slot>slotUpdateGenreName(const QString&amp;)</slot>
</connection>
</connections>
<slots>
<slot access="protected" specifier="pure virtual">updateGenreBoxes(QListViewItem *)</slot>
<slot access="protected" specifier="pure virtual">updateGenreName(const QString &amp;name)</slot>
<slot access="protected" specifier="pure virtual">slotUpdateGenreBoxes(QListViewItem *)</slot>
<slot access="protected" specifier="pure virtual">slotUpdateGenreName(const QString &amp;name)</slot>
</slots>
<layoutdefaults spacing="6" margin="11"/>
<includehints>
......
......@@ -35,12 +35,9 @@ using namespace QGstPlay;
// public methods
////////////////////////////////////////////////////////////////////////////////
GStreamerPlayer::GStreamerPlayer() : QObject(0), Player()
GStreamerPlayer::GStreamerPlayer() : QObject(0), Player(),
m_positionNs(0), m_durationNs(0), m_currentVolume(1.0)
{
m_currentVolume = 1.0;
positionNs = 0;
durationNs = 0;
setupPlayer();
}
......@@ -61,8 +58,8 @@ void GStreamerPlayer::play(const QString &fileName, float volume)
void GStreamerPlayer::play(float volume)
{
// 1.0 is full volume
positionNs = 0;
durationNs = 0;
m_positionNs = 0;
m_durationNs = 0;
if (m_player->getState() != Element::STATE_PLAYING) {
m_player->setState(Element::STATE_PLAYING);
m_player->setVolume(volume);
......@@ -112,18 +109,18 @@ bool GStreamerPlayer::paused() const
long GStreamerPlayer::totalTime() const
{
return durationNs / 1000000000L;
return m_durationNs / 1000000000L;
}
long GStreamerPlayer::currentTime() const
{
return positionNs / 1000000000L;
return m_positionNs / 1000000000L;
}
int GStreamerPlayer::position() const
{
if (durationNs > 0)
return (int)((positionNs * 1000.0) / durationNs);
if (m_durationNs > 0)
return (int)((m_positionNs * 1000.0) / m_durationNs);
else
return 0;
}
......@@ -141,8 +138,8 @@ void GStreamerPlayer::seek(long seekTime)
void GStreamerPlayer::seekPosition(int position)
{
// position unit is 1/1000th
if(durationNs > 0)
m_player->seekToTime(position * durationNs / 1000L);
if(m_durationNs > 0)
m_player->seekToTime(position * m_durationNs / 1000L);
else
m_player->seekToTime(0);
......@@ -152,23 +149,13 @@ void GStreamerPlayer::seekPosition(int position)
// private
/////////////////////////////////////////////////////////////////////////////////
void GStreamerPlayer::setDuration(long long d)
{
durationNs = d;
}
void GStreamerPlayer::setPosition(long long d)
{
positionNs = d;
}
void GStreamerPlayer::setupPlayer()
{
m_player = new Play(Play::PIPE_AUDIO_BUFFER_THREADED, this, "Play");
connect(m_player, SIGNAL(timeTick(long long)),
SLOT(setPosition(long long)));
SLOT(slotSetPosition(long long)));
connect(m_player, SIGNAL(streamLength(long long)),
SLOT(setDuration(long long)));
SLOT(slotSetDuration(long long)));
connect(m_player, SIGNAL(streamEnd()), SLOT(stop()));
}
......
......@@ -59,17 +59,17 @@ public slots:
void stop();
private slots:
void setPosition(long long d);
void setDuration(long long d);
void slotSetPosition(long long d) { m_positionNs = d; }
void slotSetDuration(long long d) { m_durationNs = d; }
private:
void setupPlayer();
QGstPlay::Play *m_player;
unsigned long long duration;
unsigned long long m_duration;
long long positionNs; // in ns
long long durationNs; // in ns
long long m_positionNs; // in ns
long long m_durationNs; // in ns
QString m_currentFile;
float m_currentVolume;
......
This diff is collapsed.
......@@ -48,8 +48,8 @@ public:
virtual ~JuK();
signals:
void editSignal();
void newSongSignal(const QString& songTitle);
void signalEdit();
void signalNewSong(const QString& songTitle);
private:
// private methods
......@@ -72,10 +72,16 @@ private:
void invokeEditSlot(const char *slotName, const char *slot);
QString playingString() const;
void updatePlaylistInfo();
/**
* This is the main method to play stuff. Everything else is just a wrapper
* around this.
*/
void play(const QString &file);
private slots:
void playlistChanged();
void updatePlaylistInfo();
void slotPlaylistChanged();
// edit menu
void cut();
......@@ -84,44 +90,37 @@ private slots:
void clear();
void selectAll();
// m_player menu
void play();
void pause();
void stop();
void back();
void forward();
// player menu
void slotPlay();
void slotPause();
void slotStop();
void slotBack();
void slotForward();
// settings menu
void showGenreListEditor();
void toggleSystemTray(bool enabled);
void setOutput(int output);
void slotShowGenreListEditor();
void slotToggleSystemTray(bool enabled);
void slotSetOutput(int output);
// additional m_player slots
void trackPositionSliderClick();
void trackPositionSliderRelease();
void trackPositionSliderUpdate(int position);
// additional player slots
void slotTrackPositionSliderClicked();
void slotTrackPositionSliderReleased();
void slotTrackPositionSliderUpdate(int position);
/**
* This method is called to check our progress in the playing file. It uses
* m_playTimer to know when to call itself again.
*/
void pollPlay();
void slotPollPlay();
/**
* This method is called by the slider to set the volume of the m_player. Its
* This method is called by the slider to set the volume of the player. Its
* value is relative to the maxValue() of the volume slider.
*/
void setVolume(int volume);
/**
* This is the main method to play stuff. Everything else is just a wrapper
* around this.
*/
void play(const QString &file);
void playSelectedFile() { play(m_splitter->playSelectedFile()); }
void playFirstFile() { play(m_splitter->playFirstFile()); }
void slotSetVolume(int volume);
void slotPlaySelectedFile() { play(m_splitter->playSelectedFile()); }
void slotPlayFirstFile() { play(m_splitter->playFirstFile()); }
void slotToggleMenuBar() { menuBar()->isVisible() ? menuBar()->hide() : menuBar()->show(); }
void slotToggleToolBar() { toolBar()->isVisible() ? toolBar()->hide() : toolBar()->show(); }
......@@ -157,7 +156,7 @@ private:
bool m_noSeek;
bool m_restore;
static const int pollInterval = 800;
static const int m_pollInterval = 800;
};
#endif
......@@ -194,7 +194,7 @@ void PlaylistBox::rename(Item *item)
item->setText(name);
// Telling the playlist to change it's name will emit a signal that
// is connected to PlaylistItem::setName().
// is connected to Item::slotSetName().
if(item->playlist())
item->playlist()->setName(name);
......@@ -391,7 +391,7 @@ PlaylistBox::Item::Item(PlaylistBox *listbox, const QPixmap &pix, const QString
setOrientation(Qt::Vertical);
listbox->addName(text);
connect(l, SIGNAL(signalNameChanged(const QString &)), this, SLOT(setName(const QString &)));
connect(l, SIGNAL(signalNameChanged(const QString &)), this, SLOT(slotSetName(const QString &)));
}
PlaylistBox::Item::Item(PlaylistBox *listbox, const QString &text, Playlist *l)
......@@ -406,7 +406,7 @@ PlaylistBox::Item::~Item()
}
void PlaylistBox::Item::setName(const QString &name)
void PlaylistBox::Item::slotSetName(const QString &name)
{
if(listBox()) {
listBox()->m_names.remove(text());
......
......@@ -122,16 +122,22 @@ class PlaylistBox::Item : public QObject, public ListBoxPixmap
Q_OBJECT
// moc won't let me create private QObject subclasses and Qt won't let me
// make the destructor protected, so here's the closest hack that will
// compile.
public:
virtual ~Item();
protected:
Item(PlaylistBox *listbox, const QPixmap &pix, const QString &text, Playlist *l = 0);
Item(PlaylistBox *listbox, const QString &text, Playlist *l = 0);
virtual ~Item();
Playlist *playlist() const { return m_list; }
PlaylistBox *listBox() const { return static_cast<PlaylistBox *>(ListBoxPixmap::listBox()); }
public slots:
void setName(const QString &name);
void slotSetName(const QString &name);
private:
Playlist *m_list;
......
......@@ -298,8 +298,8 @@ void PlaylistSplitter::slotOpenDirectory()
m_directoryQueue.clear();
connect(l, SIGNAL(directoryAdded(const QString &)), this, SLOT(slotQueueDirectory(const QString &)));
connect(l, SIGNAL(directoryRemoved(const QString &)), this, SLOT(slotQueueDirectoryRemove(const QString &)));
connect(l, SIGNAL(signalDirectoryAdded(const QString &)), this, SLOT(slotQueueDirectory(const QString &)));
connect(l, SIGNAL(signalDirectoryRemoved(const QString &)), this, SLOT(slotQueueDirectoryRemove(const QString &)));
if(l->exec() == QDialog::Accepted) {
open(m_directoryQueue);
......
......@@ -89,7 +89,7 @@ QSlider *SliderAction::getVolumeSlider() const
// public slots
////////////////////////////////////////////////////////////////////////////////
void SliderAction::updateOrientation(QDockWindow *dockWindow)
void SliderAction::slotUpdateOrientation(QDockWindow *dockWindow)
{
// if the toolbar is not null and either the dockWindow not defined or is the toolbar
if(customWidget && toolbar && (!dockWindow || dockWindow == dynamic_cast<QDockWindow *>(toolbar))) {
......@@ -104,7 +104,7 @@ void SliderAction::updateOrientation(QDockWindow *dockWindow)
m_layout->setDirection(QBoxLayout::LeftToRight);
}
}
updateSize();
slotUpdateSize();
}
////////////////////////////////////////////////////////////////////////////////
......@@ -138,8 +138,7 @@ QWidget *SliderAction::createWidget(QWidget *parent) // virtual -- used by base
// setWidget(base);
connect(parent, SIGNAL(modechange()), this, SLOT(updateLabels()));
connect(parent, SIGNAL(modechange()), this, SLOT(updateSize()));
connect(parent, SIGNAL(modechange()), this, SLOT(slotUpdateSize()));
return base;
}
else
......@@ -150,12 +149,7 @@ QWidget *SliderAction::createWidget(QWidget *parent) // virtual -- used by base
// private slots
////////////////////////////////////////////////////////////////////////////////
void SliderAction::updateLabels()
{
}
void SliderAction::updateSize()
void SliderAction::slotUpdateSize()
{
static const int offset = 3;
static const int absoluteMax = 10000;
......@@ -175,8 +169,6 @@ void SliderAction::updateSize()
m_trackPositionSlider->setMaximumHeight(toolbar->iconSize() - offset);
m_trackPositionSlider->setMaximumWidth(absoluteMax);
}
// kdDebug() << "SliderAction::updateLabels()" << endl;
// kdDebug() << toolbar->iconSize() << endl;
}
}
......
......@@ -35,14 +35,13 @@ public:
QSlider *getTrackPositionSlider() const;
public slots:
void updateOrientation(QDockWindow *dockWindow = 0);
void slotUpdateOrientation(QDockWindow *dockWindow = 0);
private:
QWidget *createWidget(QWidget *parent);
private slots:
void updateLabels();
void updateSize();
void slotUpdateSize();
private:
QBoxLayout *m_layout;
......
......@@ -39,14 +39,11 @@ SystemTray::SystemTray(QWidget *parent, const char *name) : KSystemTray(parent,
setPixmap(m_appPix);
KPopupMenu *cm = contextMenu();
//cm->insertTitle(i18n("Playing"));
cm->insertItem(m_playPix, i18n("Play"), this, SIGNAL(play()));
cm->insertItem(m_pausePix, i18n("Pause"), this, SIGNAL(pause()));
cm->insertItem(SmallIcon("player_stop"), i18n("Stop"), this, SIGNAL(stop()));
cm->insertItem(SmallIcon("player_start"), i18n("Back"), this, SIGNAL(back()));
cm->insertItem(SmallIcon("player_end" ), i18n("Forward"), this, SIGNAL(forward()));
// connect(m_blinkTimer, SIGNAL(timeout()), this, SLOT(slotBlink()));
cm->insertItem(m_playPix, i18n("Play"), this, SIGNAL(signalPlay()));
cm->insertItem(m_pausePix, i18n("Pause"), this, SIGNAL(signalPause()));
cm->insertItem(SmallIcon("player_stop"), i18n("Stop"), this, SIGNAL(signalStop()));
cm->insertItem(SmallIcon("player_start"), i18n("Back"), this, SIGNAL(signalBack()));
cm->insertItem(SmallIcon("player_end" ), i18n("Forward"), this, SIGNAL(signalForward()));
}
SystemTray::~SystemTray()
......@@ -64,20 +61,6 @@ void SystemTray::slotNewSong(const QString& songName)
QToolTip::add(this, songName);
}
void SystemTray::slotPlay()
{
setPixmap(m_playPix);
// m_currentPix = m_playPix;
// m_blinkTimer->start(blinkInterval);
}
void SystemTray::slotPause()
{
setPixmap(m_pausePix);
// m_currentPix = m_pausePix;
// m_blinkTimer->start(blinkInterval);
}
void SystemTray::slotStop()
{
m_blinkTimer->stop();
......@@ -85,20 +68,4 @@ void SystemTray::slotStop()
QToolTip::remove(this);
}
////////////////////////////////////////////////////////////////////////////////
// private slots
////////////////////////////////////////////////////////////////////////////////
/*
void SystemTray::slotBlink()
{
if(m_blinkStatus)
setPixmap(m_currentPix);
else
setPixmap(m_appPix);
m_blinkStatus = !m_blinkStatus;
}
*/
#include "systemtray.moc"
......@@ -33,22 +33,17 @@ public:
public slots:
void slotNewSong(const QString& songName);
void slotPlay();
void slotPlay() { setPixmap(m_playPix); }
void slotPause() { setPixmap(m_pausePix); }
void slotStop();
void slotPause();
signals:
void play();
void stop();
void pause();
void forward();
void back();
/*
* private slots:
* void slotBlink();
*/
void signalPlay();
void signalStop();
void signalPause();
void signalForward();
void signalBack();
private:
QTimer *m_blinkTimer;
bool m_blinkStatus;
......@@ -56,8 +51,6 @@ private:
QPixmap m_pausePix;
QPixmap m_currentPix;
QPixmap m_appPix;
static const int blinkInterval = 1000;
};
#endif // SYSTEMTRAY_H
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment