aboutsummaryrefslogtreecommitdiff
path: root/src/ui/actionmanager.h
Commit message (Expand)AuthorAgeFilesLines
* added 'show playlist' and 'show equalizer' hotkeystrialuser022010-11-141-1/+5
* completed shortcut editortrialuser022010-11-041-4/+32
* some shortcut editor changestrialuser022010-11-021-0/+9
* changed playlist api, prepare for shortcut editor implementation, fixed direc...trialuser022010-11-011-0/+70
09-02-25 10:55:15 +0000 committer trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> 2009-02-25 10:55:15 +0000 added projectm visual plugin (not ready yet)' href='/qmmp/commit/src/plugins/Visual/projectm/projectmwidget.cpp?h=main&id=d36f67b99809a6fd3ca88832a998a0a1fd0de890'>d36f67b99
4df23e9b8

5a9a5f839
4df23e9b8
d36f67b99












a8bf072ec
d36f67b99




4df23e9b8
c82fb7ff0
283814627
4df23e9b8

283814627
d36f67b99

4df23e9b8



283814627
d36f67b99

013ee07b5
283814627
d36f67b99
d81a31df5
283814627
4df23e9b8

5c958473b
d81a31df5


283814627
5c958473b
d36f67b99



283814627
d36f67b99
4df23e9b8
d36f67b99
























d81a31df5
d36f67b99

d81a31df5







c82fb7ff0


d81a31df5






283814627
d81a31df5
283814627
d81a31df5

4df23e9b8




6db4985b5




4df23e9b8
d36f67b99
8bff1fb43
6db4985b5

4df23e9b8
6db4985b5
283814627

d36f67b99
283814627

4df23e9b8
d81a31df5
d36f67b99
















4df23e9b8








283814627



4df23e9b8



283814627
4df23e9b8
97350da0f
4df23e9b8
283814627
4df23e9b8































283814627
4df23e9b8
283814627
4df23e9b8

4df23e9b8





283814627




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) 2009-2015 by Ilya Kotov                                 *
 *   forkotov02@hotmail.ru                                                 *
 *                                                                         *
 *   Copyright (C) 2007 by  projectM team                                  *
 *                                                                         *
 *   Carmelo Piccione  carmelo.piccione+projectM@gmail.com                 *
 *                                                                         *
 *   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 <QTimer>
#include <QDir>
#include <QKeyEvent>
#include <QMenu>
#include <QApplication>
#include <QListWidget>
#include <qmmp/soundcore.h>
#include <qmmp/qmmp.h>
#include "projectmwrapper.h"
#include "projectmwidget.h"

#ifndef PROJECTM_CONFIG
#define PROJECTM_CONFIG "/usr/share/projectM/config.inp"
#endif

ProjectMWidget::ProjectMWidget(QListWidget *listWidget, QWidget *parent)
        : QGLWidget(parent)
{
    setMouseTracking(true);
    m_listWidget = listWidget;
    m_projectM = 0;
    m_timer = new QTimer(this);
    connect(m_timer, SIGNAL(timeout()),SLOT(updateGL()));
    m_menu = new QMenu(this);
    connect(SoundCore::instance(), SIGNAL(metaDataChanged()), SLOT(updateTitle()));
#if QT_VERSION >= 0x040700
    qDebug("ProjectMWidget: opengl version: %d.%d",
           context()->format().majorVersion(),
           context()->format().minorVersion());
    createActions();
#endif
}


ProjectMWidget::~ProjectMWidget()
{}

projectM *ProjectMWidget::projectMInstance()
{
    return m_projectM;
}

void ProjectMWidget::initializeGL()
{
    glShadeModel(GL_SMOOTH);
    glClearColor(0,0,0,0);
    // Setup our viewport
    glViewport(0, 0, width(), height());
    // Change to the projection matrix and set our viewing volume.
    glMatrixMode(GL_TEXTURE);
    glLoadIdentity();
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glDrawBuffer(GL_BACK);
    glReadBuffer(GL_BACK);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glEnable(GL_LINE_SMOOTH);
    glEnable(GL_POINT_SMOOTH);
    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    glLineStipple(2, 0xAAAA);

    if (!m_projectM)
    {
#ifdef Q_OS_WIN
        projectM::Settings settings;
        settings.meshX = 32;
        settings.meshY = 24;
        settings.fps = 35;
        settings.textureSize = 1024;
        settings.windowWidth = 512;
        settings.windowHeight = 512;
        settings.presetURL = QString(qApp->applicationDirPath() + "/projectM/presets").toLocal8Bit().constData();
        settings.titleFontURL = QString(qApp->applicationDirPath() + "/projectM/fonts/Vera.ttf").toLocal8Bit().constData();
        settings.menuFontURL = QString(qApp->applicationDirPath() + "/projectM/fonts/VeraMono.ttf").toLocal8Bit().constData();
        settings.smoothPresetDuration = 5;
        settings.presetDuration = 30;
        settings.beatSensitivity = 1.0;
        settings.aspectCorrection = true;
        settings.easterEgg = 1.0;
        settings.shuffleEnabled = false;
        settings.softCutRatingsEnabled = false;
        m_projectM = new ProjectMWrapper(settings, projectM::FLAG_DISABLE_PLAYLIST_LOAD, this);
#else
        m_projectM = new ProjectMWrapper(PROJECTM_CONFIG, projectM::FLAG_DISABLE_PLAYLIST_LOAD, this);
#endif
        QString presetPath = QString::fromLocal8Bit(m_projectM->settings().presetURL.c_str());
        QDir presetDir(presetPath);
        presetDir.setFilter(QDir::Files);
        QStringList filters;
        filters << "*.prjm" << "*.milk";
        QFileInfoList l = presetDir.entryInfoList(filters);
#ifdef PROJECTM_20
        RatingList list;
        list.push_back(3);
        list.push_back(3);
#endif
        foreach (QFileInfo info, l)
        {
#ifdef PROJECTM_20
            m_projectM->addPresetURL (info.absoluteFilePath().toStdString(), info.fileName().toStdString(), list);
#else
            m_projectM->addPresetURL (info.absoluteFilePath().toStdString(), info.fileName().toStdString(), 1);
#endif
            m_listWidget->addItem(info.fileName());
            m_listWidget->setCurrentRow(0,QItemSelectionModel::Select);
        }
        connect(m_listWidget, SIGNAL(currentRowChanged(int)), m_projectM, SLOT(selectPreset(int)));
        connect(m_projectM, SIGNAL(currentPresetChanged(int)), SLOT(setCurrentRow(int)));
        updateTitle();
        m_timer->start(0);
    }
}

void ProjectMWidget::resizeGL (int w, int h)
{
    if (m_projectM)
    {
        m_projectM->projectM_resetGL(w, h);
        initializeGL();
    }
}

void ProjectMWidget::paintGL()
{
    if (m_projectM)
        m_projectM->renderFrame();
}