Back to index

scribus-ng  1.3.4.dfsg+svn20071115
valuedialog.cpp
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 
00008 #include "valuedialog.h"
00009 #include "valuedialog.moc"
00010 #include <qvariant.h>
00011 #include <qpushbutton.h>
00012 #include <qlabel.h>
00013 #include <qlineedit.h>
00014 #include <qlayout.h>
00015 #include <qtooltip.h>
00016 #include <qwhatsthis.h>
00017 #include "commonstrings.h"
00018 
00019 ValueDialog::ValueDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
00020        : QDialog( parent, name, modal, fl )
00021 {
00022        if ( !name )
00023               setName( "ValueDialog" );
00024        setModal( true );
00025        ScripterValueLayout = new QGridLayout( this, 1, 1, 11, 6, "ScripterValueLayout");
00026 
00027        layout3 = new QVBoxLayout( 0, 0, 6, "layout3");
00028 
00029        dialogLabel = new QLabel( this, "dialogLabel" );
00030        dialogLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)5, 0, 0, dialogLabel->sizePolicy().hasHeightForWidth() ) );
00031        layout3->addWidget( dialogLabel );
00032 
00033        layout2 = new QVBoxLayout( 0, 0, 6, "layout2");
00034 
00035        valueEdit = new QLineEdit( this, "valueEdit" );
00036        layout2->addWidget( valueEdit );
00037 
00038        layout1 = new QHBoxLayout( 0, 0, 6, "layout1");
00039        QSpacerItem* spacer = new QSpacerItem( 40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00040        layout1->addItem( spacer );
00041 
00042        okButton = new QPushButton( this, "okButton" );
00043        layout1->addWidget( okButton );
00044        layout2->addLayout( layout1 );
00045        layout3->addLayout( layout2 );
00046 
00047        ScripterValueLayout->addLayout( layout3, 0, 0 );
00048        languageChange();
00049        //resize( QSize(315, 101).expandedTo(minimumSizeHint()) );
00050        clearWState( WState_Polished );
00051 
00052        // signals and slots connections
00053        connect( okButton, SIGNAL( clicked() ), this, SLOT( okButton_pressed() ) );
00054 }
00055 
00056 /*
00057  *  Destroys the object and frees any allocated resources
00058  */
00059 ValueDialog::~ValueDialog()
00060 {
00061        // no need to delete child widgets, Qt does it all for us
00062 }
00063 
00064 /*
00065  *  Sets the strings of the subwidgets using the current
00066  *  language.
00067  */
00068 void ValueDialog::languageChange()
00069 {
00070        setCaption( tr( "Insert value" ) );
00071        dialogLabel->setText( tr( "Enter a value then press OK." ) );
00072        QToolTip::add( valueEdit, tr( "Enter a value then press OK" ) );
00073        okButton->setText( CommonStrings::tr_OK );
00074        okButton->setAccel( QKeySequence( tr( "Alt+O" ) ) );
00075        QToolTip::add( okButton, tr( "Send your value to the script" ) );
00076 }
00077 
00078 void ValueDialog::okButton_pressed()
00079 {
00080        accept();
00081 }