void VideoTextDlg::slotSelectBackground() { QColorDialog dlg(m_bgColor, this); if(dlg.exec()) { m_bgColor = dlg.selectedColor(); slotUpdateExample(); } }
void NumberCycleDialog::slotTemplTextChanged( const QString& str ) { bool state = false; if ( !str.isEmpty() && str.contains( "%i" ) ) { state = true; } if( _okButton ) { _okButton->setEnabled( state ); } slotUpdateExample(); }
NumberCycleDialog::NumberCycleDialog( QWidget *parent, const QString& initType ) :QDialog( parent ) // "NUMBER_CYCLES_EDIT", true, i18n( "Edit Number Cycles" ), Ok|Cancel ) { setObjectName( "NUMBER_CYCLES_EDIT" ); setModal( true ); setWindowTitle( i18n( "Edit Number Cycles" ) ); QVBoxLayout *layout = new QVBoxLayout; setLayout(layout); QWidget *w = new QWidget; layout->addWidget(w); mBaseWidget = new Ui::NumberCycleEditBase( ); mBaseWidget->setupUi( w ); mBaseWidget->mPbAdd->setIcon( QIcon::fromTheme( "list-add" ) ); mBaseWidget->mPbRemove->setIcon( QIcon::fromTheme( "list-remove" ) ); mBaseWidget->mCounterEdit->setMaximum( 1000000 ); mBaseWidget->mCounterEdit->setSingleStep( 1 ); const QString tip = i18n( "The template may contain the following tags:" "<ul><li>%y or %yyyy - the year of the documents date.</li>" "<li>%yy - the year of the document (two digits).</li>" "<li>%w - the week number of the documents date.</li>" "<li>%ww - the week number of the documents date with leading zero.</li>" "<li>%d - the day number of the documents date.</li>" "<li>%dd - the day number of the documents date with leading zero.</li>" "<li>%m or %M - the month number of the documents date.</li>" "<li>%MM - the month number with leading zero.</li>" "<li>%c - the customer id from kaddressbook</li>" "<li>%i - the unique counter</li>" "<li>%type - the localised doc type (offer, invoice etc.)</li>" "<li>%uid - the contact id of the client.</li>" "</ul>%i needs to be part of the template." ); mBaseWidget->mIdTemplEdit->setToolTip( tip ); connect( mBaseWidget->mPbAdd, SIGNAL( clicked() ), SLOT( slotAddCycle() ) ); connect( mBaseWidget->mPbRemove, SIGNAL( clicked() ), SLOT( slotRemoveCycle() ) ); loadCycles(); connect( mBaseWidget->mCycleListBox, SIGNAL( currentRowChanged( int ) ), SLOT( slotNumberCycleSelected( int ) ) ); QListWidgetItem *initItem = mBaseWidget->mCycleListBox->findItems( initType, Qt::MatchExactly ).first(); if ( initItem ) { mBaseWidget->mCycleListBox->setCurrentItem( initItem, QItemSelectionModel::Select ); } QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); _okButton = buttonBox->button(QDialogButtonBox::Ok); _okButton->setDefault(true); _okButton->setShortcut(Qt::CTRL | Qt::Key_Return); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); layout->addWidget(buttonBox); slotUpdateExample(); connect( mBaseWidget->mIdTemplEdit, SIGNAL( textChanged( const QString& ) ), SLOT( slotTemplTextChanged( const QString& ) ) ); connect( mBaseWidget->mCounterEdit, SIGNAL( valueChanged( int ) ), SLOT( slotUpdateExample() ) ); }
VideoTextDlg::VideoTextDlg(QWidget* parent/* = 0*/) : QDialog(parent, QT_DEFAULT_DIALOG_HINTS) { ui.setupUi(this); setWindowIcon(QIcon(APPICON)); quint32 videotext = ttSettings->value(SETTINGS_DISPLAY_VIDEOTEXT, SETTINGS_DISPLAY_VIDEOTEXT_DEFAULT).toUInt(); switch(videotext & VIDTEXT_SHOW_MASK) { case VIDTEXT_SHOW_USERNAME : ui.usernameRadioButton->setChecked(true); break; case VIDTEXT_SHOW_STATUSTEXT : ui.statusRadioButton->setChecked(true); break; case VIDTEXT_SHOW_NICKNAME : default : ui.nicknameRadioButton->setChecked(true); break; } switch(videotext & VIDTEXT_POSITION_MASK) { case VIDTEXT_POSITION_TOPLEFT : ui.pos_tlBtn->setChecked(true); break; case VIDTEXT_POSITION_TOPRIGHT : ui.pos_trBtn->setChecked(true); break; case VIDTEXT_POSITION_BOTTOMLEFT : ui.pos_blBtn->setChecked(true); break; case VIDTEXT_POSITION_BOTTOMRIGHT : ui.pos_brBtn->setChecked(true); break; } ui.widthSpinBox->setValue(ttSettings->value(SETTINGS_DISPLAY_VIDEOTEXT_WIDTH, SETTINGS_DISPLAY_VIDEOTEXT_WIDTH_DEFAULT).toInt()); ui.heightSpinBox->setValue(ttSettings->value(SETTINGS_DISPLAY_VIDEOTEXT_HEIGHT, SETTINGS_DISPLAY_VIDEOTEXT_HEIGHT_DEFAULT).toInt()); m_bgColor = ttSettings->value(SETTINGS_DISPLAY_VIDEOTEXT_BGCOLOR, SETTINGS_DISPLAY_VIDEOTEXT_BGCOLOR_DEFAULT) .value<QColor>(); m_fgColor = ttSettings->value(SETTINGS_DISPLAY_VIDEOTEXT_FGCOLOR, SETTINGS_DISPLAY_VIDEOTEXT_FGCOLOR_DEFAULT) .value<QColor>(); connect(ui.fontBtn, SIGNAL(clicked()), SLOT(slotSelectFont())); connect(ui.bgBtn, SIGNAL(clicked()), SLOT(slotSelectBackground())); connect(ui.nicknameRadioButton, SIGNAL(clicked()), SLOT(slotUpdateExample())); connect(ui.usernameRadioButton, SIGNAL(clicked()), SLOT(slotUpdateExample())); connect(ui.statusRadioButton, SIGNAL(clicked()), SLOT(slotUpdateExample())); connect(ui.pos_tlBtn, SIGNAL(clicked()), SLOT(slotUpdateExample())); connect(ui.pos_trBtn, SIGNAL(clicked()), SLOT(slotUpdateExample())); connect(ui.pos_blBtn, SIGNAL(clicked()), SLOT(slotUpdateExample())); connect(ui.pos_brBtn, SIGNAL(clicked()), SLOT(slotUpdateExample())); connect(ui.widthSpinBox, SIGNAL(valueChanged(int)), SLOT(slotUpdateExample())); connect(ui.heightSpinBox, SIGNAL(valueChanged(int)), SLOT(slotUpdateExample())); QTimer::singleShot(0, this, SLOT(slotUpdateExample())); }