MyObject::MyObject() : QObject(0L, "testobj") { connect(kapp, SIGNAL(kdisplayPaletteChanged()), SLOT(slotPaletteChanged())); connect(kapp, SIGNAL(kdisplayFontChanged()), SLOT(slotFontChanged())); connect(kapp, SIGNAL(kdisplayStyleChanged()), SLOT(slotStyleChanged())); connect(kapp, SIGNAL(backgroundChanged(int)), SLOT(slotBackgroundChanged(int))); connect(kapp, SIGNAL(appearanceChanged()), SLOT(slotAppearanceChanged())); connect(kapp, SIGNAL(kipcMessage(int,int)), SLOT(slotMessage(int,int))); }
OcrEngine::EngineError KadmosDialog::setupGui() { OcrEngine::EngineError err = OcrBaseDialog::setupGui(); // setupPreprocessing( addVBoxPage( i18n("Preprocessing"))); // setupSegmentation( addVBoxPage( i18n("Segmentation"))); // setupClassification( addVBoxPage( i18n("Classification"))); /* continue page setup on the first page */ KVBox *page = new KVBox(this); // FIXME: dynamic classifier reading. new QLabel(i18n("Please classify the font type and language of the text on the image:"), page); KHBox *locBox = new KHBox( page ); m_bbFont = new Q3ButtonGroup(1, Qt::Horizontal, i18n("Font Type Selection"), locBox); m_rbMachine = new QRadioButton( i18n("Machine print"), m_bbFont ); m_rbHand = new QRadioButton( i18n("Hand writing"), m_bbFont ); m_rbNorm = new QRadioButton( i18n("Norm font"), m_bbFont ); m_gbLang = new Q3GroupBox(1, Qt::Horizontal, i18n("Country"), locBox); m_cbLang = new QComboBox( m_gbLang ); m_cbLang->setItemText(m_cbLang->currentIndex(), KLocale::defaultCountry()); connect( m_bbFont, SIGNAL(clicked(int)), this, SLOT(slFontChanged(int) )); m_rbMachine->setChecked(true); /* --- */ KHBox *innerBox = new KHBox( page ); innerBox->setSpacing( KDialog::spacingHint()); Q3ButtonGroup *cbGroup = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("OCR Modifier"), innerBox ); Q_CHECK_PTR(cbGroup); m_cbNoise = new QCheckBox( i18n( "Enable automatic noise reduction" ), cbGroup ); m_cbAutoscale = new QCheckBox( i18n( "Enable automatic scaling"), cbGroup ); addExtraSetupWidget(page); if( err != OcrEngine::ENG_OK ) { enableFields(false); enableButton(User1, false ); } if( m_ttfClassifier.count() == 0 ) { m_rbMachine->setEnabled(false); } if( m_handClassifier.count() == 0 ) { m_rbHand->setEnabled(false); } if( !m_haveNorm ) m_rbNorm->setEnabled(false); if( (m_ttfClassifier.count() + m_handClassifier.count()) == 0 && ! m_haveNorm ) { KMessageBox::error(0, i18n("The classifier files for KADMOS could not be found.\n" "OCR with KADMOS will not be possible.\n\n" "Change the OCR engine in the preferences dialog."), i18n("Installation Error") ); err = OcrEngine::ENG_BAD_SETUP; } else slotFontChanged( 0 ); // Load machine print font language list ocrShowInfo(QString::null); return err; }
KJanusWidget::KJanusWidget( TQWidget *parent, const char *name, int face ) : TQWidget( parent, name, 0 ), mValid(false), mPageList(0), mTitleList(0), mFace(face), mTitleLabel(0), mActivePageWidget(0), mShowIconsInTreeList(false), d(0) { TQVBoxLayout *topLayout = new TQVBoxLayout( this ); if( mFace == TreeList || mFace == IconList ) { d = new KJanusWidgetPrivate; d->mSplitter = 0; TQFrame *page; if( mFace == TreeList ) { d->mSplitter = new TQSplitter( this ); topLayout->addWidget( d->mSplitter, 10 ); mTreeListResizeMode = TQSplitter::KeepSize; d->mListFrame = new TQWidget( d->mSplitter ); TQVBoxLayout *dummy = new TQVBoxLayout( d->mListFrame, 0, KDialog::spacingHint() ); dummy->setAutoAdd( true ); mTreeList = new TDEListView( d->mListFrame ); mTreeList->addColumn( TQString::null ); mTreeList->header()->hide(); mTreeList->setRootIsDecorated(true); mTreeList->setSorting( -1 ); connect( mTreeList, TQT_SIGNAL(selectionChanged()), TQT_SLOT(slotShowPage()) ); connect( mTreeList, TQT_SIGNAL(clicked(TQListViewItem *)), TQT_SLOT(slotItemClicked(TQListViewItem *))); // // Page area. Title at top with a separator below and a pagestack using // all available space at bottom. // TQFrame *p = new TQFrame( d->mSplitter ); TQHBoxLayout *hbox = new TQHBoxLayout( p, 0, 0 ); page = new TQFrame( p ); hbox->addWidget( page, 10 ); } else { TQHBoxLayout *hbox = new TQHBoxLayout( topLayout ); d->mListFrame = new TQWidget( this ); hbox->addWidget( d->mListFrame ); ( new TQVBoxLayout( d->mListFrame, 0, 0 ) )->setAutoAdd( true ); mIconList = new IconListBox( d->mListFrame ); TQFont listFont( mIconList->font() ); listFont.setBold( true ); mIconList->setFont( listFont ); mIconList->verticalScrollBar()->installEventFilter( this ); connect( mIconList, TQT_SIGNAL(selectionChanged()), TQT_SLOT(slotShowPage())); connect( mIconList, TQT_SIGNAL(onItem(TQListBoxItem *)), TQT_SLOT(slotOnItem(TQListBoxItem *))); hbox->addSpacing( KDialog::marginHint() ); page = new TQFrame( this ); hbox->addWidget( page, 10 ); } // // Rest of page area. Title at top with a separator below and a // pagestack using all available space at bottom. // TQVBoxLayout *vbox = new TQVBoxLayout( page, 0, KDialog::spacingHint() ); mTitleLabel = new TQLabel( i18n("Empty Page"), page, "KJanusWidgetTitleLabel" ); vbox->addWidget( mTitleLabel, 0, TQApplication::reverseLayout() ? AlignRight : AlignLeft ); TQFont titleFont( mTitleLabel->font() ); titleFont.setBold( true ); mTitleLabel->setFont( titleFont ); mTitleSep = new KSeparator( page ); mTitleSep->setFrameStyle( TQFrame::HLine|TQFrame::Plain ); vbox->addWidget( mTitleSep ); mPageStack = new TQWidgetStack( page ); connect(mPageStack, TQT_SIGNAL(aboutToShow(TQWidget *)), TQT_SIGNAL(aboutToShowPage(TQWidget *))); vbox->addWidget( mPageStack, 10 ); } else if( mFace == Tabbed ) { d = new KJanusWidgetPrivate; mTabControl = new TQTabWidget( this ); mTabControl->setMargin (KDialog::marginHint()); connect(mTabControl, TQT_SIGNAL(currentChanged(TQWidget *)), TQT_SIGNAL(aboutToShowPage(TQWidget *))); topLayout->addWidget( mTabControl, 10 ); } else if( mFace == Swallow ) { mSwallowPage = new TQWidget( this ); topLayout->addWidget( mSwallowPage, 10 ); } else { mFace = Plain; mPlainPage = new TQFrame( this ); topLayout->addWidget( mPlainPage, 10 ); } if ( kapp ) connect(kapp,TQT_SIGNAL(tdedisplayFontChanged()),TQT_SLOT(slotFontChanged())); mValid = true; setSwallowedWidget(0); // Set default size if 'mFace' is Swallow. }
void CHTMLWriteDisplay::setupToolbar(QToolBar * bar, BtActionCollection * actions) { //--------------------font chooser------------------------- m_fontFamilyChooser = new QFontComboBox(this); actions->addAction(CResMgr::displaywindows::writeWindow::fontFamily::actionName, m_fontFamilyChooser); m_fontFamilyChooser->setToolTip( tr("Font") ); bar->addWidget(m_fontFamilyChooser); bool ok = connect(m_fontFamilyChooser, SIGNAL(currentFontChanged(const QFont&)), this, SLOT(slotFontFamilyChoosen(const QFont&))); Q_ASSERT(ok); //--------------------font size chooser------------------------- m_fontSizeChooser = new BtFontSizeWidget(this); m_fontSizeChooser->setToolTip( tr("Font size") ); bar->addWidget(m_fontSizeChooser); ok = connect(m_fontSizeChooser, SIGNAL(fontSizeChanged(int)), this, SLOT(changeFontSize(int))); Q_ASSERT(ok); //--------------------color button------------------------- m_colorChooser = new BtColorWidget(); m_colorChooser->setToolTip(tr("Font color")); bar->addWidget(m_colorChooser); ok = connect(m_colorChooser, SIGNAL(changed(const QColor&)), this, SLOT(slotColorSelected(const QColor&))); Q_ASSERT(ok); bar->addSeparator(); //--------------------bold toggle------------------------- m_actions.bold = new QAction( util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::boldText::icon), tr("Bold"), actions); m_actions.bold->setCheckable(true); m_actions.bold->setShortcut(CResMgr::displaywindows::writeWindow::boldText::accel); actions->addAction(CResMgr::displaywindows::writeWindow::boldText::actionName, m_actions.bold); m_actions.bold->setToolTip( tr("Bold") ); connect(m_actions.bold, SIGNAL(toggled(bool)), this, SLOT(toggleBold(bool))); bar->addAction(m_actions.bold); //--------------------italic toggle------------------------- m_actions.italic = new QAction( util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::italicText::icon), tr("Italic"), actions ); m_actions.italic->setCheckable(true); m_actions.bold->setShortcut(CResMgr::displaywindows::writeWindow::italicText::accel); actions->addAction(CResMgr::displaywindows::writeWindow::italicText::actionName, m_actions.italic); connect(m_actions.italic, SIGNAL(toggled(bool)), this, SLOT(toggleItalic(bool))); m_actions.italic->setToolTip( tr("Italic") ); bar->addAction(m_actions.italic); //--------------------underline toggle------------------------- m_actions.underline = new QAction( util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::underlinedText::icon), tr("Underline"), actions ); m_actions.underline->setCheckable(true); m_actions.underline->setShortcut(CResMgr::displaywindows::writeWindow::underlinedText::accel); actions->addAction(CResMgr::displaywindows::writeWindow::underlinedText::actionName, m_actions.underline); connect(m_actions.underline, SIGNAL(toggled(bool)), this, SLOT(toggleUnderline(bool))); m_actions.underline->setToolTip( tr("Underline") ); bar->addAction(m_actions.underline); //seperate formatting from alignment buttons bar->addSeparator(); //--------------------align left toggle------------------------- m_actions.alignLeft = new QAction( util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::alignLeft::icon), tr("Left"), actions); m_actions.alignLeft->setCheckable(true); m_actions.alignLeft->setShortcut(CResMgr::displaywindows::writeWindow::alignLeft::accel); actions->addAction(CResMgr::displaywindows::writeWindow::alignLeft::actionName, m_actions.alignLeft); connect(m_actions.alignLeft, SIGNAL(toggled(bool)), this, SLOT(alignLeft(bool))); m_actions.alignLeft->setToolTip( tr("Align left") ); bar->addAction(m_actions.alignLeft); //--------------------align center toggle------------------------- m_actions.alignCenter = new QAction( util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::alignCenter::icon), tr("Center"), actions); m_actions.alignCenter->setCheckable(true); m_actions.alignCenter->setShortcut(CResMgr::displaywindows::writeWindow::alignCenter::accel); actions->addAction(CResMgr::displaywindows::writeWindow::alignCenter::actionName, m_actions.alignCenter); connect(m_actions.alignCenter, SIGNAL(toggled(bool)), this, SLOT(alignCenter(bool))); m_actions.alignCenter->setToolTip( tr("Center") ); bar->addAction(m_actions.alignCenter); //--------------------align right toggle------------------------- m_actions.alignRight = new QAction( util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::alignRight::icon), tr("Right"), actions); m_actions.alignRight->setCheckable(true); m_actions.alignRight->setShortcut(CResMgr::displaywindows::writeWindow::alignRight::accel); actions->addAction(CResMgr::displaywindows::writeWindow::alignRight::actionName, m_actions.alignRight); connect(m_actions.alignRight, SIGNAL(toggled(bool)), this, SLOT(alignRight(bool))); m_actions.alignRight->setToolTip( tr("Align right") ); bar->addAction(m_actions.alignRight); connect(this, SIGNAL(currentFontChanged(const QFont&)), SLOT(slotFontChanged(const QFont&))); connect(this, SIGNAL(currentAlignmentChanged(int)), SLOT(slotAlignmentChanged(int))); connect(this, SIGNAL(currentColorChanged(const QColor&)), SLOT(slotColorChanged(const QColor&))); //set initial values for toolbar items slotFontChanged( font() ); slotAlignmentChanged( alignment() ); slotColorChanged( textColor() ); }