void PropertyPanel::setTitleColors() { QPalette palette = titleFrame->palette(); palette.setActive( highlightColorGroup( palette.active() ) ); palette.setInactive( highlightColorGroup( palette.inactive() ) ); palette.setDisabled( highlightColorGroup( palette.disabled() ) ); titleFrame->setPalette( palette ); }
DiskInfoWidget::DiskInfoWidget(QWidget *parent, const char *name, ConfigDialogImpl *config, bool init) : QWidget(parent, name) { _config = config; connect(&mDiskList , SIGNAL(readDFDone() ), this, SLOT (updateDFDone()) ); connect(&mDiskList , SIGNAL(criticallyFull(DiskEntry*)), this, SLOT (criticallyFull(DiskEntry*)) ); mTabProp.resize(8); mTabProp[0] = new CTabEntry( "Icon", i18n("Icon"), false, 0); mTabProp[1] = new CTabEntry( "Device", i18n("Device"), false, 0); mTabProp[2] = new CTabEntry( "Type", i18n("Type"), false, 0); mTabProp[3] = new CTabEntry( "Size", i18n("Size"), false, 0); mTabProp[4] = new CTabEntry( "MountPoint", i18n("Mount Point"), true, 90 ); mTabProp[5] = new CTabEntry( "Free", i18n("Free"), false, 0); // xgettext:no-c-format mTabProp[6] = new CTabEntry( "Full%", i18n("Full %"), false, 0); mTabProp[7] = new CTabEntry( "UsageBar", i18n("Usage"), true, 100); GUI = !init; if( GUI ) { QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 0 ); mList = new CListView( this, "list" ); topLayout->addWidget( mList ); mList->setAllColumnsShowFocus( true ); mList->setFrameStyle( QFrame::WinPanel + QFrame::Sunken ); mList->setShowSortIndicator(true); QPalette pal; QColorGroup cg; cg.setColor( QColorGroup::Button, BACKGROUND ); cg.setColor( QColorGroup::ButtonText, TEXTCOLOR ); cg.setColor( QColorGroup::Base, BACKGROUND ); pal.setActive( cg ); cg.setColor( QColorGroup::Button, BACKGROUND ); cg.setColor( QColorGroup::ButtonText, TEXTCOLOR ); cg.setColor( QColorGroup::Base, BACKGROUND ); pal.setInactive( cg ); cg.setColor( QColorGroup::Button, BACKGROUND ); cg.setColor( QColorGroup::ButtonText, TEXTCOLOR ); cg.setColor( QColorGroup::Base, BACKGROUND ); pal.setDisabled( cg ); mList->setPalette( pal ); // connect( mList, // SIGNAL( pressed( QListViewItem *, const QPoint &, int )), // this, SLOT( rightButtonPressed( QListViewItem *, const QPoint &, int ))); // connect( mList, // SIGNAL( clicked( QListViewItem *, const QPoint &, int )), // this, SLOT( rightButtonClicked( QListViewItem *, const QPoint &, int ))); connect( mList->header(), SIGNAL(sizeChange(int, int, int)), this, SLOT(columnSizeChanged(int, int, int)) ); makeColumns(); } updateDF(); setUpdateFrequency(60); }
/*! \brief Returns a palette with colored scrollbars * * This method creates a palette with skin specific scrollbar colors. * Parent should be a widget that holds a "default" active palette, which will * be used as base for the resulting palette. * The returned QPalette is a copy of the parent palette but with modified * scrollbar colors: QColorGroup::Highlight, QColorGroup::Button, * QColorGroup::Foreground, QColorGroup::Background and QColorGroup::ButtonText. */ QPalette CSkin::palette(QWidget *parent) { QPalette pal; QColorGroup cg; cg = parent->QWidget::palette().active(); // copy active palette from parent // ButtonText + arrow of scrollbar if (colors.btnTxt) { cg.setColor(QColorGroup::ButtonText, QColor(colors.btnTxt)); cg.setColor(QColorGroup::Foreground, cg.buttonText()); } // Scrollbar if (colors.scrollbar) { cg.setColor(QColorGroup::Highlight, QColor(colors.scrollbar)); cg.setColor(QColorGroup::Button, cg.highlight()); cg.setColor(QColorGroup::Background, cg.highlight()); } pal.setActive(cg); pal.setInactive(cg); pal.setDisabled(cg); return pal; }
/*! Attention: this function has to be in sync with Resource::saveProperty() and DomTool::elementToVariant. If you change one, change all. */ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, const QString &prop, const QDomElement &e, bool stdset ) { QString v; if ( e.tagName() == "rect" ) { QDomElement n3 = e.firstChild().toElement(); int x = 0, y = 0, w = 0, h = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "x" ) x = n3.firstChild().toText().data().toInt(); else if ( n3.tagName() == "y" ) y = n3.firstChild().toText().data().toInt(); else if ( n3.tagName() == "width" ) w = n3.firstChild().toText().data().toInt(); else if ( n3.tagName() == "height" ) h = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } v = "QRect( %1, %2, %3, %4 )"; v = v.arg(x).arg(y).arg(w).arg(h); } else if ( e.tagName() == "point" ) { QDomElement n3 = e.firstChild().toElement(); int x = 0, y = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "x" ) x = n3.firstChild().toText().data().toInt(); else if ( n3.tagName() == "y" ) y = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } v = "QPoint( %1, %2 )"; v = v.arg(x).arg(y); } else if ( e.tagName() == "size" ) { QDomElement n3 = e.firstChild().toElement(); int w = 0, h = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "width" ) w = n3.firstChild().toText().data().toInt(); else if ( n3.tagName() == "height" ) h = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } v = "QSize( %1, %2 )"; v = v.arg(w).arg(h); } else if ( e.tagName() == "color" ) { QDomElement n3 = e.firstChild().toElement(); int r = 0, g = 0, b = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "red" ) r = n3.firstChild().toText().data().toInt(); else if ( n3.tagName() == "green" ) g = n3.firstChild().toText().data().toInt(); else if ( n3.tagName() == "blue" ) b = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } v = "QColor( %1, %2, %3 )"; v = v.arg(r).arg(g).arg(b); } else if ( e.tagName() == "font" ) { QDomElement n3 = e.firstChild().toElement(); QString attrname = e.parentNode().toElement().attribute( "name", "font" ); QString fontname; if ( !obj.isEmpty() ) { fontname = registerObject( obj + "_" + attrname ); out << indent << "QFont " << fontname << "( " << obj << "->font() );" << endl; } else { fontname = registerObject( "f" ); out << indent << "QFont " << fontname << "( font() );" << endl; } while ( !n3.isNull() ) { if ( n3.tagName() == "family" ) out << indent << fontname << ".setFamily( \"" << n3.firstChild().toText().data() << "\" );" << endl; else if ( n3.tagName() == "pointsize" ) out << indent << fontname << ".setPointSize( " << n3.firstChild().toText().data() << " );" << endl; else if ( n3.tagName() == "bold" ) out << indent << fontname << ".setBold( " << mkBool( n3.firstChild().toText().data() ) << " );" << endl; else if ( n3.tagName() == "italic" ) out << indent << fontname << ".setItalic( " << mkBool( n3.firstChild().toText().data() ) << " );" << endl; else if ( n3.tagName() == "underline" ) out << indent << fontname << ".setUnderline( " << mkBool( n3.firstChild().toText().data() ) << " );" << endl; else if ( n3.tagName() == "strikeout" ) out << indent << fontname << ".setStrikeOut( " << mkBool( n3.firstChild().toText().data() ) << " );" << endl; n3 = n3.nextSibling().toElement(); } if ( prop == "font" ) { if ( !obj.isEmpty() ) out << indent << obj << "->setFont( " << fontname << " ); " << endl; else out << indent << "setFont( " << fontname << " ); " << endl; } else { v = fontname; } } else if ( e.tagName() == "string" ) { QString txt = e.firstChild().toText().data(); QString com = getComment( e.parentNode() ); if ( prop == "toolTip" && objClass != "QAction" && objClass != "QActionGroup" ) { if ( !obj.isEmpty() ) trout << indent << "QToolTip::add( " << obj << ", " << trcall( txt, com ) << " );" << endl; else trout << indent << "QToolTip::add( this, " << trcall( txt, com ) << " );" << endl; } else if ( prop == "whatsThis" && objClass != "QAction" && objClass != "QActionGroup" ) { if ( !obj.isEmpty() ) trout << indent << "QWhatsThis::add( " << obj << ", " << trcall( txt, com ) << " );" << endl; else trout << indent << "QWhatsThis::add( this, " << trcall( txt, com ) << " );" << endl; } else { v = trcall( txt, com ); } } else if ( e.tagName() == "cstring" ) { v = "\"%1\""; v = v.arg( e.firstChild().toText().data() ); } else if ( e.tagName() == "number" ) { v = "%1"; v = v.arg( e.firstChild().toText().data() ); } else if ( e.tagName() == "bool" ) { if ( stdset ) v = "%1"; else v = "QVariant( %1, 0 )"; v = v.arg( mkBool( e.firstChild().toText().data() ) ); } else if ( e.tagName() == "pixmap" ) { v = e.firstChild().toText().data(); if ( !pixmapLoaderFunction.isEmpty() ) { v.prepend( pixmapLoaderFunction + "( " + QString( externPixmaps ? "\"" : "" ) ); v.append( QString( externPixmaps ? "\"" : "" ) + " )" ); } } else if ( e.tagName() == "iconset" ) { v = "QIconSet( %1 )"; QString s = e.firstChild().toText().data(); if ( !pixmapLoaderFunction.isEmpty() ) { s.prepend( pixmapLoaderFunction + "( " + QString( externPixmaps ? "\"" : "" ) ); s.append( QString( externPixmaps ? "\"" : "" ) + " )" ); } v = v.arg( s ); } else if ( e.tagName() == "image" ) { v = e.firstChild().toText().data() + ".convertToImage()"; } else if ( e.tagName() == "enum" ) { if ( stdset ) v = "%1::%2"; else v = "\"%1\""; QString oc = objClass; QString ev = e.firstChild().toText().data(); if ( oc == "QListView" && ev == "Manual" ) // #### workaround, rename QListView::Manual in 4.0 oc = "QScrollView"; if ( stdset ) v = v.arg( oc ).arg( ev ); else v = v.arg( ev ); } else if ( e.tagName() == "set" ) { QString keys( e.firstChild().toText().data() ); QStringList lst = QStringList::split( '|', keys ); v = "int( "; QStringList::Iterator it = lst.begin(); while ( it != lst.end() ) { v += objClass + "::" + *it; if ( it != lst.fromLast() ) v += " | "; ++it; } v += " )"; } else if ( e.tagName() == "sizepolicy" ) { QDomElement n3 = e.firstChild().toElement(); QSizePolicy sp; while ( !n3.isNull() ) { if ( n3.tagName() == "hsizetype" ) sp.setHorData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); else if ( n3.tagName() == "vsizetype" ) sp.setVerData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() ); else if ( n3.tagName() == "horstretch" ) sp.setHorStretch( n3.firstChild().toText().data().toInt() ); else if ( n3.tagName() == "verstretch" ) sp.setVerStretch( n3.firstChild().toText().data().toInt() ); n3 = n3.nextSibling().toElement(); } QString tmp; if ( !obj.isEmpty() ) tmp = obj + "->"; v = "QSizePolicy( (QSizePolicy::SizeType)%1, (QSizePolicy::SizeType)%2, %3, %4, " + tmp + "sizePolicy().hasHeightForWidth() )"; v = v.arg( (int)sp.horData() ).arg( (int)sp.verData() ).arg( sp.horStretch() ).arg( sp.verStretch() ); } else if ( e.tagName() == "palette" ) { QPalette pal; bool no_pixmaps = e.elementsByTagName( "pixmap" ).count() == 0; QDomElement n; if ( no_pixmaps ) { n = e.firstChild().toElement(); while ( !n.isNull() ) { QColorGroup cg; if ( n.tagName() == "active" ) { cg = loadColorGroup( n ); pal.setActive( cg ); } else if ( n.tagName() == "inactive" ) { cg = loadColorGroup( n ); pal.setInactive( cg ); } else if ( n.tagName() == "disabled" ) { cg = loadColorGroup( n ); pal.setDisabled( cg ); } n = n.nextSibling().toElement(); } } if ( no_pixmaps && pal == QPalette( pal.active().button(), pal.active().background() ) ) { v = "QPalette( QColor( %1, %2, %3 ), QColor( %1, %2, %3 ) )"; v = v.arg( pal.active().button().red() ).arg( pal.active().button().green() ).arg( pal.active().button().blue() ); v = v.arg( pal.active().background().red() ).arg( pal.active().background().green() ).arg( pal.active().background().blue() ); } else { QString palette = "pal"; if ( !pal_used ) { out << indent << "QPalette " << palette << ";" << endl; pal_used = TRUE; } QString cg = "cg"; if ( !cg_used ) { out << indent << "QColorGroup " << cg << ";" << endl; cg_used = TRUE; } n = e.firstChild().toElement(); while ( !n.isNull() && n.tagName() != "active" ) n = n.nextSibling().toElement(); createColorGroupImpl( cg, n ); out << indent << palette << ".setActive( " << cg << " );" << endl; n = e.firstChild().toElement(); while ( !n.isNull() && n.tagName() != "inactive" ) n = n.nextSibling().toElement(); createColorGroupImpl( cg, n ); out << indent << palette << ".setInactive( " << cg << " );" << endl; n = e.firstChild().toElement(); while ( !n.isNull() && n.tagName() != "disabled" ) n = n.nextSibling().toElement(); createColorGroupImpl( cg, n ); out << indent << palette << ".setDisabled( " << cg << " );" << endl; v = palette; } } else if ( e.tagName() == "cursor" ) { v = "QCursor( %1 )"; v = v.arg( e.firstChild().toText().data() ); } else if ( e.tagName() == "date" ) { QDomElement n3 = e.firstChild().toElement(); int y, m, d; y = m = d = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "year" ) y = n3.firstChild().toText().data().toInt(); else if ( n3.tagName() == "month" ) m = n3.firstChild().toText().data().toInt(); else if ( n3.tagName() == "day" ) d = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } v = "QDate( %1, %2, %3 )"; v = v.arg(y).arg(m).arg(d); } else if ( e.tagName() == "time" ) { QDomElement n3 = e.firstChild().toElement(); int h, m, s; h = m = s = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "hour" ) h = n3.firstChild().toText().data().toInt(); else if ( n3.tagName() == "minute" ) m = n3.firstChild().toText().data().toInt(); else if ( n3.tagName() == "second" ) s = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } v = "QTime( %1, %2, %3 )"; v = v.arg(h).arg(m).arg(s); } else if ( e.tagName() == "datetime" ) { QDomElement n3 = e.firstChild().toElement(); int h, mi, s, y, mo, d; h = mi = s = y = mo = d = 0; while ( !n3.isNull() ) { if ( n3.tagName() == "hour" ) h = n3.firstChild().toText().data().toInt(); else if ( n3.tagName() == "minute" ) mi = n3.firstChild().toText().data().toInt(); else if ( n3.tagName() == "second" ) s = n3.firstChild().toText().data().toInt(); else if ( n3.tagName() == "year" ) y = n3.firstChild().toText().data().toInt(); else if ( n3.tagName() == "month" ) mo = n3.firstChild().toText().data().toInt(); else if ( n3.tagName() == "day" ) d = n3.firstChild().toText().data().toInt(); n3 = n3.nextSibling().toElement(); } v = "QDateTime( QDate( %1, %2, %3 ), QTime( %4, %5, %6 ) )"; v = v.arg(y).arg(mo).arg(d).arg(h).arg(mi).arg(s); } else if ( e.tagName() == "stringlist" ) { QStringList l; QDomElement n3 = e.firstChild().toElement(); QString listname = "l"; if ( !obj.isEmpty() ) { listname = obj + "_stringlist"; listname = registerObject( listname ); out << indent << "QStringList " << listname << ";" << endl; } else { listname = registerObject( listname ); out << indent << "QStringList " << listname << ";" << endl; } while ( !n3.isNull() ) { if ( n3.tagName() == "string" ) out << indent << listname << " << \"" << n3.firstChild().toText().data().simplifyWhiteSpace() << "\";" << endl; n3 = n3.nextSibling().toElement(); } v = listname; } return v; }
/* * Constructs a TTCutAboutDlg which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ TTCutAboutDlg::TTCutAboutDlg( QWidget* parent, const char* name, bool modal, Qt::WFlags fl ) : QDialog( parent, fl ) { if ( !name ) setObjectName( "TTCutAboutDlg" ); setModal( modal ); resize( 520, 657 ); setWindowTitle( tr( "TTCut" ) ); TTCutAboutDlgLayout = new QGridLayout( this ); TTCutAboutDlgLayout->setSpacing( 6 ); TTCutAboutDlgLayout->setMargin( 11 ); laVersionInformation = new QLabel( this ); laVersionInformation->setText( TTCut::versionString ); laVersionInformation->setAlignment( int( Qt::AlignCenter ) ); TTCutAboutDlgLayout->addWidget( laVersionInformation, 0, 0 ); btnClose = new QPushButton( this ); btnClose->setText( tr( "&Close" ) ); TTCutAboutDlgLayout->addWidget( btnClose, 3, 0 ); tvDisclaimer = new Q3TextView( this, "tvDisclaimer" ); tvDisclaimer->setEnabled( TRUE ); QPalette pal; QColorGroup cg; cg.setColor( QColorGroup::Foreground, Qt::black ); cg.setColor( QColorGroup::Button, QColor( 175, 172, 165) ); cg.setColor( QColorGroup::Light, QColor( 255, 253, 247) ); cg.setColor( QColorGroup::Midlight, QColor( 215, 212, 206) ); cg.setColor( QColorGroup::Dark, QColor( 87, 85, 82) ); cg.setColor( QColorGroup::Mid, QColor( 116, 114, 109) ); cg.setColor( QColorGroup::Text, Qt::black ); cg.setColor( QColorGroup::BrightText, Qt::white ); cg.setColor( QColorGroup::ButtonText, Qt::black ); cg.setColor( QColorGroup::Base, QColor( 255, 170, 127) ); cg.setColor( QColorGroup::Background, QColor( 175, 172, 165) ); cg.setColor( QColorGroup::Shadow, Qt::black ); cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) ); cg.setColor( QColorGroup::HighlightedText, Qt::white ); pal.setActive( cg ); cg.setColor( QColorGroup::Foreground, Qt::black ); cg.setColor( QColorGroup::Button, QColor( 175, 172, 165) ); cg.setColor( QColorGroup::Light, QColor( 255, 253, 247) ); cg.setColor( QColorGroup::Midlight, QColor( 201, 197, 189) ); cg.setColor( QColorGroup::Dark, QColor( 87, 85, 82) ); cg.setColor( QColorGroup::Mid, QColor( 116, 114, 109) ); cg.setColor( QColorGroup::Text, Qt::black ); cg.setColor( QColorGroup::BrightText, Qt::white ); cg.setColor( QColorGroup::ButtonText, Qt::black ); cg.setColor( QColorGroup::Base, QColor( 255, 170, 127) ); cg.setColor( QColorGroup::Background, QColor( 175, 172, 165) ); cg.setColor( QColorGroup::Shadow, Qt::black ); cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) ); cg.setColor( QColorGroup::HighlightedText, Qt::white ); pal.setInactive( cg ); cg.setColor( QColorGroup::Foreground, QColor( 128, 128, 128) ); cg.setColor( QColorGroup::Button, QColor( 175, 172, 165) ); cg.setColor( QColorGroup::Light, QColor( 255, 253, 247) ); cg.setColor( QColorGroup::Midlight, QColor( 201, 197, 189) ); cg.setColor( QColorGroup::Dark, QColor( 87, 85, 82) ); cg.setColor( QColorGroup::Mid, QColor( 116, 114, 109) ); cg.setColor( QColorGroup::Text, Qt::black ); cg.setColor( QColorGroup::BrightText, Qt::white ); cg.setColor( QColorGroup::ButtonText, QColor( 128, 128, 128) ); cg.setColor( QColorGroup::Base, QColor( 255, 170, 127) ); cg.setColor( QColorGroup::Background, QColor( 175, 172, 165) ); cg.setColor( QColorGroup::Shadow, Qt::black ); cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) ); cg.setColor( QColorGroup::HighlightedText, Qt::white ); pal.setDisabled( cg ); tvDisclaimer->setPalette( pal ); tvDisclaimer->setText( tr( "TTCut - The LINUX Mpeg Cutter\nCopyrigth (C) 2005 Ben Altendorf ([email protected])\nSee http://ttcut.tritime.org for updates.\n\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the \nFree Software Foundation; either version 2 of the License, or (at your option) \nany later version. \nThis program is distributed in the hope that it will be useful, but WITHOUT\nANY WARRANTY; without even the implied warranty of MERCHANTABILITY \nor FITNESS FOR A PARTICULAR PURPOSE. \nSee the GNU General Public License for more details. \nYou should have received a copy of the GNU General Public License along\nwith this program; if not, write to the Free Software Foundation,\nInc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA." ) ); TTCutAboutDlgLayout->addWidget( tvDisclaimer, 1, 0 ); TextView2 = new Q3TextView( this, "TextView2" ); TextView2->setEnabled( FALSE ); cg.setColor( QColorGroup::Foreground, Qt::black ); cg.setColor( QColorGroup::Button, QColor( 212, 208, 200) ); cg.setColor( QColorGroup::Light, Qt::white ); cg.setColor( QColorGroup::Midlight, QColor( 233, 231, 227) ); cg.setColor( QColorGroup::Dark, QColor( 106, 104, 100) ); cg.setColor( QColorGroup::Mid, QColor( 141, 138, 133) ); cg.setColor( QColorGroup::Text, Qt::black ); cg.setColor( QColorGroup::BrightText, Qt::white ); cg.setColor( QColorGroup::ButtonText, Qt::black ); cg.setColor( QColorGroup::Base, QColor( 212, 208, 200) ); cg.setColor( QColorGroup::Background, QColor( 212, 208, 200) ); cg.setColor( QColorGroup::Shadow, Qt::black ); cg.setColor( QColorGroup::Highlight, QColor( 10, 36, 106) ); cg.setColor( QColorGroup::HighlightedText, Qt::white ); pal.setActive( cg ); cg.setColor( QColorGroup::Foreground, Qt::black ); cg.setColor( QColorGroup::Button, QColor( 212, 208, 200) ); cg.setColor( QColorGroup::Light, Qt::white ); cg.setColor( QColorGroup::Midlight, QColor( 243, 239, 230) ); cg.setColor( QColorGroup::Dark, QColor( 106, 104, 100) ); cg.setColor( QColorGroup::Mid, QColor( 141, 138, 133) ); cg.setColor( QColorGroup::Text, Qt::black ); cg.setColor( QColorGroup::BrightText, Qt::white ); cg.setColor( QColorGroup::ButtonText, Qt::black ); cg.setColor( QColorGroup::Base, QColor( 212, 208, 200) ); cg.setColor( QColorGroup::Background, QColor( 212, 208, 200) ); cg.setColor( QColorGroup::Shadow, Qt::black ); cg.setColor( QColorGroup::Highlight, QColor( 10, 36, 106) ); cg.setColor( QColorGroup::HighlightedText, Qt::white ); pal.setInactive( cg ); cg.setColor( QColorGroup::Foreground, QColor( 128, 128, 128) ); cg.setColor( QColorGroup::Button, QColor( 212, 208, 200) ); cg.setColor( QColorGroup::Light, Qt::white ); cg.setColor( QColorGroup::Midlight, QColor( 243, 239, 230) ); cg.setColor( QColorGroup::Dark, QColor( 106, 104, 100) ); cg.setColor( QColorGroup::Mid, QColor( 141, 138, 133) ); cg.setColor( QColorGroup::Text, Qt::black ); cg.setColor( QColorGroup::BrightText, Qt::white ); cg.setColor( QColorGroup::ButtonText, QColor( 128, 128, 128) ); cg.setColor( QColorGroup::Base, QColor( 212, 208, 200) ); cg.setColor( QColorGroup::Background, QColor( 212, 208, 200) ); cg.setColor( QColorGroup::Shadow, Qt::black ); cg.setColor( QColorGroup::Highlight, QColor( 10, 36, 106) ); cg.setColor( QColorGroup::HighlightedText, Qt::white ); pal.setDisabled( cg ); TextView2->setPalette( pal ); TextView2->setText( tr( "Used libraries:\nlibmpeg2 - a free MPEG-2 video stream decoder (http://libmpeg2.sourceforge.net/)\n\nThanks to:\nMartin Dienert's Mpeg2Schnitt (http://www.mdienert.de/mpeg2schnitt) for inspiration\nand for his fundamental work on analyzing mpeg-video and audio streams.\n\n\nTobias Arnold's Cuttermaran. TTCut's UI (look and feel) was taken from Cuttermaran." ) ); TTCutAboutDlgLayout->addWidget( TextView2, 2, 0 ); // signals and slot connection // ------------------------------------------------------------------ connect( btnClose, SIGNAL( clicked() ), SLOT( onDlgClose() ) ); resize( QSize(840, 480).expandedTo(minimumSizeHint()) ); setMaximumSize( QSize(840, 480).expandedTo(minimumSizeHint()) ); }
/* * Constructs a Manual_Dialog as a child of 'parent', with the * name 'name' and widget flags set to 'f'. * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ Manual_Dialog::Manual_Dialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) , image0( (const char **) image0_data ), image1( (const char **) image1_data ), image2( (const char **) image2_data ), image3( (const char **) image3_data ), image4( (const char **) image4_data ) { if ( !name ) setName( "Manual_Dialog" ); setIcon( image0 ); Manual_DialogLayout = new QGridLayout( this, 1, 1, 2, 2, "Manual_DialogLayout"); content_button = new QToolButton( this, "content_button" ); content_button->setPixmap( image1 ); Manual_DialogLayout->addWidget( content_button, 0, 3 ); manualbrowser = new QTextBrowser( this, "manualbrowser" ); QPalette pal; QColorGroup cg; cg.setColor( QColorGroup::Foreground, black ); cg.setColor( QColorGroup::Button, QColor( 50, 50, 255) ); cg.setColor( QColorGroup::Light, QColor( 177, 177, 255) ); cg.setColor( QColorGroup::Midlight, QColor( 113, 113, 255) ); cg.setColor( QColorGroup::Dark, QColor( 25, 25, 127) ); cg.setColor( QColorGroup::Mid, QColor( 33, 33, 170) ); cg.setColor( QColorGroup::Text, black ); cg.setColor( QColorGroup::BrightText, white ); cg.setColor( QColorGroup::ButtonText, black ); cg.setColor( QColorGroup::Base, white ); cg.setColor( QColorGroup::Background, QColor( 50, 50, 255) ); cg.setColor( QColorGroup::Shadow, black ); cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) ); cg.setColor( QColorGroup::HighlightedText, white ); cg.setColor( QColorGroup::Link, black ); cg.setColor( QColorGroup::LinkVisited, black ); pal.setActive( cg ); cg.setColor( QColorGroup::Foreground, black ); cg.setColor( QColorGroup::Button, QColor( 50, 50, 255) ); cg.setColor( QColorGroup::Light, QColor( 177, 177, 255) ); cg.setColor( QColorGroup::Midlight, QColor( 88, 88, 255) ); cg.setColor( QColorGroup::Dark, QColor( 25, 25, 127) ); cg.setColor( QColorGroup::Mid, QColor( 33, 33, 170) ); cg.setColor( QColorGroup::Text, black ); cg.setColor( QColorGroup::BrightText, white ); cg.setColor( QColorGroup::ButtonText, black ); cg.setColor( QColorGroup::Base, white ); cg.setColor( QColorGroup::Background, QColor( 50, 50, 255) ); cg.setColor( QColorGroup::Shadow, black ); cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) ); cg.setColor( QColorGroup::HighlightedText, white ); cg.setColor( QColorGroup::Link, black ); cg.setColor( QColorGroup::LinkVisited, black ); pal.setInactive( cg ); cg.setColor( QColorGroup::Foreground, QColor( 128, 128, 128) ); cg.setColor( QColorGroup::Button, QColor( 50, 50, 255) ); cg.setColor( QColorGroup::Light, QColor( 177, 177, 255) ); cg.setColor( QColorGroup::Midlight, QColor( 88, 88, 255) ); cg.setColor( QColorGroup::Dark, QColor( 25, 25, 127) ); cg.setColor( QColorGroup::Mid, QColor( 33, 33, 170) ); cg.setColor( QColorGroup::Text, QColor( 128, 128, 128) ); cg.setColor( QColorGroup::BrightText, white ); cg.setColor( QColorGroup::ButtonText, QColor( 128, 128, 128) ); cg.setColor( QColorGroup::Base, white ); cg.setColor( QColorGroup::Background, QColor( 50, 50, 255) ); cg.setColor( QColorGroup::Shadow, black ); cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) ); cg.setColor( QColorGroup::HighlightedText, white ); cg.setColor( QColorGroup::Link, black ); cg.setColor( QColorGroup::LinkVisited, black ); pal.setDisabled( cg ); manualbrowser->setPalette( pal ); Manual_DialogLayout->addMultiCellWidget( manualbrowser, 1, 1, 0, 6 ); print_button = new QToolButton( this, "print_button" ); print_button->setPixmap( image2 ); Manual_DialogLayout->addWidget( print_button, 0, 0 ); backward_button = new QToolButton( this, "backward_button" ); backward_button->setPixmap( image3 ); Manual_DialogLayout->addWidget( backward_button, 0, 2 ); close_button = new QPushButton( this, "close_button" ); Manual_DialogLayout->addWidget( close_button, 0, 6 ); forward_button = new QToolButton( this, "forward_button" ); forward_button->setPixmap( image4 ); Manual_DialogLayout->addWidget( forward_button, 0, 4 ); QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); Manual_DialogLayout->addItem( spacer, 0, 1 ); QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); Manual_DialogLayout->addItem( spacer_2, 0, 5 ); languageChange(); resize( QSize(542, 489).expandedTo(minimumSizeHint()) ); // signals and slots connections connect( backward_button, SIGNAL( clicked() ), manualbrowser, SLOT( backward() ) ); connect( forward_button, SIGNAL( clicked() ), manualbrowser, SLOT( forward() ) ); connect( content_button, SIGNAL( clicked() ), manualbrowser, SLOT( home() ) ); connect( close_button, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( print_button, SIGNAL( clicked() ), this, SLOT( print() ) ); }
//---------------------------------------------------------------------------------- // our main form for Brick-by-Brick //---------------------------------------------------------------------------------- BBB_Form::BBB_Form( QWidget *parent, const char *name ) : QWidget( parent, name ) { // set our forms size and name setName("AutoMason"); // setMinimumSize( 1024,768 ); setMinimumSize( 1024,600 ); setCaption("AutoMason v 2.0"); //-------------------------------------------------------------------------------- // Main Palette Creation //-------------------------------------------------------------------------------- QPalette pal; QColorGroup cg; cg.setColor( QColorGroup::Foreground, black ); cg.setColor( QColorGroup::Button, QColor( 158, 158, 158) ); cg.setColor( QColorGroup::Light, QColor( 237, 237, 237) ); cg.setColor( QColorGroup::Midlight, QColor( 197, 197, 197) ); cg.setColor( QColorGroup::Dark, QColor( 79, 79, 79) ); cg.setColor( QColorGroup::Mid, QColor( 105, 105, 105) ); cg.setColor( QColorGroup::Text, black ); cg.setColor( QColorGroup::BrightText, white ); cg.setColor( QColorGroup::ButtonText, black ); cg.setColor( QColorGroup::Base, white ); cg.setColor( QColorGroup::Background, QColor( 197, 197, 197) ); cg.setColor( QColorGroup::Shadow, black ); cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) ); cg.setColor( QColorGroup::HighlightedText, white ); cg.setColor( QColorGroup::Link, black ); cg.setColor( QColorGroup::LinkVisited, black ); pal.setActive( cg ); cg.setColor( QColorGroup::Foreground, black ); cg.setColor( QColorGroup::Button, QColor( 158, 158, 158) ); cg.setColor( QColorGroup::Light, QColor( 237, 237, 237) ); cg.setColor( QColorGroup::Midlight, QColor( 181, 181, 181) ); cg.setColor( QColorGroup::Dark, QColor( 79, 79, 79) ); cg.setColor( QColorGroup::Mid, QColor( 105, 105, 105) ); cg.setColor( QColorGroup::Text, black ); cg.setColor( QColorGroup::BrightText, white ); cg.setColor( QColorGroup::ButtonText, black ); cg.setColor( QColorGroup::Base, white ); cg.setColor( QColorGroup::Background, QColor( 197, 197, 197) ); cg.setColor( QColorGroup::Shadow, black ); cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) ); cg.setColor( QColorGroup::HighlightedText, white ); cg.setColor( QColorGroup::Link, black ); cg.setColor( QColorGroup::LinkVisited, black ); pal.setInactive( cg ); cg.setColor( QColorGroup::Foreground, QColor( 128, 128, 128) ); cg.setColor( QColorGroup::Button, QColor( 158, 158, 158) ); cg.setColor( QColorGroup::Light, QColor( 237, 237, 237) ); cg.setColor( QColorGroup::Midlight, QColor( 181, 181, 181) ); cg.setColor( QColorGroup::Dark, QColor( 79, 79, 79) ); cg.setColor( QColorGroup::Mid, QColor( 105, 105, 105) ); cg.setColor( QColorGroup::Text, QColor( 128, 128, 128) ); cg.setColor( QColorGroup::BrightText, white ); cg.setColor( QColorGroup::ButtonText, QColor( 128, 128, 128) ); cg.setColor( QColorGroup::Base, white ); cg.setColor( QColorGroup::Background, QColor( 197, 197, 197) ); cg.setColor( QColorGroup::Shadow, black ); cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) ); cg.setColor( QColorGroup::HighlightedText, white ); cg.setColor( QColorGroup::Link, white ); cg.setColor( QColorGroup::LinkVisited, white ); pal.setDisabled( cg ); setPalette( pal ); //-------------------------------------------------------------------------------- // UI - Toolbox Container Setup //-------------------------------------------------------------------------------- tb_MainUI = new QToolBox( this, "tb_MainUI" ); tb_MainUI->setGeometry( QRect( 855, 10, 165, 750 ) ); tb_MainUI->setFrameShape( QToolBox::NoFrame ); tb_MainUI->setFrameShadow( QToolBox::Plain ); tb_MainUI->setCurrentIndex( 0 ); pg_BrickCreation = new QWidget( tb_MainUI, "pg_BrickCreation" ); pg_BrickCreation->setBackgroundMode( QWidget::PaletteBackground ); pg_StartCondition = new QWidget( tb_MainUI, "pg_StartCondition" ); pg_StartCondition->setBackgroundMode( QWidget::PaletteBackground ); pg_Rules = new QWidget( tb_MainUI, "pg_Rules" ); pg_Rules->setBackgroundMode( QWidget::PaletteBackground ); pg_Rules->setFocusPolicy(QWidget::StrongFocus); pg_BeamCreation = new QWidget( tb_MainUI, "pg_BeamCreation" ); pg_BeamCreation->setBackgroundMode( QWidget::PaletteBackground ); tb_MainUI->addItem( pg_BrickCreation, QString::fromLatin1("Brick Creation") ); tb_MainUI->addItem( pg_StartCondition, QString::fromLatin1("Start Conditions") ); tb_MainUI->addItem( pg_Rules, QString::fromLatin1("Pattern Generation") ); tb_MainUI->addItem( pg_BeamCreation, QString::fromLatin1("Beam Generation") ); //-------------------------------------------------------------------------------- // UI - Brick Generation //-------------------------------------------------------------------------------- grp_BrickCreation = new QGroupBox( pg_BrickCreation, "grp_BrickCreation" ); grp_BrickCreation->setGeometry( QRect( 0, 0, 165, 165) ); // , 140) ); // brick size lbl_BrickSize = new QLabel( grp_BrickCreation, "lbl_BrickSize" ); lbl_BrickSize->setGeometry( QRect( 5, 7, 50, 14 ) ); lbl_BrickSize->setText("Brick Size:"); lbl_BrickSize_Length = new QLabel( grp_BrickCreation, "lbl_BrickSize_Length" ); lbl_BrickSize_Length->setGeometry( QRect( 5, 23, 30, 20 ) ); lbl_BrickSize_Length->setText("width:"); edit_BrickSize_Length = new QLineEdit( grp_BrickCreation, "edit_BrickSize_Length" ); edit_BrickSize_Length->setGeometry( QRect( 35, 22, 40, 20 ) ); edit_BrickSize_Length->setText("8"); lbl_BrickSize_Width = new QLabel( grp_BrickCreation, "lbl_BrickSize_Width" ); lbl_BrickSize_Width->setGeometry( QRect( 80, 22, 33, 20 ) ); lbl_BrickSize_Width->setText("height:"); edit_BrickSize_Width = new QLineEdit( grp_BrickCreation, "edit_BrickSize_Width" ); edit_BrickSize_Width->setGeometry( QRect( 115, 22, 40, 20 ) ); edit_BrickSize_Width->setText("4"); // number of bricks lbl_NumBricks = new QLabel( grp_BrickCreation, "lbl_NumBricks" ); lbl_NumBricks->setGeometry( QRect( 5, 53, 85, 20 ) ); lbl_NumBricks->setText("Number of Bricks:"); lbl_NumBricks_Rows = new QLabel( grp_BrickCreation, "lbl_NumBricks_Rows" ); lbl_NumBricks_Rows->setGeometry( QRect( 5, 72, 26, 20 ) ); lbl_NumBricks_Rows->setText("rows:"); edit_NumBricks_Row = new QLineEdit( grp_BrickCreation, "edit_NumBricks_Row" ); edit_NumBricks_Row->setGeometry( QRect( 35, 72, 40, 20 ) ); edit_NumBricks_Row->setText("20"); // CHIPP - Begin cantilevered height edit // cantilevered height lbl_Cantilevered_Height = new QLabel( grp_BrickCreation, "lbl_Cantilevered_Height" ); lbl_Cantilevered_Height->setGeometry( QRect( 5, 91, 100, 20 ) ); lbl_Cantilevered_Height->setText("cantilevered height:"); lbl_Cantilevered_Height->hide(); edit_Cantilevered_Height = new QLineEdit( grp_BrickCreation, "edit_Cantilevered_Height" ); edit_Cantilevered_Height->setGeometry( QRect( 104, 91, 40, 20 ) ); edit_Cantilevered_Height->setText("12"); edit_Cantilevered_Height->hide(); // CHIPP - End cantilevered height edit // CHIPP - Swap cantilevered height with Padding Rows // padding height lbl_Padding_Rows = new QLabel( grp_BrickCreation, "lbl_Padding_Rows" ); lbl_Padding_Rows->setGeometry( QRect( 5, 91, 100, 20 ) ); lbl_Padding_Rows->setText("padding rows:"); edit_Padding_Rows = new QLineEdit( grp_BrickCreation, "edit_Padding_Rows" ); edit_Padding_Rows->setGeometry( QRect( 74, 91, 40, 20 ) ); edit_Padding_Rows->setText("1"); // CHIPP - Swap cantilevered height with Padding Rows // layout toggle btn_BrickOffset = new QPushButton( grp_BrickCreation, "btn_BrickOffset" ); // btn_BrickOffset->setGeometry( QRect( 10, 102, 140, 25 )); btn_BrickOffset->setGeometry( QRect( 10, 121, 140, 25 )); // CHIPP - bumped down brick offset button btn_BrickOffset->setText("Offset Bricks"); btn_BrickOffset->setToggleButton(true); btn_BrickOffset->setPalette( pal ); //-------------------------------------------------------------------------------- // UI - Start Conditions //-------------------------------------------------------------------------------- btn_ActivateBricks = new QPushButton( pg_StartCondition, "btn_ActivateBricks" ); btn_ActivateBricks->setGeometry( QRect( 10, 10, 140, 25 )); btn_ActivateBricks->setText("Activate Bricks"); btn_ActivateBricks->setToggleButton(true); btn_ActivateBricks->setPalette( pal ); btn_ActivateBricks->setFocusProxy(pg_StartCondition); btn_ClearActiveBricks = new QPushButton( pg_StartCondition, "btn_ClearActiveBricks" ); btn_ClearActiveBricks->setGeometry( QRect( 10, 40, 140, 25 ) ); btn_ClearActiveBricks->setText("Clear Start Condition"); btn_ClearActiveBricks->setPalette( pal ); btn_ClearActiveBricks->setFocusProxy(pg_StartCondition); btn_RandomActiveBricks = new QPushButton( pg_StartCondition, "btn_RandomActiveBricks" ); btn_RandomActiveBricks->setGeometry( QRect( 10, 70, 140, 25 ) ); btn_RandomActiveBricks->setText("Random Start Condition"); btn_RandomActiveBricks->setPalette( pal ); btn_RandomActiveBricks->setFocusProxy(pg_StartCondition); //-------------------------------------------------------------------------------- // UI - Rules //-------------------------------------------------------------------------------- btn_Rule_00000 = new QPushButton( pg_Rules, "btn_Rule_00000" ); btn_Rule_00000->setGeometry( QRect( 10, 9, 70, 20 ) ); btn_Rule_00000->setPixmap( QPixmap::fromMimeSource( "data\\rule_00000.bmp" ) ); btn_Rule_00000->setToggleButton(true); btn_Rule_00000->setPalette( pal ); btn_Rule_00000->setFocusProxy(pg_Rules); btn_Rule_10000 = new QPushButton( pg_Rules, "btn_Rule_10000" ); btn_Rule_10000->setGeometry( QRect( 10, 29, 70, 20 ) ); btn_Rule_10000->setPixmap( QPixmap::fromMimeSource( "data\\rule_10000.bmp" ) ); btn_Rule_10000->setToggleButton(true); btn_Rule_10000->setPalette( pal ); btn_Rule_10000->setFocusProxy(pg_Rules); btn_Rule_01000 = new QPushButton( pg_Rules, "btn_Rule_01000" ); btn_Rule_01000->setGeometry( QRect( 10, 50, 70, 20 ) ); btn_Rule_01000->setPixmap( QPixmap::fromMimeSource( "data\\rule_01000.bmp" ) ); btn_Rule_01000->setToggleButton(true); btn_Rule_01000->setPalette( pal ); btn_Rule_01000->setFocusProxy(pg_Rules); btn_Rule_00100 = new QPushButton( pg_Rules, "btn_Rule_00100" ); btn_Rule_00100->setGeometry( QRect( 10, 70, 70, 20 ) ); btn_Rule_00100->setPixmap( QPixmap::fromMimeSource( "data\\rule_00100.bmp" ) ); btn_Rule_00100->setToggleButton(true); btn_Rule_00100->setPalette( pal ); btn_Rule_00100->setFocusProxy(pg_Rules); btn_Rule_00010 = new QPushButton( pg_Rules, "btn_Rule_00010" ); btn_Rule_00010->setGeometry( QRect( 10, 90, 70, 20 ) ); btn_Rule_00010->setPixmap( QPixmap::fromMimeSource( "data\\rule_00010.bmp" ) ); btn_Rule_00010->setToggleButton(true); btn_Rule_00010->setPalette( pal ); btn_Rule_00010->setFocusProxy(pg_Rules); btn_Rule_00001 = new QPushButton( pg_Rules, "btn_Rule_00001" ); btn_Rule_00001->setGeometry( QRect( 10, 110, 70, 20 ) ); btn_Rule_00001->setPixmap( QPixmap::fromMimeSource( "data\\rule_00001.bmp" ) ); btn_Rule_00001->setToggleButton(true); btn_Rule_00001->setPalette( pal ); btn_Rule_00001->setFocusProxy(pg_Rules); btn_Rule_11000 = new QPushButton( pg_Rules, "btn_Rule_11000" ); btn_Rule_11000->setGeometry( QRect( 10, 130, 70, 20 ) ); btn_Rule_11000->setPixmap( QPixmap::fromMimeSource( "data\\rule_11000.bmp" ) ); btn_Rule_11000->setToggleButton(true); btn_Rule_11000->setPalette( pal ); btn_Rule_11000->setFocusProxy(pg_Rules); btn_Rule_10100 = new QPushButton( pg_Rules, "btn_Rule_10100" ); btn_Rule_10100->setGeometry( QRect( 10, 150, 70, 20 ) ); btn_Rule_10100->setPixmap( QPixmap::fromMimeSource( "data\\rule_10100.bmp" ) ); btn_Rule_10100->setToggleButton(true); btn_Rule_10100->setPalette( pal ); btn_Rule_10100->setFocusProxy(pg_Rules); btn_Rule_10010 = new QPushButton( pg_Rules, "btn_Rule_10010" ); btn_Rule_10010->setGeometry( QRect( 10, 170, 70, 20 ) ); btn_Rule_10010->setPixmap( QPixmap::fromMimeSource( "data\\rule_10010.bmp" ) ); btn_Rule_10010->setToggleButton(true); btn_Rule_10010->setPalette( pal ); btn_Rule_10010->setFocusProxy(pg_Rules); btn_Rule_10001 = new QPushButton( pg_Rules, "btn_Rule_10001" ); btn_Rule_10001->setGeometry( QRect( 10, 190, 70, 20 ) ); btn_Rule_10001->setPixmap( QPixmap::fromMimeSource( "data\\rule_10001.bmp" ) ); btn_Rule_10001->setToggleButton(true); btn_Rule_10001->setPalette( pal ); btn_Rule_10001->setFocusProxy(pg_Rules); btn_Rule_01100 = new QPushButton( pg_Rules, "btn_Rule_01100" ); btn_Rule_01100->setGeometry( QRect( 10, 210, 70, 20 ) ); btn_Rule_01100->setPixmap( QPixmap::fromMimeSource( "data\\rule_01100.bmp" ) ); btn_Rule_01100->setToggleButton(true); btn_Rule_01100->setPalette( pal ); btn_Rule_01100->setFocusProxy(pg_Rules); btn_Rule_01010 = new QPushButton( pg_Rules, "btn_Rule_01010" ); btn_Rule_01010->setGeometry( QRect( 10, 230, 70, 20 ) ); btn_Rule_01010->setPixmap( QPixmap::fromMimeSource( "data\\rule_01010.bmp" ) ); btn_Rule_01010->setToggleButton(true); btn_Rule_01010->setPalette( pal ); btn_Rule_01010->setFocusProxy(pg_Rules); btn_Rule_01001 = new QPushButton( pg_Rules, "btn_Rule_01001" ); btn_Rule_01001->setGeometry( QRect( 10, 250, 70, 20 ) ); btn_Rule_01001->setPixmap( QPixmap::fromMimeSource( "data\\rule_01001.bmp" ) ); btn_Rule_01001->setToggleButton(true); btn_Rule_01001->setPalette( pal ); btn_Rule_01001->setFocusProxy(pg_Rules); btn_Rule_00110 = new QPushButton( pg_Rules, "btn_Rule_00110" ); btn_Rule_00110->setGeometry( QRect( 10, 270, 70, 20 ) ); btn_Rule_00110->setPixmap( QPixmap::fromMimeSource( "data\\rule_00110.bmp" ) ); btn_Rule_00110->setToggleButton(true); btn_Rule_00110->setPalette( pal ); btn_Rule_00110->setFocusProxy(pg_Rules); btn_Rule_00101 = new QPushButton( pg_Rules, "btn_Rule_00101" ); btn_Rule_00101->setGeometry( QRect( 10, 290, 70, 20 ) ); btn_Rule_00101->setPixmap( QPixmap::fromMimeSource( "data\\rule_00101.bmp" ) ); btn_Rule_00101->setToggleButton(true); btn_Rule_00101->setPalette( pal ); btn_Rule_00101->setFocusProxy(pg_Rules); btn_Rule_00011 = new QPushButton( pg_Rules, "btn_Rule_00011" ); btn_Rule_00011->setGeometry( QRect( 10, 310, 70, 20 ) ); btn_Rule_00011->setPixmap( QPixmap::fromMimeSource( "data\\rule_00011.bmp" ) ); btn_Rule_00011->setToggleButton(true); btn_Rule_00011->setPalette( pal ); btn_Rule_00011->setFocusProxy(pg_Rules); btn_Rule_11100 = new QPushButton( pg_Rules, "btn_Rule_11100" ); btn_Rule_11100->setGeometry( QRect( 85, 9, 70, 20 ) ); btn_Rule_11100->setPixmap( QPixmap::fromMimeSource( "data\\rule_11100.bmp" ) ); btn_Rule_11100->setToggleButton(true); btn_Rule_11100->setPalette( pal ); btn_Rule_11100->setFocusProxy(pg_Rules); btn_Rule_11010 = new QPushButton( pg_Rules, "btn_Rule_11010" ); btn_Rule_11010->setGeometry( QRect( 85, 29, 70, 20 ) ); btn_Rule_11010->setPixmap( QPixmap::fromMimeSource( "data\\rule_11010.bmp" ) ); btn_Rule_11010->setToggleButton(true); btn_Rule_11010->setPalette( pal ); btn_Rule_11010->setFocusProxy(pg_Rules); btn_Rule_11001 = new QPushButton( pg_Rules, "btn_Rule_11001" ); btn_Rule_11001->setGeometry( QRect( 85, 50, 70, 20 ) ); btn_Rule_11001->setPixmap( QPixmap::fromMimeSource( "data\\rule_11001.bmp" ) ); btn_Rule_11001->setToggleButton(true); btn_Rule_11001->setPalette( pal ); btn_Rule_11001->setFocusProxy(pg_Rules); btn_Rule_11110 = new QPushButton( pg_Rules, "btn_Rule_11110" ); btn_Rule_11110->setGeometry( QRect( 85, 190, 70, 20 ) ); btn_Rule_11110->setPixmap( QPixmap::fromMimeSource( "data\\rule_11001.bmp" ) ); btn_Rule_11110->setToggleButton(true); btn_Rule_11110->setPalette( pal ); btn_Rule_11110->setFocusProxy(pg_Rules); btn_Rule_01111 = new QPushButton( pg_Rules, "btn_Rule_01111" ); btn_Rule_01111->setGeometry( QRect( 85, 270, 70, 20 ) ); btn_Rule_01111->setPixmap( QPixmap::fromMimeSource( "data\\rule_01111.bmp" ) ); btn_Rule_01111->setToggleButton(true); btn_Rule_01111->setPalette( pal ); btn_Rule_01111->setFocusProxy(pg_Rules); btn_Rule_01110 = new QPushButton( pg_Rules, "btn_Rule_01110" ); btn_Rule_01110->setGeometry( QRect( 85, 90, 70, 20 ) ); btn_Rule_01110->setPixmap( QPixmap::fromMimeSource( "data\\rule_01110.bmp" ) ); btn_Rule_01110->setToggleButton(true); btn_Rule_01110->setPalette( pal ); btn_Rule_01110->setFocusProxy(pg_Rules); btn_Rule_10101 = new QPushButton( pg_Rules, "btn_Rule_10101" ); btn_Rule_10101->setGeometry( QRect( 85, 170, 70, 20 ) ); btn_Rule_10101->setPixmap( QPixmap::fromMimeSource( "data\\rule_10101.bmp" ) ); btn_Rule_10101->setToggleButton(true); btn_Rule_10101->setPalette( pal ); btn_Rule_10101->setFocusProxy(pg_Rules); btn_Rule_10111 = new QPushButton( pg_Rules, "btn_Rule_10111" ); btn_Rule_10111->setGeometry( QRect( 85, 250, 70, 20 ) ); btn_Rule_10111->setPixmap( QPixmap::fromMimeSource( "data\\rule_10111.bmp" ) ); btn_Rule_10111->setToggleButton(true); btn_Rule_10111->setPalette( pal ); btn_Rule_10111->setFocusProxy(pg_Rules); btn_Rule_10011 = new QPushButton( pg_Rules, "btn_Rule_10011" ); btn_Rule_10011->setGeometry( QRect( 85, 70, 70, 20 ) ); btn_Rule_10011->setPixmap( QPixmap::fromMimeSource( "data\\rule_10011.bmp" ) ); btn_Rule_10011->setToggleButton(true); btn_Rule_10011->setPalette( pal ); btn_Rule_10011->setFocusProxy(pg_Rules); btn_Rule_01101 = new QPushButton( pg_Rules, "btn_Rule_01101" ); btn_Rule_01101->setGeometry( QRect( 85, 150, 70, 20 ) ); btn_Rule_01101->setPixmap( QPixmap::fromMimeSource( "data\\rule_01101.bmp" ) ); btn_Rule_01101->setToggleButton(true); btn_Rule_01101->setPalette( pal ); btn_Rule_01101->setFocusProxy(pg_Rules); btn_Rule_11011 = new QPushButton( pg_Rules, "btn_Rule_11011" ); btn_Rule_11011->setGeometry( QRect( 85, 230, 70, 20 ) ); btn_Rule_11011->setPixmap( QPixmap::fromMimeSource( "data\\rule_11011.bmp" ) ); btn_Rule_11011->setToggleButton(true); btn_Rule_11011->setPalette( pal ); btn_Rule_11011->setFocusProxy(pg_Rules); btn_Rule_01011 = new QPushButton( pg_Rules, "btn_Rule_01011" ); btn_Rule_01011->setGeometry( QRect( 85, 130, 70, 20 ) ); btn_Rule_01011->setPixmap( QPixmap::fromMimeSource( "data\\rule_01011.bmp" ) ); btn_Rule_01011->setToggleButton(true); btn_Rule_01011->setPalette( pal ); btn_Rule_01011->setFocusProxy(pg_Rules); btn_Rule_11101 = new QPushButton( pg_Rules, "btn_Rule_11101" ); btn_Rule_11101->setGeometry( QRect( 85, 210, 70, 20 ) ); btn_Rule_11101->setPixmap( QPixmap::fromMimeSource( "data\\rule_11101.bmp" ) ); btn_Rule_11101->setToggleButton(true); btn_Rule_11101->setPalette( pal ); btn_Rule_11101->setFocusProxy(pg_Rules); btn_Rule_11111 = new QPushButton( pg_Rules, "btn_Rule_11111" ); btn_Rule_11111->setGeometry( QRect( 85, 290, 70, 20 ) ); btn_Rule_11111->setPixmap( QPixmap::fromMimeSource( "data\\rule_11111.bmp" ) ); btn_Rule_11111->setToggleButton(true); btn_Rule_11111->setPalette( pal ); btn_Rule_11111->setFocusProxy(pg_Rules); btn_Rule_00111 = new QPushButton( pg_Rules, "btn_Rule_00111" ); btn_Rule_00111->setGeometry( QRect( 85, 110, 70, 20 ) ); btn_Rule_00111->setPixmap( QPixmap::fromMimeSource( "data\\rule_00111.bmp" ) ); btn_Rule_00111->setToggleButton(true); btn_Rule_00111->setPalette( pal ); btn_Rule_00111->setFocusProxy(pg_Rules); btn_Rule_10110 = new QPushButton( pg_Rules, "btn_Rule_10110" ); btn_Rule_10110->setGeometry( QRect( 85, 310, 70, 20 ) ); btn_Rule_10110->setPixmap( QPixmap::fromMimeSource( "data\\rule_10110.bmp" ) ); btn_Rule_10110->setToggleButton(true); btn_Rule_10110->setPalette( pal ); btn_Rule_10110->setFocusProxy(pg_Rules); btn_GeneratePattern = new QPushButton( pg_Rules, "btn_GeneratePattern" ); btn_GeneratePattern->setGeometry( QRect( 16, 340, 135, 35 ) ); btn_GeneratePattern->setText("Generate Pattern"); //btn_GeneratePattern->setToggleButton(true); btn_GeneratePattern->setPalette( pal ); btn_GeneratePattern->setFocusProxy(pg_Rules); btn_ClearPattern = new QPushButton( pg_Rules, "btn_ClearPattern" ); btn_ClearPattern->setGeometry( QRect( 16, 380, 135, 25 ) ); btn_ClearPattern->setText("Clear Pattern"); btn_ClearPattern->setPalette( pal ); btn_ClearPattern->setFocusProxy(pg_Rules); btn_ResetRules = new QPushButton( pg_Rules, "btn_ResetRules" ); btn_ResetRules->setGeometry( QRect( 16, 410, 135, 25 ) ); btn_ResetRules->setText("Reset Rules"); btn_ResetRules->setPalette( pal ); btn_ResetRules->setFocusProxy(pg_Rules); //-------------------------------------------------------------------------------- // UI - Beam Creation //-------------------------------------------------------------------------------- btn_GenerateBeams = new QPushButton( pg_BeamCreation, "btn_GenerateBeams" ); btn_GenerateBeams->setGeometry( QRect( 10, 10, 145, 25 ) ); btn_GenerateBeams->setText("Generate Beams"); btn_GenerateBeams->setPalette( pal ); btn_ClearBeams = new QPushButton( pg_BeamCreation, "btn_ClearBeams" ); btn_ClearBeams->setGeometry( QRect( 10, 42, 145, 25 ) ); btn_ClearBeams->setText("Clear Beams"); btn_ClearBeams->setPalette( pal ); //-------------------------------------------------------------------------------- // UI - OpenGL Window //-------------------------------------------------------------------------------- // Create a nice frame to put around the OpenGL widget qgl_GLFrame = new QFrame( this, "qgl_GLFrame" ); qgl_GLFrame->setFrameStyle( QFrame::Sunken | QFrame::Panel ); qgl_GLFrame->setLineWidth( 2 ); qgl_GLFrame->setMinimumSize(840,550); // our OpenGL derived object/widget qgl_GLWindow = new BBB_GLWidget( qgl_GLFrame, "qgl_GLWindow" ); qgl_GLWindow->setBackgroundColor(QColor(128,128,128)); qgl_GLWindow->bindForm(this); //-------------------------------------------------------------------------------- // Signals & Slots //-------------------------------------------------------------------------------- QObject::connect( btn_ActivateBricks, SIGNAL(clicked()), qgl_GLWindow, SLOT(activateBricks()) ); QObject::connect( btn_ClearActiveBricks, SIGNAL(clicked()), qgl_GLWindow, SLOT(clearActiveBricks()) ); QObject::connect( btn_RandomActiveBricks, SIGNAL(clicked()), qgl_GLWindow, SLOT(randomActiveBricks()) ); QObject::connect( btn_GeneratePattern, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); QObject::connect( btn_ClearPattern, SIGNAL(clicked()), qgl_GLWindow, SLOT(clearPattern()) ); QObject::connect( btn_ResetRules, SIGNAL(clicked()), qgl_GLWindow, SLOT(clearRules()) ); QObject::connect( btn_GenerateBeams, SIGNAL(clicked()), qgl_GLWindow, SLOT(generateBeams()) ); QObject::connect( btn_ClearBeams, SIGNAL(clicked()), qgl_GLWindow, SLOT(clearBeams()) ); QObject::connect( btn_BrickOffset, SIGNAL(clicked()), qgl_GLWindow, SLOT(toggleOffset()) ); QObject::connect( edit_NumBricks_Row, SIGNAL(textChanged(const QString&)), qgl_GLWindow, SLOT(rebuildBricks()) ); QObject::connect( edit_BrickSize_Length, SIGNAL(textChanged(const QString&)), qgl_GLWindow, SLOT(rebuildBricks()) ); QObject::connect( edit_BrickSize_Width, SIGNAL(textChanged(const QString&)), qgl_GLWindow, SLOT(rebuildBricks()) ); QObject::connect( edit_Cantilevered_Height, SIGNAL(textChanged(const QString&)), qgl_GLWindow, SLOT(cantileverPattern()) ); QObject::connect( edit_Padding_Rows, SIGNAL(textChanged(const QString&)), qgl_GLWindow, SLOT(rebuildBricks()) ); //-------------------------------------------------------------------------------- // Signals & Slots - Rules (used for "real-time" CA generation //-------------------------------------------------------------------------------- //QObject::connect( btn_Rule_00000, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_10000, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_01000, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_00100, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_00010, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_00001, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_11000, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_10100, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_10010, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_10001, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_01100, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_01010, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_01001, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_00110, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_00101, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_00011, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_11100, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_11010, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_11001, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_11110, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_01111, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_01110, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_10101, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_10111, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_10011, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_01101, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_11011, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_01011, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_11101, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_11111, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_00111, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //QObject::connect( btn_Rule_10110, SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) ); //-------------------------------------------------------------------------------- // Menu //-------------------------------------------------------------------------------- // Create a menu with "file" elements menu_File = new QPopupMenu( this ); menu_File->insertItem( "Save Pattern", qgl_GLWindow, SLOT(savePattern()), CTRL+Key_S ); menu_File->insertItem( "Load Pattern", qgl_GLWindow, SLOT(loadPattern()), CTRL+Key_L ); menu_File->insertItem( "Clear Pattern", qgl_GLWindow, SLOT(resetAll()), CTRL+Key_N ); menu_File->insertSeparator(); menu_File->insertItem( "Import Path", qgl_GLWindow, SLOT(importPath()), CTRL+Key_I ); menu_File->insertItem( "Export to OBJ", qgl_GLWindow, SLOT(exportToObj()), CTRL+Key_X ); menu_File->insertItem( "Export to RLE", qgl_GLWindow, SLOT(exportToRLE()), CTRL+Key_R ); menu_File->insertItem( "Export to Playlist", qgl_GLWindow, SLOT(exportToMP3()), CTRL+Key_P ); menu_File->insertSeparator(); menu_File->insertItem( "Exit", qApp, SLOT(quit()), CTRL+Key_Q ); // Create a menu with "utility" elements menu_Utility = new QPopupMenu( this ); menu_Utility->insertItem( "Invert Active", qgl_GLWindow, SLOT(invertActive()), ALT+Key_I); menu_Utility->insertItem( "Hide/Show Inactive", qgl_GLWindow, SLOT(showInactive()), ALT+Key_H); menu_Utility->insertItem( "Take Screenshot", qgl_GLWindow, SLOT(takeScreenshot()), ALT+Key_S); menu_Utility->insertItem( "Zoom Extensts", qgl_GLWindow, SLOT(zoomExtents()), ALT+Key_Z); menu_Utility->insertItem( "Draw Borders", qgl_GLWindow, SLOT(toggleBorders()), ALT+Key_B); menu_Utility->insertItem( "Draw Grid", qgl_GLWindow, SLOT(toggleGrid()), ALT+Key_G); // Create a menu with "help" elements //menu_Help = new QPopupMenu( this ); //menu_Help->insertItem( "Online Help", qApp, SLOT(quit()), 0); //menu_Help->insertItem( "About", qApp, SLOT(quit()), 0); // create a menu bar to store the popup menu menu_MainBar = new QMenuBar( this ); menu_MainBar->setSeparator( QMenuBar::InWindowsStyle ); menu_MainBar->insertItem("&File", menu_File ); menu_MainBar->insertItem("&Utility", menu_Utility ); //menu_MainBar->insertItem("&Help", menu_Help ); //-------------------------------------------------------------------------------- // Layouts //-------------------------------------------------------------------------------- QVBoxLayout* vlayout = new QVBoxLayout(1,"vlayout"); vlayout->add(tb_MainUI); vlayout->setAlignment(Qt::AlignTop); QHBoxLayout* flayout = new QHBoxLayout( qgl_GLFrame, 2, 2, "flayout"); flayout->addWidget( qgl_GLWindow, 1 ); QHBoxLayout* hlayout = new QHBoxLayout( this, 5, 5, "hlayout"); hlayout->setMenuBar( menu_MainBar ); hlayout->addLayout( vlayout ); hlayout->addWidget( qgl_GLFrame, 1 ); }
/* * Constructs a Chintz_base which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ Chintz_base::Chintz_base( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "Chintz_base" ); resize( 790, 620 ); QFont f( font() ); f.setFamily( "adobe-helvetica" ); setFont( f ); setCaption( tr( "Chintz v0.2" ) ); QToolTip::add( this, tr( "" ) ); altered_state=false; //Make the menu bar at the top of the widget menu=new QMenuBar(this); menu->setSeparator(QMenuBar::InWindowsStyle); QPopupMenu *file=new QPopupMenu(this); file->insertItem("&New Control File",this,SLOT(Clear()),CTRL+Key_N); file->insertItem("&Open Control File",this,SLOT(OpenChildControlFile()),CTRL+Key_O); file->insertItem("&Save Control File",this,SLOT(WriteTheOutput()),CTRL+Key_S); file->insertItem("&Save Control File As...",this,SLOT(SaveAs())); file->insertItem("&Quit",this,SLOT(Close()),CTRL+Key_Q); QPopupMenu *help=new QPopupMenu(this); menu->insertSeparator(0); help->insertItem("&About",this,SLOT(About())); help->insertItem("&Contents",this,SLOT(Help())); menu->insertItem("&File",file,4); menu->insertItem("&Help",help,7); QPixmap image0( ( const char** ) image0_data ); QPixmap image1( ( const char** ) image1_data ); QPixmap image2( ( const char** ) image2_data ); Framebutt = new QFrame( this, "Framebutt" ); Framebutt->setGeometry( QRect( 10, 30, 750, 40 ) ); Framebutt->setFrameShape( QFrame::Panel ); Framebutt->setFrameShadow( QFrame::Raised ); Newby = new QPushButton( Framebutt, "Newby" ); Newby->setGeometry( QRect( 10, 10, 24, 22 ) ); Newby->setText( tr( "" ) ); Newby->setPixmap( image0 ); QToolTip::add( Newby, tr( "New Control File" ) ); Save = new QPushButton( Framebutt, "Save" ); Save->setGeometry( QRect( 70, 10, 22, 22 ) ); Save->setText( tr( "" ) ); Save->setPixmap( image1 ); QToolTip::add( Save, tr( "Save Control File" ) ); OPeny = new QPushButton( Framebutt, "OPeny" ); OPeny->setGeometry( QRect( 40, 10, 24, 22 ) ); OPeny->setText( tr( "" ) ); OPeny->setPixmap( image2 ); QToolTip::add( OPeny, tr( "Open Control File" ) ); connect( Newby, SIGNAL( clicked() ), this, SLOT( Clear() )); connect( Save, SIGNAL( clicked() ), this, SLOT( WriteTheOutput() ) ); connect( OPeny, SIGNAL( clicked() ), this, SLOT( OpenChildControlFile() )); CONTROLFILENAME=""; CONTROLFILENAMELine=new QLineEdit(Framebutt,"CNTRL"); CONTROLFILENAMELine->setGeometry( QRect( 490, 10, 224, 22 ) ); CONTROLFILENAMELine->setText( tr( "" ) ); connect(CONTROLFILENAMELine, SIGNAL( textChanged(const QString&) ), this, SLOT( altered() ) ); connect(CONTROLFILENAMELine, SIGNAL( returnPressed() ), this, SLOT( control() ) ); QLabel* Cntrl=new QLabel(Framebutt,"Cntrlabel"); Cntrl->setGeometry( QRect( 380, 10, 100, 22 ) ); Cntrl->setText(tr("Child Control File")); QFont Cf=Cntrl->font(); Cf.setBold(true); Cntrl->setFont(Cf); Br = new QToolButton( Framebutt, "Br" ); Br->setGeometry( QRect( 714, 10, 20, 23 ) ); Br->setText( tr( "..." ) ); QToolTip::add( Br, tr( "browse" ) ); connect(Br, SIGNAL( clicked() ), this, SLOT( ChildFileSelect() ) ); QPalette pal; QColorGroup cg; cg.setColor( QColorGroup::Foreground, QColor( 200, 110, 250) ); cg.setColor( QColorGroup::Background, QColor( 192, 192, 192) ); pal.setActive(cg); pal.setInactive(cg); Cntrl->setPalette(pal); StatusFrame = new QFrame( this, "StatusFrame" ); StatusFrame->setGeometry( QRect( 10, 590, 751, 21 ) ); StatusFrame->setFrameShape( QFrame::StyledPanel ); StatusFrame->setFrameShadow( QFrame::Raised ); Status = new QLabel( StatusFrame, "Status" ); Status->setGeometry( QRect( 10, 1, 101, 16 ) ); cg.setColor( QColorGroup::Foreground, QColor( 255, 0, 0) ); cg.setColor( QColorGroup::Background, QColor( 192, 192, 192) ); pal.setActive(cg); pal.setInactive(cg); Status->setPalette(pal); #include "generated_chintz_base_constructor_insert" QFileInfo q(".ChintzDefaults"); if (q.exists()){ ReadChildControlFile(".ChintzDefaults"); altered_state=false; Status->setText(""); } }
/** - checks the entered result and compares it to the task's result - shows the correct result and informs the user if he was right or wrong - if the user entered the result unreduced, he will be informed about it - if the user entered a 0 for the denominator, he will be informed about it (division by zero) - emits signals if task was solved right or wrong */ void TaskView::showResult() { QString tmp_str; /* to build a string for a label */ QPalette pal; QColorGroup cg; // change the tooltip of the check button QToolTip::add(m_checkButton, i18n("Click on this button to get to the next task.")); numer_edit->setEnabled(false); deno_edit->setEnabled(false); result = current_task.solve(); m_resultWidget->setResult(result); m_resultWidget->show(); // an empty numerator field will be interpreted as 0 if (numer_edit->text().isEmpty() == true) numer_edit->setText("0"); // an empty denominator field will be interpreted as 1 if (deno_edit->text().isEmpty() == true) deno_edit->setText("1"); /* store the entered result to check it, but without reducing */ entered_result.setNumerator(numer_edit->text().toInt(), false); entered_result.setDenominator(deno_edit->text().toInt(), false); // check the entered result; 0/1 == 0/5 -> true, // but 0/1 == 0/0 -> false // a 0 for denominator is never allowed (always counted as wrong) // // we have to get the 0 directly from the input field, because // Ratio::setDenominator(0, false) will set the denominator to 1 to ensure // the Ratio is valid if ( (deno_edit->text().toInt() != 0) && ((entered_result == result) || (result.numerator() == 0 && entered_result.numerator() == 0)) ) { // emit the signal for correct signalTaskSolvedCorrect(); /* yes, the user entered the correct result */ result_label->setText(i18n("CORRECT")); pal = result_label->palette(); /* set green font color */ cg = pal.active(); cg.setColor(QColorGroup::Foreground, QColor(6, 179, 0)); pal.setActive(cg); cg = pal.inactive(); cg.setColor(QColorGroup::Foreground, QColor(6, 179, 0)); pal.setInactive(cg); result_label->setPalette(pal); result_label->show(); /* show the result at the end of the task */ } else { // emit the signal for wrong signalTaskSolvedWrong(); /* no, the user entered the wrong result */ result_label->setText(i18n("WRONG")); pal = result_label->palette(); /* set red font color */ cg = pal.active(); cg.setColor(QColorGroup::Foreground, QColor(red)); pal.setActive(cg); cg = pal.inactive(); cg.setColor(QColorGroup::Foreground, QColor(red)); pal.setInactive(cg); result_label->setPalette(pal); result_label->show(); /* show the result at the end of the task */ // if the user entered a 0 for the denominator (division by 0) we have to // get the 0 directly from the input field, because // Ratio::setDenominator(0, true) will set the denominator to 1 to ensure // the Ratio is valid if (deno_edit->text().toInt() == 0) { KMessageBox::information(this, i18n("You entered a 0 as the denominator. This means division by zero, which is not allowed. This task will be counted as not correctly solved.")); } else { /* maybe the entered ratio was not reduced */ entered_result.reduce(); if (entered_result == result) KMessageBox::information(this, i18n("You entered the correct result, but not reduced.\nAlways enter your results as reduced. This task will be counted as not correctly solved.")); } } /* if (entered_result == result) */ }
ViewReadLinetree3::ViewReadLinetree3( bool open, QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ), __open(open) { if ( !name ) setName( "ViewReadLinetree3" ); resize( 500, 250 ); if(open)setCaption( tr( "Read Linetree" ) ); else setCaption( tr( "Save Linetree" ) ); buttonLig = new QToolButton( this, "buttonLig" ); buttonLig->setGeometry( QRect( 450, 10, 40, 21 ) ); buttonLig->setText( tr( "..." ) ); QObject::connect( buttonLig,SIGNAL(clicked()),this,SLOT(SelectLigFile())); QLabel * labelDta = new QLabel( this, "labelDta" ); labelDta->setGeometry( QRect( 10, 60, 61, 20 ) ); labelDta->setText( tr( "Dta File" ) ); buttonDta = new QToolButton( this, "buttonDta" ); buttonDta->setGeometry( QRect( 450, 60, 40, 21 ) ); buttonDta->setText( tr( "..." ) ); QObject::connect( buttonDta,SIGNAL(clicked()),this,SLOT(SelectDtaFile())); QLabel * labelSmb = new QLabel( this, "labelSmb" ); labelSmb->setGeometry( QRect( 10, 110, 61, 20 ) ); labelSmb->setText( tr( "SMB Path" ) ); buttonSmb = new QToolButton( this, "buttonSmb" ); buttonSmb->setGeometry( QRect( 450, 110, 40, 21 ) ); buttonSmb->setText( tr( "..." ) ); QObject::connect( buttonSmb,SIGNAL(clicked()),this,SLOT(SelectSMBPath())); QLabel * labelLig = new QLabel( this, "labelLig" ); labelLig->setGeometry( QRect( 10, 10, 61, 20 ) ); labelLig->setText( tr( "Lig File" ) ); editLig = new QLineEdit( this, "editLig" ); editLig->setGeometry( QRect( 100, 10, 350, 22 ) ); editDta = new QLineEdit( this, "editDta" ); editDta->setGeometry( QRect( 100, 60, 350, 22 ) ); if(!DTA_FILENAME.isEmpty())editDta->setText( tr(DTA_FILENAME) ); editSmb = new QLineEdit( this, "editSmb" ); editSmb->setGeometry( QRect( 100, 110, 350, 22 ) ); if(SMB_PATH.isEmpty()) { SMB_PATH = (TOOLS(getPlantGLDir())+"share/plantgl/SMBFiles").c_str() ; } if(!SMB_PATH.isEmpty())editSmb->setText( tr( SMB_PATH ) ); labelKey = new QLabel( this, "labelKey" ); labelKey->setGeometry( QRect( 10, 160, 89, 20 ) ); if(open)labelKey->setText( tr( "Key :" ) ); else labelKey->setText("Key : [AMAPmod]"); editKey = new QLineEdit( this, "editKey" ); editKey->setGeometry( QRect( 100, 160, 350, 22 ) ); editKey->setReadOnly(open); editKey->setFont(QFont("courier", 8)); QPalette pal = editKey->palette(); QColorGroup cg = pal.active(); cg.setColor( QColorGroup::Base, QColor( 212, 208, 200) ); pal.setActive( cg ); cg = pal.inactive(); cg.setColor( QColorGroup::Base, QColor( 212, 208, 200) ); pal.setInactive( cg ); cg = pal.disabled(); cg.setColor( QColorGroup::Base, QColor( 212, 208, 200) ); pal.setDisabled( cg ); editKey->setProperty( "palette", pal ); editKey->setEchoMode(QLineEdit::Password); if(!open)editKey->setText(PGL(LinetreePrinter)::PROTECTION.c_str()); QObject::connect( editKey,SIGNAL(textChanged(const QString&)),this,SLOT(checkKey(const QString&))); DblClickEater * dblCkEater = new DblClickEater(editKey); labelKey->installEventFilter( dblCkEater ); if(!open){ QToolButton * buttonKey = new QToolButton( this, "buttonKey" ); buttonKey->setGeometry( QRect( 450, 160, 40, 21 ) ); buttonKey->setText( tr( "Reset" ) ); QObject::connect( buttonKey,SIGNAL(clicked()),this,SLOT(resetKey())); } buttonCancel = new QPushButton( this, "buttonCancel" ); buttonCancel->setGeometry( QRect( 390, 200, 104, 28 ) ); buttonCancel->setText( tr( "&Cancel" ) ); QObject::connect( buttonCancel,SIGNAL(clicked()),this,SLOT(reject())); buttonOk = new QPushButton( this, "buttonOk" ); buttonOk->setGeometry( QRect( 280, 200, 104, 28 ) ); buttonOk->setText( tr( "&Ok" ) ); QObject::connect( buttonOk,SIGNAL(clicked()),this,SLOT(ok())); endianBox = new QCheckBox( this, "endianBox" ); endianBox->setGeometry( QRect( 10, 205, 90, 20 ) ); endianBox->setText( tr( "Big Endian" ) ); endianBox->setChecked(true); if(open){ QPushButton * buttonTestEndianess = new QPushButton( this, "TestEndianess" ); buttonTestEndianess->setGeometry( QRect( 100, 200, 54, 28 ) ); buttonTestEndianess->setText( tr( "Test" ) ); QObject::connect( buttonTestEndianess,SIGNAL(clicked()),this,SLOT(testEndianess())); } if(!LIG_FILENAME.isEmpty()){ editLig->setText( tr(LIG_FILENAME) ); checkKey(); } }
/** - checks, if the user solved the task correctly - emits signals if task was solved correctly or wrong */ void ExerciseFactorize::showResult() { QString tmp_str, tmp_str2; /* to build a string for a label */ QPalette pal; QColorGroup cg; uint uint_result = 0; // change the tooltip of the check button QToolTip::add(m_checkButton, i18n("Click on this button to get to the next task.")); // disable prime factor buttons m_factor2Button->setEnabled(false); m_factor3Button->setEnabled(false); m_factor5Button->setEnabled(false); m_factor7Button->setEnabled(false); m_factor11Button->setEnabled(false); m_factor13Button->setEnabled(false); m_factor17Button->setEnabled(false); m_factor19Button->setEnabled(false); // disable factor removal button as well m_removeLastFactorButton->setEnabled(false); // show the result m_factorsWidget->setFactors(m_factorsResult); m_factorsWidget->show(); // now calculate the product of the prime factors entered by the user for (uint tmp_uint = 0; tmp_uint < m_factorsEntered.count(); tmp_uint++) { if (tmp_uint == 0) { uint_result = m_factorsEntered[0]; } else { uint_result *= m_factorsEntered[tmp_uint]; } } if (uint_result == m_taskNumber) { // emit the signal for correct signalExerciseSolvedCorrect(); /* yes, the user entered the correct result */ result_label->setText(i18n("CORRECT")); pal = result_label->palette(); /* set green font color */ cg = pal.active(); cg.setColor(QColorGroup::Foreground, QColor(6, 179, 0)); pal.setActive(cg); cg = pal.inactive(); cg.setColor(QColorGroup::Foreground, QColor(6, 179, 0)); pal.setInactive(cg); result_label->setPalette(pal); } else { // emit the signal for wrong signalExerciseSolvedWrong(); /* no, the user entered the wrong result */ result_label->setText(i18n("WRONG")); pal = result_label->palette(); /* set red font color */ cg = pal.active(); cg.setColor(QColorGroup::Foreground, QColor(red)); pal.setActive(cg); cg = pal.inactive(); cg.setColor(QColorGroup::Foreground, QColor(red)); pal.setInactive(cg); result_label->setPalette(pal); } /* if (entered_result == result) */ result_label->show(); /* show the result at the end of the task */ return; }