1 /* ***** BEGIN LICENSE BLOCK *****
7 * Copyright (c) 2008 BBC Research
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27 * ***** END LICENSE BLOCK ***** */
31 #include "customSizeDialog.h"
33 CustomSizeDialog::CustomSizeDialog(const QString
&name
, int width
, int height
,
34 QWidget
*parent
) : QDialog(parent
)
38 //enforce multiple of 4 width/height
40 width
= (width
/ 4) * 4;
43 height
= (height
/ 4) * 4;
46 widthLabel
= new QLabel(tr("Width"));
48 widthNumber
= new QSpinBox
;
49 widthNumber
->setMinimum(4);
50 widthNumber
->setMaximum(8192);
51 widthNumber
->setSingleStep(4);
52 widthNumber
->setValue(width
);
55 heightLabel
= new QLabel(tr("Height"));
57 heightNumber
= new QSpinBox
;
58 heightNumber
->setMinimum(4);
59 heightNumber
->setMaximum(8192);
60 heightNumber
->setSingleStep(4);
61 heightNumber
->setValue(height
);
64 okButton
= new QPushButton("OK", this);
65 connect(okButton
, SIGNAL(clicked()), this, SLOT(accept()));
67 cancelButton
= new QPushButton("Cancel", this);
68 connect(cancelButton
, SIGNAL(clicked()), this, SLOT(reject()));
71 QHBoxLayout
*widthLayout
= new QHBoxLayout
;
72 widthLayout
->addWidget(widthLabel
);
73 widthLayout
->addWidget(widthNumber
);
75 QHBoxLayout
*heightLayout
= new QHBoxLayout
;
76 heightLayout
->addWidget(heightLabel
);
77 heightLayout
->addWidget(heightNumber
);
79 QHBoxLayout
*buttonLayout
= new QHBoxLayout
;
80 buttonLayout
->addStretch();
81 buttonLayout
->addWidget(okButton
);
82 buttonLayout
->addWidget(cancelButton
);
84 QVBoxLayout
*layout
= new QVBoxLayout
;
85 layout
->addLayout(widthLayout
);
86 layout
->addLayout(heightLayout
);
87 layout
->addLayout(buttonLayout
);
92 int CustomSizeDialog::getWidth(void)
94 return (widthNumber
->value());
97 int CustomSizeDialog::getHeight(void)
99 return (heightNumber
->value());