~ubuntu-branches/ubuntu/jaunty/avidemux/jaunty

« back to all changes in this revision

Viewing changes to avidemux/ADM_userInterfaces/ADM_QT4/ADM_dialogFactory/FAC_aspectRatio.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2009-02-17 23:41:46 UTC
  • mfrom: (1.1.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20090217234146-eakx254awuch4wgw
Tags: 1:2.4.4-0.0ubuntu1
* Merge from debian multimedia, Ubuntu remaining changes:
  - debian/control:
    + Build-Depends on newer libx264-dev.
    + Don't Build-Depends on ccache and libamrnb-dev.
    + Build-Depends on libpulse-dev.
    + Fixed small typo in avidemux description.
  - Don't use ccache.
  - Drop patch to fix build with newer x264, it has been merged by upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
  FAC_aspectRatio.cpp
 
3
  Handle dialog factory element : Aspect Ratio
 
4
  (C) 2008 Gruntster
 
5
***************************************************************************/
 
6
 
 
7
/***************************************************************************
 
8
 *                                                                         *
 
9
 *   This program is free software; you can redistribute it and/or modify  *
 
10
 *   it under the terms of the GNU General Public License as published by  *
 
11
 *   the Free Software Foundation; either version 2 of the License, or     *
 
12
 *   (at your option) any later version.                                   *
 
13
 *                                                                         *
 
14
 ***************************************************************************/
 
15
 
 
16
#include "config.h"
 
17
 
 
18
#include <QDialog>
 
19
#include <QSpinBox>
 
20
#include <QGridLayout>
 
21
#include <QLabel>
 
22
 
 
23
#include "default.h"
 
24
#include "ADM_commonUI/DIA_factory.h"
 
25
#include "ADM_assert.h"
 
26
#include "dialogFactoryQt4.h"
 
27
 
 
28
extern const char *shortkey(const char *);
 
29
 
 
30
diaElemAspectRatio::diaElemAspectRatio(uint32_t *num, uint32_t *den, const char *title, const char *tip) : diaElem(ELEM_TOGGLE)
 
31
{
 
32
        param = (void *)num;
 
33
        this->den = den;
 
34
        paramTitle = shortkey(title);
 
35
        this->tip = tip;
 
36
}
 
37
 
 
38
diaElemAspectRatio::~diaElemAspectRatio()
 
39
{
 
40
        if(paramTitle)
 
41
                delete paramTitle;
 
42
}
 
43
 
 
44
void diaElemAspectRatio::setMe(void *dialog, void *opaque, uint32_t line)
 
45
{
 
46
        QLabel *text = new QLabel(QString::fromUtf8(paramTitle));
 
47
        QSpinBox *numBox = new QSpinBox();
 
48
        QLabel *label = new QLabel(":");
 
49
        QSpinBox *denBox = new QSpinBox();
 
50
        QGridLayout *layout = (QGridLayout*) opaque;
 
51
        QHBoxLayout *hboxLayout = new QHBoxLayout();
 
52
 
 
53
        myWidget = (void*)numBox;
 
54
        this->label = (void*)label;
 
55
        this->denControl = (void*)denBox;
 
56
 
 
57
        text->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
 
58
        text->setBuddy(numBox);
 
59
 
 
60
        numBox->setMinimum(1);
 
61
        numBox->setMaximum(255);
 
62
 
 
63
        denBox->setMinimum(1);
 
64
        denBox->setMaximum(255);
 
65
 
 
66
        numBox->setValue(*(uint32_t*)param);
 
67
        denBox->setValue(*(uint32_t*)den);
 
68
 
 
69
        QSpacerItem *spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
 
70
 
 
71
        hboxLayout->addWidget(numBox);
 
72
        hboxLayout->addWidget(label);
 
73
        hboxLayout->addWidget(denBox);
 
74
        hboxLayout->addItem(spacer);
 
75
 
 
76
        layout->addWidget(text,line,0);
 
77
        layout->addLayout(hboxLayout,line,1);
 
78
}
 
79
 
 
80
void diaElemAspectRatio::getMe(void)
 
81
{
 
82
        *(uint32_t*)param = ((QSpinBox*)myWidget)->value();
 
83
        *(uint32_t*)den = ((QSpinBox*)denControl)->value();
 
84
}
 
85
 
 
86
void diaElemAspectRatio::enable(uint32_t onoff) 
 
87
{
 
88
        QSpinBox *numBox = (QSpinBox*)myWidget;
 
89
        QSpinBox *denBox = (QSpinBox*)denControl;
 
90
        QLabel *label = (QLabel*)this->label;
 
91
 
 
92
        numBox->setEnabled(onoff);
 
93
        denBox->setEnabled(onoff);
 
94
        label->setEnabled(onoff);
 
95
}
 
96
 
 
97
int diaElemAspectRatio::getRequiredLayout(void) { return FAC_QT_GRIDLAYOUT; }