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

« back to all changes in this revision

Viewing changes to avidemux/ADM_userInterfaces/ADM_QT4/ADM_dialog/Q_asharp.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
                          DIA_crop.cpp  -  description
 
3
                             -------------------
 
4
 
 
5
                            GUI for cropping including autocrop
 
6
                            +Revisted the Gtk2 way
 
7
                             +Autocrop now in RGB space (more accurate)
 
8
 
 
9
    begin                : Fri May 3 2002
 
10
    copyright            : (C) 2002/2007 by mean
 
11
    email                : fixounet@free.fr
 
12
 ***************************************************************************/
 
13
 
 
14
/***************************************************************************
 
15
 *                                                                         *
 
16
 *   This program is free software; you can redistribute it and/or modify  *
 
17
 *   it under the terms of the GNU General Public License as published by  *
 
18
 *   the Free Software Foundation; either version 2 of the License, or     *
 
19
 *   (at your option) any later version.                                   *
 
20
 *                                                                         *
 
21
 ***************************************************************************/
 
22
 
 
23
#include <config.h>
 
24
#include <string.h>
 
25
#include <stdio.h>
 
26
#include <math.h>
 
27
 
 
28
#define Ui_Dialog Ui_asharpDialog
 
29
#include "ui_asharp.h"
 
30
#undef Ui_Dialog
 
31
 
 
32
#include "default.h"
 
33
#include "ADM_toolkit/toolkit.hxx"
 
34
#include "ADM_image.h"
 
35
#include "ADM_video/ADM_genvideo.hxx"
 
36
#include "ADM_colorspace/ADM_rgb.h"
 
37
#include "ADM_assert.h"
 
38
#include "DIA_flyDialog.h"
 
39
#include "DIA_flyDialogQt4.h"
 
40
#include "ADM_videoFilter/ADM_vidASharp_param.h"
 
41
#include "DIA_flyAsharp.h"
 
42
 
 
43
//
 
44
//      Video is in YV12 Colorspace
 
45
//
 
46
//
 
47
class Ui_asharpWindow : public QDialog
 
48
 {
 
49
     Q_OBJECT
 
50
 protected : 
 
51
    int lock;
 
52
 public:
 
53
     flyASharp *myCrop;
 
54
     ADM_QCanvas *canvas;
 
55
     Ui_asharpWindow(ASHARP_PARAM *param,AVDMGenericVideoStream *in);
 
56
     ~Ui_asharpWindow();
 
57
     Ui_asharpDialog ui;
 
58
 public slots:
 
59
      void gather(ASHARP_PARAM *param);
 
60
      //void update(int i);
 
61
 private slots:
 
62
   void sliderUpdate(int foo);
 
63
   void valueChanged(int foo);
 
64
 
 
65
 private:
 
66
     
 
67
 };
 
68
  Ui_asharpWindow::Ui_asharpWindow(ASHARP_PARAM *param,AVDMGenericVideoStream *in)
 
69
  {
 
70
    uint32_t width,height;
 
71
        ui.setupUi(this);
 
72
        lock=0;
 
73
        // Allocate space for green-ised video
 
74
        width=in->getInfo()->width;
 
75
        height=in->getInfo()->height;
 
76
 
 
77
        canvas=new ADM_QCanvas(ui.graphicsView,width,height);
 
78
        
 
79
        myCrop=new flyASharp( width, height,in,canvas,ui.horizontalSlider);
 
80
        memcpy(&(myCrop->param),param,sizeof(ASHARP_PARAM));
 
81
        myCrop->_cookie=&ui;
 
82
        myCrop->upload();
 
83
        myCrop->sliderChanged();
 
84
 
 
85
 
 
86
        connect( ui.horizontalSlider,SIGNAL(valueChanged(int)),this,SLOT(sliderUpdate(int)));
 
87
#define SPINNER(x) connect( ui.doubleSpinBox##x,SIGNAL(valueChanged(int)),this,SLOT(valueChanged(int))); 
 
88
          SPINNER(Treshold);
 
89
          SPINNER(Strength);
 
90
          SPINNER(Block);
 
91
          connect( ui.checkBox,SIGNAL(stateChanged(int)),this,SLOT(valueChanged(int))); 
 
92
 
 
93
  }
 
94
  void Ui_asharpWindow::sliderUpdate(int foo)
 
95
  {
 
96
    myCrop->sliderChanged();
 
97
  }
 
98
  void Ui_asharpWindow::gather(ASHARP_PARAM *param)
 
99
  {
 
100
    
 
101
        myCrop->download();
 
102
        memcpy(param,&(myCrop->param),sizeof(ASHARP_PARAM));
 
103
  }
 
104
Ui_asharpWindow::~Ui_asharpWindow()
 
105
{
 
106
  if(myCrop) delete myCrop;
 
107
  myCrop=NULL; 
 
108
  if(canvas) delete canvas;
 
109
  canvas=NULL;
 
110
}
 
111
void Ui_asharpWindow::valueChanged( int f )
 
112
{
 
113
  if(lock) return;
 
114
  lock++;
 
115
  myCrop->update();
 
116
  lock--;
 
117
}
 
118
 
 
119
#define MYSPIN(x) w->doubleSpinBox##x
 
120
//************************
 
121
uint8_t flyASharp::upload(void)
 
122
{
 
123
      Ui_asharpDialog *w=(Ui_asharpDialog *)_cookie;
 
124
 
 
125
        MYSPIN(Treshold)->setValue(param.t);
 
126
        MYSPIN(Strength)->setValue(param.d);
 
127
        MYSPIN(Block)->setValue(param.b);
 
128
        
 
129
        //w->bf->w->checkBox->isChecked();
 
130
        w->checkBox->setChecked(param.bf);
 
131
 
 
132
        return 1;
 
133
}
 
134
uint8_t flyASharp::download(void)
 
135
{
 
136
       Ui_asharpDialog *w=(Ui_asharpDialog *)_cookie;
 
137
       param.t= MYSPIN(Treshold)->value();
 
138
       param.d= MYSPIN(Strength)->value();
 
139
       param.b= MYSPIN(Block)->value();
 
140
       
 
141
       //w->spinBoxBottom->setValue(bottom);
 
142
       param.bf=w->checkBox->isChecked();
 
143
}
 
144
 
 
145
/**
 
146
      \fn     DIA_getCropParams
 
147
      \brief  Handle crop dialog
 
148
*/
 
149
uint8_t DIA_getASharp(ASHARP_PARAM *param, AVDMGenericVideoStream *in)
 
150
{
 
151
        uint8_t ret=0;
 
152
        
 
153
        Ui_asharpWindow dialog(param,in);        
 
154
        if(dialog.exec()==QDialog::Accepted)
 
155
        {
 
156
            dialog.gather(param); 
 
157
            ret=1;
 
158
        }
 
159
        return ret;
 
160
}
 
161
//____________________________________
 
162
// EOF
 
163
 
 
164