aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/General/udisks/udisksplugin.cpp
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2017-08-04 17:31:44 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2017-08-04 17:31:44 +0000
commit778363dcb151b6088446115ea414ca3527aff714 (patch)
tree949c6bdcbe5a619b6492f4baf9ed3ad3f155fb4b /src/plugins/General/udisks/udisksplugin.cpp
parent0a39ea11b95bd8327a06ff553b2dac449561ef97 (diff)
downloadqmmp-778363dcb151b6088446115ea414ca3527aff714.tar.gz
qmmp-778363dcb151b6088446115ea414ca3527aff714.tar.bz2
qmmp-778363dcb151b6088446115ea414ca3527aff714.zip
updated AUTHORS
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@7348 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/General/udisks/udisksplugin.cpp')
0 files changed, 0 insertions, 0 deletions
00277d122ccd9'>a9946929b
16aab306c
32b99cd71

a9946929b
32b99cd71


5b126a927
32b99cd71
11b7655bb
1ac726775
ef4bb82a1



1ac726775
873b67f01
1ac726775
120e292ac
1ac726775
873b67f01





727577dc8
1ac726775
96cfa27dc
873b67f01
727577dc8




873b67f01


013ee07b5
6b542a5fb
873b67f01






6b542a5fb
873b67f01




a9946929b
96cfa27dc
4edc74173
1ac726775
1ac726775
ef4bb82a1
4edc74173
ef4bb82a1
727577dc8

ce25692d5
727577dc8





d2b37ec8f
120e292ac


873b67f01
873b67f01

9bc167e62
873b67f01

d9a0f7098

873b67f01
1ac726775
873b67f01

d2b37ec8f
abfe5cdbe


873b67f01
873b67f01




32b99cd71
6c988486d

873b67f01
6c988486d
873b67f01
6c988486d
873b67f01
6c988486d
873b67f01
6c988486d
32b99cd71
db6aae42c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
                                                                            
                                                                            
                                                                            













                                                                            
                                                                            









                                                                             
                       
                
                           
                                 

                        
                                         


                                                   
                                                                                    
                                               
                                            
                                                          



                                                          
 
                                
                                  
                                                                       
 





                                                                            
                                                         
                                                           
                                                                                   
                        




                                  


                                
                                  
                                                       






                                                 
           




                                
                                            
 
                                                          
 
                             
 
                                                                      
                     

                                                          
                                                                                                                    





                                                              
                     


                             
                     

                     
 

                                   

                                                          
                    
                                             

                                                                                  
                     


                             
                     




                                  
                               

                                                                     
                                                           
                                                                       
                                                                            
                                                                  
                                                           
                                                                
                                                                         
                                                                
               
 
/***************************************************************************
 *   Copyright (C) 2008-2015 by Ilya Kotov                                 *
 *   forkotov02@ya.ru                                                      *
 *                                                                         *
 *   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; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   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.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
 ***************************************************************************/

#include <QVBoxLayout>
#include <QLabel>
#include <QApplication>
#include <QDesktopWidget>
#include <QTimer>
#include <QPalette>
#include <QSettings>
#include <QDir>
#include <QApplication>
#include <QFont>
#include <qmmp/soundcore.h>
#include <qmmp/metadatamanager.h>
#include "popupwidget.h"

PopupWidget::PopupWidget(QWidget *parent)
        : QFrame(parent)
{
    setWindowFlags(Qt::X11BypassWindowManagerHint |
                   Qt::WindowStaysOnTopHint | Qt::Dialog | Qt::FramelessWindowHint);
    setFrameStyle(QFrame::Box | QFrame::Plain);
    setAttribute(Qt::WA_QuitOnClose, false);
    QHBoxLayout *hlayout = new QHBoxLayout(this); //layout
    m_pixlabel = new QLabel(this);
    m_pixlabel->setPixmap(QPixmap(":/notifier_icon.png"));
    m_pixlabel->setFixedSize(32,32);
    hlayout->addWidget(m_pixlabel);

    m_label1 = new QLabel(this);
    hlayout->addWidget (m_label1);
    setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));

    //settings
    QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
    settings.beginGroup("Notifier");
    int delay = settings.value("message_delay", 2000).toInt();
    m_pos = settings.value("message_pos", PopupWidget::BOTTOMLEFT).toUInt();
    setWindowOpacity(settings.value("opacity", 1.0).toDouble());
    QString fontname = settings.value("font").toString();
    m_coverSize = settings.value("cover_size", 64).toInt();
    m_formatter.setPattern(settings.value("template",DEFAULT_TEMPLATE).toString());
    settings.endGroup();
    //font
    QFont font;
    if(!fontname.isEmpty())
        font.fromString(fontname);
    setFont(font);
    //timer
    m_timer = new QTimer(this);
    m_timer->setInterval(delay);
    m_timer->setSingleShot (true);
    connect(m_timer, SIGNAL(timeout ()), SLOT(hide()));
}

PopupWidget::~PopupWidget()
{}

void PopupWidget::mousePressEvent (QMouseEvent *)
{
    hide();
}

void PopupWidget::showMetaData()
{
    m_timer->stop();
    SoundCore *core = SoundCore::instance();

    QString title = m_formatter.format(core->trackInfo());

    m_label1->setText(title);

    QPixmap pix = MetaDataManager::instance()->getCover(core->path());
    if(!pix.isNull())
    {
        m_pixlabel->setFixedSize(m_coverSize,m_coverSize);
        m_pixlabel->setPixmap(pix.scaled(m_coverSize,m_coverSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
    }
    else
    {
        m_pixlabel->setPixmap(QPixmap(":/notifier_icon.png"));
        m_pixlabel->setFixedSize(32,32);
    }
    updateGeometry();
    setFixedSize(sizeHint());
    update();
    show();
    updatePosition();
    m_timer->start();
}

void PopupWidget::showVolume(int v)
{
    m_pixlabel->setPixmap(QPixmap(":/notifier_icon.png"));
    m_pixlabel->setFixedSize(32,32);
    m_timer->stop();
    m_label1->setAlignment(Qt::AlignVCenter);
    m_label1->setText("<b>" + tr("Volume:") + QString (" %1\%").arg(v)+ + "</b>");

    updateGeometry();
    setFixedSize(sizeHint());
    update();
    show();
    updatePosition();