diff options
author | Arno <arno@disconnect.de> | 2017-04-09 02:53:39 +0200 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2017-04-09 02:53:39 +0200 |
commit | 8d0f7783a4db453ccb0ac5f05798f277f5c01f65 (patch) | |
tree | e9e180cb7279bb39f6c029ef3e884bb9c47e6222 | |
parent | 1355b93895e68f6ccc8709f919a65b04238e126c (diff) | |
download | BeetPlayer-8d0f7783a4db453ccb0ac5f05798f277f5c01f65.tar.gz BeetPlayer-8d0f7783a4db453ccb0ac5f05798f277f5c01f65.tar.bz2 BeetPlayer-8d0f7783a4db453ccb0ac5f05798f277f5c01f65.zip |
Remove tool window
It was kinda useless, didn't work out, sorry, ToolWindow :)
-rw-r--r-- | BeetPlayer.pro | 6 | ||||
-rw-r--r-- | playerwidget.cpp | 20 | ||||
-rw-r--r-- | playerwidget.h | 2 | ||||
-rw-r--r-- | toolwindow.cpp | 46 | ||||
-rw-r--r-- | toolwindow.h | 24 |
5 files changed, 2 insertions, 96 deletions
diff --git a/BeetPlayer.pro b/BeetPlayer.pro index 15d495e..0598033 100644 --- a/BeetPlayer.pro +++ b/BeetPlayer.pro @@ -32,8 +32,7 @@ SOURCES += main.cpp\ playerwidget.cpp \ beetview.cpp \ indexerdialog.cpp \ - helper.cpp \ - toolwindow.cpp + helper.cpp HEADERS += beetplayer.h \ configurationdialog.h \ @@ -42,8 +41,7 @@ HEADERS += beetplayer.h \ playerwidget.h \ beetview.h \ indexerdialog.h \ - helper.h \ - toolwindow.h + helper.h LIBS += -ltag diff --git a/playerwidget.cpp b/playerwidget.cpp index 563f531..1e4a7c6 100644 --- a/playerwidget.cpp +++ b/playerwidget.cpp @@ -31,7 +31,6 @@ #include "playerwidget.h" #include "beetview.h" #include "indexerdialog.h" -#include "toolwindow.h" #include "globals.h" #include "helper.h" @@ -55,9 +54,6 @@ void PlayerWidget::setupGui(){ mTrayIcon->setIcon(QIcon(":/stop.png")); mTrayIcon->show(); - //tool window - mToolWin = new ToolWindow; - //THE view mView = new BeetView; mView->setAlternatingRowColors(true); @@ -638,8 +634,6 @@ void PlayerWidget::doPlay(){ emit setWinTitle(mCurWinTitle); mTrayIcon->setIcon(QIcon(":/play.png")); mTrayIcon->setToolTip(mCurWinTitle); - mToolWin->toHTML(tr("[Continue...]")); - mToolWin->showMe(); return; } int playListCount = mPlayListModel->rowCount(); @@ -664,8 +658,6 @@ void PlayerWidget::doStop(){ emit setWinTitle(winTitle); mTrayIcon->setIcon(QIcon(":/stop.png")); mTrayIcon->setToolTip(tr("[Stopped]")); - mToolWin->toHTML("[Stopped]"); - mToolWin->showMe(); } void PlayerWidget::doPause(){ @@ -676,8 +668,6 @@ void PlayerWidget::doPause(){ emit setWinTitle(winTitle); mTrayIcon->setIcon(QIcon(":/pause.png")); mTrayIcon->setToolTip(tr("[Paused]")); - mToolWin->toHTML("[Paused]"); - mToolWin->showMe(); } void PlayerWidget::doPlayOrPause(){ @@ -1021,8 +1011,6 @@ void PlayerWidget::play(const QString &fullPath){ toolStr.append(QString("<p style=\"margin:7px;\"><span style=\"font-weight: bold; font-size: large;\">%1</span></p>").arg(artist)); toolStr.append(QString("<p style=\"margin:7px;\"><span style=\"font-weight: normal; font-size: medium;\">%1</span></p>").arg(title)); toolStr.append("</body></html>"); - mToolWin->setText(toolStr); - mToolWin->showMe(); mPlayer->play(); mPlayA->setChecked(true); @@ -1033,18 +1021,10 @@ void PlayerWidget::volumeChanged(int volume){ QString s = QString("%1 %").arg(volume, 3, 10, QChar('0')); mVolumePos->setText(s); QString tool = QString(tr("Volume: %1")).arg(s); - mToolWin->toHTML(tool); - mToolWin->showMe(); } void PlayerWidget::mute(bool triggered){ mPlayer->setMuted(triggered); - if(triggered){ - mToolWin->toHTML(tr("[Muted]")); - }else{ - mToolWin->toHTML(tr("[Unmuted]")); - } - mToolWin->showMe(); } void PlayerWidget::next(){ diff --git a/playerwidget.h b/playerwidget.h index 16303dd..f42a882 100644 --- a/playerwidget.h +++ b/playerwidget.h @@ -16,7 +16,6 @@ class QToolBar; class QAction; class BeetPlayerProxy; class BeetView; -class ToolWindow; class QSystemTrayIcon; class PlayerWidget : public QWidget { @@ -120,7 +119,6 @@ class PlayerWidget : public QWidget { QString mCurDir; QString mCurWinTitle; QSystemTrayIcon *mTrayIcon; - ToolWindow *mToolWin; }; #endif // PLAYERWIDGET_H diff --git a/toolwindow.cpp b/toolwindow.cpp deleted file mode 100644 index 240017c..0000000 --- a/toolwindow.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include <QLabel> -#include <QTimer> -#include <QHBoxLayout> -#include <QDesktopWidget> -#include <QApplication> -#include <kwindowsystem.h> - -#include "toolwindow.h" - -ToolWindow::ToolWindow(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f){ - setWindowOpacity(0.8); - KWindowSystem::setOnAllDesktops(winId(), true); - KWindowSystem::setState(winId(), NET::KeepAbove | NET::SkipTaskbar | NET::SkipPager); - mLabel = new QLabel; - mLabel->setFrameStyle(QFrame::Panel | QFrame::Plain); - mLabel->setFont(QFont("courier", 16, QFont::Bold)); - mLabel->setAlignment(Qt::AlignCenter); - QHBoxLayout *mainLayout = new QHBoxLayout; - mainLayout->addWidget(mLabel); - mHideTimer = new QTimer(this); - connect(mHideTimer, &QTimer::timeout, this, &QWidget::hide); - setLayout(mainLayout); -} - -void ToolWindow::setText(const QString &text){ - mLabel->setText(text); -} - -void ToolWindow::toHTML(const QString &text){ - QString html; - html.append(QString("<p style=\"margin:7px;\"><span style=\"font-weight: bold; font-size: large;\">%1</span></p>").arg(text)); - mLabel->setText(html); -} - -void ToolWindow::showMe(){ - QDesktopWidget *dw = QApplication::desktop(); - QRect screenRect = dw->screenGeometry(QCursor::pos()); - QPoint screenCenter = screenRect.center(); - QPoint where(screenCenter.x() - width() / 2, 150); - move(where); - KWindowSystem::setOnDesktop(winId(), KWindowSystem::currentDesktop()); - mHideTimer->stop(); - mHideTimer->start(5000); - show(); - raise(); -} diff --git a/toolwindow.h b/toolwindow.h deleted file mode 100644 index 7f8e621..0000000 --- a/toolwindow.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef TOOLWINDOW_H -#define TOOLWINDOW_H - -#include <QWidget> - -class QLabel; -class QTimer; - -class ToolWindow : public QWidget { - Q_OBJECT - public: - explicit ToolWindow(QWidget *parent = 0, Qt::WindowFlags f = Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus); - - public slots: - void setText(const QString &text); - void toHTML(const QString &text); - void showMe(); - - private: - QLabel *mLabel; - QTimer *mHideTimer; -}; - -#endif // TOOLWINDOW_H |