aboutsummaryrefslogblamecommitdiff
path: root/src/plugins/General/fileops/hotkeydialog.ui
blob: fff3429bdf912498e35738d152ad08af3e0472ac (plain) (tree)























































































































                                                                   
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>HotkeyDialog</class>
 <widget class="QDialog" name="HotkeyDialog">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>310</width>
    <height>89</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Modify Shortcut</string>
  </property>
  <layout class="QGridLayout" name="gridLayout">
   <property name="leftMargin">
    <number>6</number>
   </property>
   <property name="rightMargin">
    <number>6</number>
   </property>
   <property name="bottomMargin">
    <number>6</number>
   </property>
   <item row="0" column="0" colspan="3">
    <widget class="QLabel" name="label">
     <property name="text">
      <string>Press the key combination you want to assign</string>
     </property>
    </widget>
   </item>
   <item row="1" column="0" colspan="3">
    <widget class="QLineEdit" name="keyLineEdit">
     <property name="readOnly">
      <bool>true</bool>
     </property>
    </widget>
   </item>
   <item row="2" column="0">
    <widget class="QPushButton" name="clearButton">
     <property name="text">
      <string>Clear</string>
     </property>
    </widget>
   </item>
   <item row="2" column="1">
    <spacer name="horizontalSpacer">
     <property name="orientation">
      <enum>Qt::Horizontal</enum>
     </property>
     <property name="sizeHint" stdset="0">
      <size>
       <width>106</width>
       <height>20</height>
      </size>
     </property>
    </spacer>
   </item>
   <item row="2" column="2">
    <widget class="QDialogButtonBox" name="buttonBox">
     <property name="standardButtons">
      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
     </property>
    </widget>
   </item>
  </layout>
 </widget>
 <resources/>
 <connections>
  <connection>
   <sender>buttonBox</sender>
   <signal>accepted()</signal>
   <receiver>HotkeyDialog</receiver>
   <slot>accept()</slot>
   <hints>
    <hint type="sourcelabel">
     <x>212</x>
     <y>70</y>
    </hint>
    <hint type="destinationlabel">
     <x>192</x>
     <y>269</y>
    </hint>
   </hints>
  </connection>
  <connection>
   <sender>buttonBox</sender>
   <signal>rejected()</signal>
   <receiver>HotkeyDialog</receiver>
   <slot>reject()</slot>
   <hints>
    <hint type="sourcelabel">
     <x>212</x>
     <y>70</y>
    </hint>
    <hint type="destinationlabel">
     <x>246</x>
     <y>214</y>
    </hint>
   </hints>
  </connection>
  <connection>
   <sender>clearButton</sender>
   <signal>clicked()</signal>
   <receiver>keyLineEdit</receiver>
   <slot>clear()</slot>
   <hints>
    <hint type="sourcelabel">
     <x>195</x>
     <y>22</y>
    </hint>
    <hint type="destinationlabel">
     <x>113</x>
     <y>25</y>
    </hint>
   </hints>
  </connection>
 </connections>
</ui>
>
97c98d9d5

2d622fd9b
26da2f9c1
1e7a7fdfd

26da2f9c1
1e7a7fdfd
26da2f9c1
5e26d3a30
26da2f9c1
2972e8742
11b7655bb
1e7a7fdfd
ae75e5707
fa1e4194b
5e26d3a30
013ee07b5
26da2f9c1
97c98d9d5
2d622fd9b

2d622fd9b
5e26d3a30
ae75e5707
fa1e4194b
5e26d3a30
2d622fd9b
97c98d9d5
















2d622fd9b

5e26d3a30


5e26d3a30
97c98d9d5
0c29a6aee
5e26d3a30
5e26d3a30
5e26d3a30

2d622fd9b



97c98d9d5
2d622fd9b


97c98d9d5
8a8a45ea2

97c98d9d5
8a8a45ea2
2d622fd9b



5e26d3a30
2d622fd9b
5e26d3a30
5e26d3a30
5e26d3a30
5e26d3a30
2d622fd9b


5e26d3a30
5e26d3a30
5e26d3a30
5e26d3a30
2d622fd9b




11b7655bb
26da2f9c1
97c98d9d5
2d622fd9b
080507d3a


1e7a7fdfd
080507d3a
5e26d3a30



97c98d9d5
5e26d3a30

5e26d3a30

26da2f9c1
5e26d3a30


5e26d3a30


5e26d3a30
97c98d9d5





5e26d3a30
3ffc8b54a
5e26d3a30
5e26d3a30


5e26d3a30
b5833f942


3ffc8b54a
b5833f942
5e26d3a30

97c98d9d5

5e26d3a30

97c98d9d5
4ccbc35ad
97c98d9d5

5e26d3a30

390f66a39
c4c36008b



2702b572b
5e26d3a30



2702b572b

5e26d3a30
2702b572b

5e26d3a30



0e860ae0b
5e26d3a30


0e860ae0b
5e26d3a30
0e860ae0b
0b46e2db0
5e26d3a30
4ccbc35ad
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
                                                                            
                                                                            














                                                                            
                                                                            





                                                                             
                    
 
                          


                   

                            
                    
                     
                       
 
                                   


                                   
                    
                              
                                                     
                                                       
                     
                 
                      

                  
             
                                                                                  

                                                                
                                                                                         
                                                                        
                                                                                     
                                                       
                                                                                  
                                                             
                     
                                                                     
                                                                 
                                                              
                
                   
                                                     
                      

 
                     
 
                                                                 
                                                       
 
 
















                                        

                                                  


                                   
                             
                                               
                                       
              
                         

                                               



                                              
                                   


                                                 
                                                   

                                                 
                                           
     



                                
          
     
                     
                                                                    
            
                                                             


        
                     
                                                                    
            
                                                             




                           
                     
                                                     
                      
 


                             
                                                           
 



                         
                            

                 

                                                                
                                                                                             


                                                            


                                              
                          





                                                                                 
                                          
                              
                         


        
                                                         


                                     
                                 
                                

                          

                      

                        
                                                                     
                

                                                               

 
                                                    



                         
                                      



                           

                                                    
 

                                                



                                           
                                   


                       
                 
                                        
        
                                                      
 
 
/***************************************************************************
 *   Copyright (C) 2007-2009 by Ilya Kotov                                 *
 *   forkotov02@hotmail.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 <QMainWindow>
#include <QApplication>
#include <QMouseEvent>
#include <QMenu>
#include <QSettings>

#include "symboldisplay.h"
#include "skin.h"
#include "button.h"
#include "dock.h"
#include "titlebarcontrol.h"
#include "shadedvisual.h"
#include "display.h"
#include "titlebar.h"
#include "mainwindow.h"

// TODO skin cursor with shade mode
TitleBar::TitleBar(QWidget *parent)
        : PixmapWidget(parent)
{
    m_align = false;
    m_skin = Skin::instance();
    setPixmap(m_skin->getTitleBar(Skin::TITLEBAR_A));
    m_mw = qobject_cast<MainWindow*>(parent->parent());
    m_shaded = false;
    m_shade2 = 0;
    m_currentTime = 0;
    m_control = 0;
    m_visual = 0;
    //buttons
    m_menu = new Button(this,Skin::BT_MENU_N,Skin::BT_MENU_P, Skin::CUR_MAINMENU);
    connect(m_menu,SIGNAL(clicked()),this,SLOT(showMainMenu()));
    m_menu->move(6,3);
    m_minimize = new Button(this,Skin::BT_MINIMIZE_N,Skin::BT_MINIMIZE_P, Skin::CUR_MIN);
    connect(m_minimize, SIGNAL(clicked()), m_mw, SLOT(showMinimized()));
    m_shade = new Button(this,Skin::BT_SHADE1_N,Skin::BT_SHADE1_P, Skin::CUR_WINBUT);
    connect(m_shade, SIGNAL(clicked()), SLOT(shade()));
    m_close = new Button(this,Skin::BT_CLOSE_N,Skin::BT_CLOSE_P, Skin::CUR_CLOSE);
    connect(m_close, SIGNAL(clicked()), m_mw, SLOT(close()));
    setActive(false);
    connect(m_skin, SIGNAL(skinChanged()), this, SLOT(updateSkin()));
    QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
    if (settings.value("Skinned/disp_shaded", false).toBool())
        shade();
    m_align = true;
    setCursor(m_skin->getCursor(Skin::CUR_TITLEBAR));
    updatePositions();
}

TitleBar::~TitleBar()
{
    QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
    settings.setValue("Skinned/disp_shaded", m_shaded);
}

void TitleBar::updatePositions()
{
    int r = m_skin->ratio();
    m_menu->move(r*6, r*3);
    m_minimize->move(r*244, r*3);
    m_shade->move(r*254, r*3);
    m_close->move(r*264, r*3);
    if(m_shade2)
        m_shade2->move(r*254, r*3);
    if(m_currentTime)
        m_currentTime->move(r*127, r*4);
    if(m_control)
        m_control->move(r*168, r*2);
    if(m_visual)
        m_visual->move(r*79,r*5);
}

void TitleBar::mousePressEvent(QMouseEvent* event)
{
    switch ((int) event->button ())
    {
    case Qt::LeftButton:
        m_pos = event->pos();
        Dock::instance()->calculateDistances();
        Dock::instance()->updateDock();
        break;
    case Qt::RightButton:
        m_mw->menu()->exec(event->globalPos());
    }
}

void TitleBar::mouseReleaseEvent(QMouseEvent*)
{
    Dock::instance()->updateDock();
}
void TitleBar::mouseMoveEvent(QMouseEvent* event)
{
    if (m_pos.x() < width() - m_skin->ratio() * 37)
    {
        QPoint npos = (event->globalPos()-m_pos);
        Dock::instance()->move(m_mw, npos);
    }
}

void TitleBar::setActive(bool a)
{
    if (a)
    {
        if (m_shaded)
            setPixmap(m_skin->getTitleBar(Skin::TITLEBAR_SHADED_A));
        else
            setPixmap(m_skin->getTitleBar(Skin::TITLEBAR_A));
    }
    else
    {
        if (m_shaded)
            setPixmap(m_skin->getTitleBar(Skin::TITLEBAR_SHADED_I));
        else
            setPixmap(m_skin->getTitleBar(Skin::TITLEBAR_I));
    }
}

void TitleBar::updateSkin()
{
    setActive(false);
    setCursor(m_skin->getCursor(Skin::CUR_TITLEBAR));
    updatePositions();
}

void TitleBar::showMainMenu()
{
    m_mw->menu()->exec(m_menu->mapToGlobal(m_menu->pos()));
}

void TitleBar::shade()
{
    m_shaded = !m_shaded;
    int r = m_skin->ratio();
    if (m_shaded)
    {
        setPixmap(m_skin->getTitleBar(Skin::TITLEBAR_SHADED_A));
        m_shade->hide();
        m_shade2 = new Button(this,Skin::BT_SHADE2_N, Skin::BT_SHADE2_P, Skin::CUR_WSNORMAL);
        connect(m_shade2, SIGNAL(clicked()), SLOT(shade()));
        m_shade2->show();
        m_currentTime = new SymbolDisplay(this, 6);
        m_currentTime->show();
        m_currentTime->display("--:--");
        m_control = new TitleBarControl(this);
        m_control->show();
        connect (m_control, SIGNAL (nextClicked()), m_mw, SLOT (next()));
        connect (m_control, SIGNAL (previousClicked()), m_mw, SLOT (previous()));
        connect (m_control, SIGNAL (playClicked()), m_mw, SLOT (play()));
        connect (m_control, SIGNAL (pauseClicked()), m_mw, SLOT (pause()));
        connect (m_control, SIGNAL (stopClicked()), m_mw, SLOT (stop()));
        connect (m_control, SIGNAL (ejectClicked()), m_mw, SLOT (addFile()));
        m_visual = new ShadedVisual(this);
        Visual::add(m_visual);
        m_visual->show();
    }
    else
    {
        setPixmap(m_skin->getTitleBar(Skin::TITLEBAR_A));
        m_shade2->deleteLater();
        m_currentTime->deleteLater();
        m_control->deleteLater();
        Visual::remove(m_visual);
        m_visual->deleteLater();
        m_shade2 = 0;
        m_currentTime = 0;
        m_control = 0;
        m_visual = 0;
        m_shade->show();
    }
    qobject_cast<MainDisplay *> (parent())->setMinimalMode(m_shaded);
    if (m_align)
        Dock::instance()->align(m_mw, m_shaded? -r*102: r*102);
    updatePositions();
}

void TitleBar::mouseDoubleClickEvent (QMouseEvent *)
{
       TitleBar::shade();
}

QString TitleBar::formatTime (int sec)
{
    int minutes = sec / 60;
    int seconds = sec % 60;

    QString str_minutes = QString::number (minutes);
    QString str_seconds = QString::number (seconds);

    if (minutes < 10) str_minutes.prepend ("0");
    if (seconds < 10) str_seconds.prepend ("0");

    return str_minutes + ":" + str_seconds;
}

void TitleBar::setTime(qint64 time)
{
    if (!m_currentTime)
        return;
    if (time < 0)
        m_currentTime->display("--:--");
    else
        m_currentTime->display(formatTime(time/1000));
}