~ubuntu-branches/ubuntu/hardy/avidemux/hardy

« back to all changes in this revision

Viewing changes to avidemux/ADM_userInterfaces/ADM_QT4/ADM_dialog/Q_eq2.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Matvey Kozhev
  • Date: 2007-12-18 13:53:04 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20071218135304-cdqec2lg2bglyz15
Tags: 1:2.4~preview3-0.0ubuntu1
* Upload to Ubuntu. (LP: #163287, LP: #126572)
* debian/changelog: re-added Ubuntu releases.
* debian/control:
  - Require debhelper >= 5.0.51 (for dh_icons) and imagemagick.
  - Build-depend on libsdl1.2-dev instead of libsdl-dev.
  - Build against newer libx264-dev. (LP: #138854)
  - Removed libamrnb-dev, not in Ubuntu yet.
* debian/rules:
  - Install all icon sizes, using convert (upstream installs none).
  - Added missing calls to dh_installmenu, dh_installman, dh_icons and
    dh_desktop.
* debian/menu, debian/avidemux-qt.menu:
  - Corrected package and executable names.
* debian/avidemux-common.install: Install icons.
* debian/avidemux.common.manpages: Install man/avidemux.1.
* debian/links, debian/avidemux-cli.links, debian/avidemux-gtk.links:
  - Link manpages to avidemux.1.gz.
* debian/install, debian/avidemux-qt.install, debian/avidemux-gtk.desktop,
  debian/avidemux-qt.desktop: Install desktop files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                          Q_eq2.cpp  -  description
 
3
 
 
4
                flyDialog for MPlayer EQ2 filter
 
5
    copyright            : (C) 2002/2007 by mean Fixounet@free.fr
 
6
 ***************************************************************************/
 
7
 
 
8
/***************************************************************************
 
9
 *                                                                         *
 
10
 *   This program is free software; you can redistribute it and/or modify  *
 
11
 *   it under the terms of the GNU General Public License as published by  *
 
12
 *   the Free Software Foundation; either version 2 of the License, or     *
 
13
 *   (at your option) any later version.                                   *
 
14
 *                                                                         *
 
15
 ***************************************************************************/
 
16
 
 
17
#include <config.h>
 
18
#include <string.h>
 
19
#include <stdio.h>
 
20
#include <math.h>
 
21
 
 
22
#include "ui_eq2.h"
 
23
 
 
24
#include "default.h"
 
25
#include "ADM_toolkit/toolkit.hxx"
 
26
#include "ADM_image.h"
 
27
#include "ADM_video/ADM_genvideo.hxx"
 
28
#include "ADM_colorspace/ADM_rgb.h"
 
29
#include "ADM_assert.h"
 
30
#include "ADM_videoFilter/ADM_vidEq2.h"
 
31
 
 
32
#include "DIA_flyDialog.h"
 
33
#include "DIA_flyDialogQt4.h"
 
34
#include "ADM_videoFilter/ADM_vidEq2.h"
 
35
#include "DIA_flyEq2.h"
 
36
 
 
37
//
 
38
//      Video is in YV12 Colorspace
 
39
//
 
40
//
 
41
class Ui_eq2Window : public QDialog
 
42
 {
 
43
     Q_OBJECT
 
44
 protected : 
 
45
    int lock;
 
46
 public:
 
47
     flyEq2 *myCrop;
 
48
     ADM_QCanvas *canvas;
 
49
     Ui_eq2Window(Eq2_Param *param,AVDMGenericVideoStream *in);
 
50
     ~Ui_eq2Window();
 
51
     Ui_DialogEq2 ui;
 
52
 public slots:
 
53
      void gather(Eq2_Param *param);
 
54
      //void update(int i);
 
55
 private slots:
 
56
   void sliderUpdate(int foo);
 
57
   void valueChanged(int foo);
 
58
 
 
59
 private:
 
60
     
 
61
 };
 
62
  Ui_eq2Window::Ui_eq2Window(Eq2_Param *param,AVDMGenericVideoStream *in)
 
63
  {
 
64
    uint32_t width,height;
 
65
        ui.setupUi(this);
 
66
        lock=0;
 
67
        // Allocate space for green-ised video
 
68
        width=in->getInfo()->width;
 
69
        height=in->getInfo()->height;
 
70
 
 
71
        canvas=new ADM_QCanvas(ui.graphicsView,width,height);
 
72
        
 
73
        myCrop=new flyEq2( width, height,in,canvas,ui.horizontalSlider);
 
74
        memcpy(&(myCrop->param),param,sizeof(Eq2_Param));
 
75
        myCrop->_cookie=&ui;
 
76
        myCrop->upload();
 
77
        myCrop->sliderChanged();
 
78
        myCrop->update();
 
79
 
 
80
 
 
81
        connect( ui.horizontalSlider,SIGNAL(valueChanged(int)),this,SLOT(sliderUpdate(int)));
 
82
#define SPINNER(x) connect( ui.horizontalSlider##x,SIGNAL(valueChanged(int)),this,SLOT(valueChanged(int))); 
 
83
        SPINNER(Red);
 
84
        SPINNER(Blue);
 
85
        SPINNER(Green);
 
86
         
 
87
        SPINNER(Contrast);
 
88
        SPINNER(Brightness);
 
89
        SPINNER(Saturation);
 
90
 
 
91
        SPINNER(Initial);
 
92
        SPINNER(Weight);
 
93
  }
 
94
  void Ui_eq2Window::sliderUpdate(int foo)
 
95
  {
 
96
    myCrop->sliderChanged();
 
97
  }
 
98
  void Ui_eq2Window::gather(Eq2_Param *param)
 
99
  {
 
100
    
 
101
        myCrop->download();
 
102
        memcpy(param,&(myCrop->param),sizeof(Eq2_Param));
 
103
  }
 
104
Ui_eq2Window::~Ui_eq2Window()
 
105
{
 
106
  if(myCrop) delete myCrop;
 
107
  myCrop=NULL; 
 
108
  if(canvas) delete canvas;
 
109
  canvas=NULL;
 
110
}
 
111
void Ui_eq2Window::valueChanged( int f )
 
112
{
 
113
  if(lock) return;
 
114
  lock++;
 
115
  myCrop->update();
 
116
  lock--;
 
117
}
 
118
 
 
119
#define sliderSet(x,y) w->horizontalSlider##x->setValue((int)(param.y*100));
 
120
#define sliderGet(x,y) param.y=w->horizontalSlider##x->value()/100.;
 
121
//************************
 
122
uint8_t flyEq2::upload(void)
 
123
{
 
124
Ui_DialogEq2 *w=(Ui_DialogEq2 *)_cookie;
 
125
 
 
126
 
 
127
        sliderSet(Contrast,contrast);
 
128
        sliderSet(Brightness,brightness);
 
129
        sliderSet(Saturation,saturation);
 
130
 
 
131
        sliderSet(Red,rgamma);
 
132
        sliderSet(Green,ggamma);
 
133
        sliderSet(Blue,bgamma);
 
134
 
 
135
        sliderSet(Initial,gamma);
 
136
        sliderSet(Weight,gamma_weight);
 
137
        
 
138
       return 1;
 
139
}
 
140
uint8_t flyEq2::download(void)
 
141
{
 
142
Ui_DialogEq2 *w=(Ui_DialogEq2 *)_cookie;
 
143
 
 
144
        sliderGet(Contrast,contrast);
 
145
        sliderGet(Brightness,brightness);
 
146
        sliderGet(Saturation,saturation);
 
147
 
 
148
        sliderGet(Red,rgamma);
 
149
        sliderGet(Green,ggamma);
 
150
        sliderGet(Blue,bgamma);
 
151
 
 
152
        sliderGet(Initial,gamma);
 
153
        sliderGet(Weight,gamma_weight);
 
154
 
 
155
return 1;
 
156
}
 
157
/**
 
158
      \fn     DIA_getEQ2Param
 
159
      \brief  Handle MPlayer EQ2 flyDialog
 
160
*/
 
161
uint8_t DIA_getEQ2Param(Eq2_Param *param, AVDMGenericVideoStream *in)
 
162
{
 
163
        uint8_t ret=0;
 
164
        
 
165
        Ui_eq2Window dialog(param,in);        
 
166
        if(dialog.exec()==QDialog::Accepted)
 
167
        {
 
168
            dialog.gather(param); 
 
169
            ret=1;
 
170
        }
 
171
        return ret;
 
172
}
 
173
//____________________________________
 
174
// EOF
 
175
 
 
176