Beispiel #1
0
/** add comments here */
Screen::Screen( QWidget * parent, char * name )
	: QWidget( parent, name ), GraphicalGameData()
{	
	_leftPressed = false;
	_currentCell = 0;
		
	QHBoxLayout * lay = new QHBoxLayout( this );
	
	_selector = new ItemSelector( this, this );

	theMap = new Map( this );	
	_map = theMap;
	MapView * view = new MapView( theMap, this );

	lay->addWidget( _selector );
	lay->addWidget( view, 1 );
	lay->activate();

	_menu = new QPopupMenu( this );
	_menu->insertItem( "&Delete", M_DELETE );
	_menu->insertItem( "&Properties", M_PROPERTIES );
	connect( _menu, SIGNAL( activated( int ) ), SLOT( slot_popup( int ) ) );
	
	connect( view, SIGNAL( sig_mouseMoved  (Cell *) ), SLOT( slot_mouseMoved  (Cell *) ) );
	connect( view, SIGNAL( sig_mouseLeftPressed(Cell *) ), SLOT( slot_mouseLeftPressed(Cell *) ) );
	connect( view, SIGNAL( sig_mouseRightPressed(Cell *) ), SLOT( slot_mouseRightPressed(Cell *) ) );
	connect( view, SIGNAL( sig_mouseReleased() ), SLOT( slot_mouseReleased() ) );
}
Beispiel #2
0
ScriptEdit::ScriptEdit( QWidget *parent, const char *name )
  : QWidget(parent, name)
{
  QHBoxLayout *tl = new QHBoxLayout(this, 0, 10);

  st = new QComboBox(this, "st");
  st->insertItem("Expect");
  st->insertItem("Send");
  st->insertItem("Pause (sec)");
  st->insertItem("Hangup");
  st->insertItem("Answer");
  st->insertItem("Timeout (sec)");
  st->insertItem("Password");
  st->insertItem("ID");
  st->insertItem("Prompt");
  st->insertItem("PWPrompt");
  st->insertItem("LoopStart");
  st->insertItem("LoopEnd");
  st->insertItem("Scan");
  st->insertItem("Save");
  st->insertItem("SendNoEcho");
  connect(st, SIGNAL(activated(int)), SLOT(setType(int)));

  se = new QLineEdit(this, "se");
  se->setGeometry(120, 5, 140, 25);
  se->setMaxLength(50);
  connect(se, SIGNAL(returnPressed()), SLOT(seReturnPressed()));

  tl->addWidget(st, 3);
  tl->addWidget(se, 7);

  setType(0);

  tl->activate();
}
KTreeColorsPage::KTreeColorsPage( KSettingsDialog *	dialog,
				  QWidget *		parent,
				  KDirStatApp *		mainWin )
    : KSettingsPage( dialog, parent )
    , _mainWin( mainWin )
    , _treeView( mainWin->treeView() )
    , _maxButtons( KDirStatSettingsMaxColorButton )
{
    // Outer layout box

    QHBoxLayout * outerBox = new QHBoxLayout( this,
					      0,	// border
					      dialog->spacingHint() );


    // Inner layout box with a column of color buttons

    QGridLayout *grid = new QGridLayout( _maxButtons,		// rows
					 _maxButtons + 1,	// cols
					 dialog->spacingHint() );
    outerBox->addLayout( grid, 1 );
    grid->setColStretch( 0, 0 );	// label column - dont' stretch

    for ( int i=1; i < _maxButtons; i++ )
    {
	grid->setColStretch( i, 1 );	// all other columns stretch as you like
    }

    for ( int i=0; i < _maxButtons; i++ )
    {
	QString labelText;

	labelText=i18n( "Tree Level %1" ).arg(i+1);
	_colorLabel[i] = new QLabel( labelText, this );
	grid->addWidget( _colorLabel [i], i, 0 );

	_colorButton[i] = new KColorButton( this );
	_colorButton[i]->setMinimumSize( QSize( 80, 10 ) );
	grid->addMultiCellWidget( _colorButton [i], i, i, i+1, _maxButtons );
	grid->setRowStretch( i, 1 );
    }


    // Vertical slider

    _slider = new QSlider( 1,			// minValue
			   _maxButtons,		// maxValue
			   1,			// pageStep
			   1,			// value
			   QSlider::Vertical,
			   this );
    outerBox->addWidget( _slider, 0 );
    outerBox->activate();

    connect( _slider,	SIGNAL( valueChanged( int ) ),
	     this,	SLOT  ( enableColors( int ) ) );
}
Beispiel #4
0
SelectionWidget::SelectionWidget( QWidget * parent, const char * /*name*/ )
	: QFrame( parent )
{	
	QHBoxLayout * layout = new QHBoxLayout( this );
	setFrameStyle( QFrame::Box | QFrame::Raised );
	
	layout->addSpacing( 5 );
	
	QPushButton * butFirst = new QPushButton( "|<", this );
	FIXEDSIZE( butFirst );
	layout->addWidget( butFirst );
	
	QPushButton * butPrevious = new QPushButton( "<", this );
	FIXEDSIZE( butPrevious );
	layout->addWidget( butPrevious );
	layout->addSpacing( 5 );
	
	_labTitle = new QLabel( tr( "None" ), this );
	FIXEDSIZE( _labTitle );
	layout->addWidget( _labTitle );
	layout->addSpacing( 5 );
	
	QPushButton * butNext = new QPushButton( ">", this );
	FIXEDSIZE( butNext );
	layout->addWidget( butNext );

	QPushButton * butLast = new QPushButton( ">|", this );
	FIXEDSIZE( butLast );
	layout->addWidget( butLast );
	
	layout->addSpacing( 5 );
	layout->addStretch( 1 );
	
	QPushButton * butNew = new QPushButton( "New" , this );
	FIXEDSIZE( butNew );
	layout->addWidget( butNew );
	layout->addSpacing( 5 );
	
	QPushButton * butDel = new QPushButton( "Del", this );
	FIXEDSIZE( butDel );
	layout->addWidget( butDel );
	
	layout->addSpacing( 5 );
	layout->activate();
	
	setMinimumHeight( 40 );
	
	connect( butFirst, SIGNAL( clicked() ), SIGNAL( sig_first() ) );
	connect( butPrevious, SIGNAL( clicked() ), SIGNAL( sig_previous() ) );
	connect( butNext, SIGNAL( clicked() ), SIGNAL( sig_next() ) );
	connect( butLast, SIGNAL( clicked() ), SIGNAL( sig_last() ) );
	connect( butNew, SIGNAL( clicked() ), SIGNAL( sig_new() ) );
	connect( butDel, SIGNAL( clicked() ), SIGNAL( sig_del() ) );
}
Beispiel #5
0
DisplayBothMachines::DisplayBothMachines( QWidget * parent, const char * name )
	:QWidget( parent, name )
{
	_machineLeft = new PresentMachines( this );
	_machineRight = new PresentMachines( this );
	QHBoxLayout * layout = new QHBoxLayout( this );
	layout->setMargin( 5 );
	layout->addSpacing( 5 );
	layout->addWidget( _machineLeft );
	layout->addSpacing( 10 );
	layout->addWidget( _machineRight );
	layout->addSpacing( 5 );
	layout->activate();
}
Beispiel #6
0
Screen::Screen( QWidget * parent, char * name )
	: QWidget( parent ), GraphicalGameData()
{
	setWindowTitle( QString ( name ));
	_leftPressed = false;
	_currentCell = 0;
	_changed = false;

	theMap = new Map( this );
	_map = theMap;
	_view = new MapView( theMap, this );

	_selector = new ItemSelector( this, this );

	_miniMap = new MiniMap( theMap, this );

	QVBoxLayout * layV1 = new QVBoxLayout();
	layV1->addWidget( _selector, 1 );
	layV1->addWidget( _miniMap );

	QHBoxLayout * layout = new QHBoxLayout( this );
	layout->addLayout( layV1 );
	layout->addWidget( _view, 1 );
	layout->activate();

	reinit();

	_menu = new QMenu( this );
	
	QSignalMapper * sigmap = new QSignalMapper( this );

	addAction( tr( "&Delete" ), M_DELETE, sigmap );
	addAction( tr( "&Properties" ), M_PROPERTIES, sigmap );

	connect( sigmap, SIGNAL( mapped( int ) ), SLOT( slot_popup( int ) ) );
	
	connect( _view, SIGNAL( sig_mouseMoved  ( GenericCell *) ), SLOT( slot_mouseMoved  ( GenericCell *) ) );
	connect( _view, SIGNAL( sig_mouseLeftPressed( GenericCell *) ), SLOT( slot_mouseLeftPressed( GenericCell *) ) );
	connect( _view, SIGNAL( sig_mouseRightPressed( GenericCell *) ), SLOT( slot_mouseRightPressed( GenericCell *) ) );
	connect( _view, SIGNAL( sig_mouseReleased() ), SLOT( slot_mouseReleased() ) );
	
	connect( _view, SIGNAL( sig_viewportResized( double, double ) ), _miniMap, SLOT( slot_mapviewResized( double, double ) ) );
	connect( _view, SIGNAL( sig_viewportScrolled( double, double ) ), _miniMap, SLOT( slot_mapviewScrolled( double, double ) ) );
	connect( this, SIGNAL( sig_enableGame( bool ) ), _view, SLOT( slot_enableGame( bool ) ) );
	
	connect( _miniMap , SIGNAL( sig_mouseReleasedMinimap( double, double ) ), _view, SLOT( slot_Center( double, double ) ) );
	connect( theMap , SIGNAL( sig_cellChanged( int, int )), _miniMap, SLOT( redrawCell( int , int ) ) );
}
Beispiel #7
0
PresentUnit::PresentUnit( QWidget * parent, const char * name )
	: QWidget( parent, name )
{
	_icon = new Icon( this );
	_label = new Label( this );

	QHBoxLayout * layout = new QHBoxLayout( this );
	layout->setSpacing( 5 );
	layout->addWidget( _icon );
	layout->addWidget( _label, 1 );

	layout->activate();

	connect( _icon, SIGNAL( sig_clicked() ), SIGNAL( sig_clicked() ) );
	connect( _label, SIGNAL( sig_clicked() ), SIGNAL( sig_clicked() ) );
}
Beispiel #8
0
FightControl::FightControl( QWidget * parent, const char * name )
	: QWidget( parent, name )
{
	QHBoxLayout * layout = new QHBoxLayout( this );

	QPushButton * butControl = new QPushButton( this );
	butControl->setFixedSize( 50, 50 );
	butControl->setPixmap( IMAGE_PATH + "misc/btn_control.png" );
	QPushButton * butSurrender = new QPushButton( this );
	butSurrender->setFixedSize( 50, 50 );
	butSurrender->setPixmap( IMAGE_PATH + "misc/btn_surrender.png" );
	QPushButton * butFlee = new QPushButton( this );
	butFlee->setFixedSize( 50, 50 );
	butFlee->setPixmap( IMAGE_PATH + "misc/btn_flee.png" );
	QPushButton * butAuto = new QPushButton( this );
	butAuto->setFixedSize( 50, 50 );
	butAuto->setPixmap( IMAGE_PATH + "misc/btn_auto.png" );
	QPushButton * butSpell = new QPushButton( this );
	butSpell->setFixedSize( 50, 50 );
	butSpell->setPixmap( IMAGE_PATH + "misc/btn_spell.png" );
	QPushButton * butWait = new QPushButton( this );
	butWait->setFixedSize( 50, 50 );
	butWait->setPixmap( IMAGE_PATH + "misc/btn_wait.png" );
	QPushButton * butDefend = new QPushButton( this );
	butDefend->setFixedSize( 50, 50 );
	butDefend->setPixmap( IMAGE_PATH + "misc/btn_defend.png" );
	/*QMultiLineEdit * edit = new QMultiLineEdit( this );
	edit->setReadOnly( true );*/
	_chat = new ChatWidget( this );
	_chat->setFixedHeight( 50 );

	layout->addWidget( butControl );
	layout->addWidget( butSurrender );
	layout->addWidget( butFlee );
	layout->addWidget( butAuto );
	layout->addWidget( _chat, 1 );
	layout->addWidget( butSpell );
	layout->addWidget( butWait );
 	layout->addWidget( butDefend );

	connect( butWait, SIGNAL( pressed( ) ), SLOT( slot_waitPressed( ) ) );
	connect( butFlee, SIGNAL( pressed( ) ), SLOT( slot_fleePressed( ) ) );
	connect( butDefend, SIGNAL( pressed() ), SIGNAL( sig_defend() ) );

	layout->activate();
	setFixedHeight( 50 );
}
Beispiel #9
0
MainResult::MainResult( GenericLord * attack, GenericLord * defense, QWidget * parent, const char * name )
    : QWidget( parent, name )
{
    QHBoxLayout * layout = new QHBoxLayout( this );
    QString fichier;

    _photo1 = new Icon( this );
    fichier.sprintf( "lords/lord_%03d.png", attack->getId() );
    _photo1->setPixmap( QPixmap( IMAGE_PATH + fichier ) );
    layout->addWidget( _photo1 );
    layout->addStretch( 1 );

    _photo2 = new Icon( this );
    fichier.sprintf( "lords/lord_%03d.png", defense->getId() );
    _photo2->setPixmap( QPixmap( IMAGE_PATH + fichier ) );
    layout->addWidget( _photo2 );

    layout->activate();
}
KCleanupPage::KCleanupPage( KSettingsDialog *	dialog,
			    QWidget *		parent,
			    KDirStatApp *	mainWin )
    : KSettingsPage( dialog, parent )
    , _mainWin( mainWin )
    , _currentCleanup( 0 )
{
    // Copy the main window's cleanup collection.

    _workCleanupCollection = *mainWin->cleanupCollection();

    // Create layout and widgets.

    QHBoxLayout * layout = new QHBoxLayout( this,
					    0,				// border
					    dialog->spacingHint() );	// spacing
    _listBox	= new KCleanupListBox( this );
    _props	= new KCleanupPropertiesPage( this, mainWin );


    // Connect list box signals to reflect changes in the list
    // selection in the cleanup properties page - whenever the user
    // clicks on a different cleanup in the list, the properties page
    // will display that cleanup's values.

    connect( _listBox, SIGNAL( selectCleanup( KCleanup * ) ),
	     this,     SLOT  ( changeCleanup( KCleanup * ) ) );


    // Fill list box so it can determine a reasonable startup geometry - that
    // doesn't work if it happens only later.

    setup();

    // Now that _listBox will (hopefully) have determined a reasonable
    // default geometry, add the widgets to the layout.

    layout->addWidget( _listBox, 0 );
    layout->addWidget( _props  , 1 );
    layout->activate();
}
Beispiel #11
0
ChooseFileRadioButton::ChooseFileRadioButton( QWidget * parent, const char * name )
	:QRadioButton( parent, name )
{
	QHBoxLayout * layout = new QHBoxLayout( this );
	layout->addSpacing( 20 );
	
	_edit = new QLineEdit( this );
	layout->addWidget( _edit, 1 );
	layout->addSpacing( 10 );
	
	_choose = new QPushButton( this );
	_choose->setText( "Choose" );
	FIXEDSIZE( _choose );
	layout->addWidget( _choose );
	
	layout->activate();
	
	connect( _choose, SIGNAL( clicked() ), SLOT( slot_choose() ) );
	connect( this, SIGNAL( toggled( bool ) ), SLOT( slot_toggle( bool ) ) );
	setFixedHeight( _choose->size().height() + 4 );
}
Beispiel #12
0
//
// -- PresentationWidget --
//
PresentationWidget::PresentationWidget( QWidget * parent, const char * name )
	:QWidget( parent, name )
{
	_photoLeft = new Icon( this );
	_photoRight = new Icon( this );

	_titleLeft = new QLabel( this );
	_titleLeft->setAlignment( AlignCenter );

	_titleRight = new QLabel( this );
	_titleRight->setAlignment( AlignCenter );

	QHBoxLayout * layout = new QHBoxLayout( this );
	layout->setSpacing( 5 );
	layout->addWidget( _photoLeft );
	layout->addWidget( _titleLeft );
	layout->addStretch( 1 );
	layout->addWidget( _titleRight );
	layout->addWidget( _photoRight );
	layout->activate();
}
Beispiel #13
0
DisplayBothUnits::DisplayBothUnits( QWidget * parent, const char * name )
	:QWidget( parent, name )
{
	_currentSide = -1;
	_currentNum = -1;
	_exchange = false;
	_lordLeft = 0;
	_lordRight = 0;
	_socket = 0;

	QSignalMapper * sigmapLeft = new QSignalMapper( this );
	QSignalMapper * sigmapRight = new QSignalMapper( this );

	QVBoxLayout * layV1 = new QVBoxLayout();
	QVBoxLayout * layV2 = new QVBoxLayout();
	layV1->addStretch( 1 );
	layV2->addStretch( 1 );
	for( int i = 0; i < MAX_UNIT; i++ ) {
		_unitLeft[i] = new PresentUnit( this );
		layV1->addWidget( _unitLeft[i] );
		layV1->addStretch( 1 );
		sigmapLeft->setMapping( _unitLeft[i], i );
		connect( _unitLeft[i], SIGNAL( sig_clicked() ), sigmapLeft, SLOT( map() ) );

		_unitRight[i] = new PresentUnit( this );
		layV2->addWidget( _unitRight[i] );
		layV2->addStretch( 1 );
		sigmapRight->setMapping( _unitRight[i], i );
		connect( _unitRight[i], SIGNAL( sig_clicked() ), sigmapRight, SLOT( map() ) );
	}

	QHBoxLayout * layout = new QHBoxLayout( this );
	layout->setSpacing( 5 );
	layout->addLayout( layV1, 1 );
	layout->addLayout( layV2, 1 );
	layout->activate();

	connect( sigmapLeft, SIGNAL( mapped( int ) ), SLOT( slot_unitLeft( int ) ) );
	connect( sigmapRight, SIGNAL( mapped( int ) ), SLOT( slot_unitRight( int ) ) );
}
Beispiel #14
0
ScriptEdit::ScriptEdit( QWidget *parent )
  : QWidget(parent)
{
  QHBoxLayout *tl = new QHBoxLayout(this);
  tl->setSpacing(10);
  tl->setMargin(0);

  st = new QComboBox(this);
  st->setObjectName("st");
  st->addItem("Expect");
  st->addItem("Send");
  st->addItem("Pause (sec)");
  st->addItem("Hangup");
  st->addItem("Answer");
  st->addItem("Timeout (sec)");
  st->addItem("Password");
  st->addItem("ID");
  st->addItem("Prompt");
  st->addItem("PWPrompt");
  st->addItem("LoopStart");
  st->addItem("LoopEnd");
  st->addItem("Scan");
  st->addItem("Save");
  st->addItem("SendNoEcho");
  connect(st, SIGNAL(activated(int)), SLOT(setType(int)));

  se = new QLineEdit(this);
  se->setObjectName("se"); // oh yes, signor :-)
  se->setGeometry(120, 5, 140, 25);
  se->setMaxLength(50);
  connect(se, SIGNAL(returnPressed()), SLOT(seReturnPressed()));

  tl->addWidget(st, 3);
  tl->addWidget(se, 7);

  setType(0);

  tl->activate();
}
LabeledEntry::LabeledEntry(QWidget *parent, const QString& ltext)
   : QFrame(parent)
{
    QHBoxLayout *hb = new QHBoxLayout(this);
    hb->setSpacing(2);
    hb->setMargin(0);
    label = new QLabel(ltext, this);
    entry = new QLineEdit(this);
    reset = new QPushButton(this);
    reset->setText("Reset");
    set = new QPushButton(this);
    set->setText("Set");

    hb->addWidget(label);
    hb->addWidget(entry);
    hb->addWidget(reset);
    hb->addWidget(set);
    hb->activate();

    connect(reset, SIGNAL(clicked(void)), this, SLOT(resetClicked(void)));
    connect(set, SIGNAL(clicked(void)), this, SLOT(setClicked(void)));
}
Beispiel #16
0
InputInt::InputInt( const QString & label, QWidget *parent, int &val, int minVal,int maxVal )
  : QWidget( parent), m_val(val), m_minVal(minVal), m_maxVal(maxVal)
{
  QHBoxLayout *layout = new QHBoxLayout( this, 5 );

  lab = new QLabel( label, this );
  lab->setMinimumSize( lab->sizeHint() );

  sp = new QSpinBox( minVal,maxVal,1,this );
  sp->setMinimumSize( sp->sizeHint() );

  init();
  
  layout->addWidget( lab );
  layout->addWidget( sp );
  layout->addStretch(1);
  layout->activate();
  setMinimumSize( sizeHint() );

  connect(sp,   SIGNAL(valueChanged(int)), 
          this, SLOT(valueChanged(int)) );

}
Beispiel #17
0
/**
 * This will construct a modal dialog.
 *
 * The default timer length is 10.
 *
 * @param parent The parent of the widget
 * @param msg The name of the object
 * @param dispIcon Display Icon?
 */
OWait::OWait( QWidget *parent, const char* msg, bool dispIcon )
      :QDialog( parent, msg, TRUE, WStyle_Customize )
{

    Q_UNUSED( dispIcon )

    QHBoxLayout * hbox = new QHBoxLayout( this );

    m_lb = new QLabel( this );
    m_lb->setBackgroundMode ( NoBackground );

    hbox->addWidget( m_lb );
    hbox->activate();

    m_pix = Opie::Core::OResource::loadPixmap( "BigBusy" );
    m_aniSize = m_pix.height();
    resize( m_aniSize, m_aniSize );

    m_timerLength = 10;

    m_waitTimer = new QTimer( this );
    connect( m_waitTimer, SIGNAL( timeout() ), this, SLOT( hide() ) );
}
Beispiel #18
0
/** add comments here */
GameControl::GameControl( QWidget * parent, const char * name )
	: QWidget( parent, name )
{
	QHBoxLayout * lay = new QHBoxLayout( this );
	
	_cen = new CentralControl( this );
	_scrL = new ScrollLord( this );
	_scrB = new ScrollBase( this );
	lay->addWidget( _scrL );
	lay->addStretch( 1 );
	lay->addWidget( _cen );
	lay->addStretch( 1 );	
	lay->addWidget( _scrB );
	lay->activate();
	
	setFixedSize( 200, 210 );
	
	connect( _cen, SIGNAL( sig_endTurn() ), SIGNAL( sig_endTurn() ) );
	connect( _scrL, SIGNAL( sig_lord() ), SIGNAL( sig_lord() ) );
	connect( _scrL, SIGNAL( sig_lordSelected() ), SLOT( slot_lordSelected() ) );
	connect( _scrB, SIGNAL( sig_base() ), SIGNAL( sig_base() ) );
	connect( _scrB, SIGNAL( sig_baseSelected() ), SLOT( slot_baseSelected() ) );
}
Beispiel #19
0
GLObjectWindow::GLObjectWindow( QWidget* parent, const char* name )
    : QWidget( parent, name )
{
    // Create top-level layout manager
    QHBoxLayout* hlayout = new QHBoxLayout( this, 20, 20, "hlayout");

    // Create a menu
    QPopupMenu *file = new QPopupMenu();
    file->insertItem( "Delete Left QGLWidget", this, 
		      SLOT(deleteFirstWidget()) );
    file->insertItem( "Exit",  qApp, SLOT(quit()), CTRL+Key_Q );

    // Create a menu bar
    QMenuBar *m = new QMenuBar( this );
    m->setSeparator( QMenuBar::InWindowsStyle );
    m->insertItem("&File", file );
    hlayout->setMenuBar( m );

    // Create a layout manager for the sliders
    QVBoxLayout* vlayout = new QVBoxLayout( 20, "vlayout");
    hlayout->addLayout( vlayout );

    // Create a nice frame to put around the openGL widget
    QFrame* f = new QFrame( this, "frame" );
    f->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f->setLineWidth( 2 );
    hlayout->addWidget( f, 1 );

    // Create a layout manager for the openGL widget
    QHBoxLayout* flayout = new QHBoxLayout( f, 2, 2, "flayout");


    // Create an openGL widget
    c1 = new GLBox( f, "glbox1");
    c1->setMinimumSize( 50, 50 );
    flayout->addWidget( c1, 1 );
    flayout->activate();


    // Create a nice frame to put around the second openGL widget
    QFrame* f2 = new QFrame( this, "frame2" );
    f2->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f2->setLineWidth( 2 );
    hlayout->addWidget( f2, 1 );

    // Create a layout manager for the second openGL widget
    QHBoxLayout* flayout2 = new QHBoxLayout( f2, 2, 2, "flayout2");

    // Create another openGL widget which shares display lists with the first
    c2 = new GLBox( f2, "glbox2", c1 );
    c2->setMinimumSize( 50, 50 );
    flayout2->addWidget( c2, 1 );
    flayout2->activate();

    // Create the three sliders; one for each rotation axis
    QSlider* x = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "xsl" );
    x->setTickmarks( QSlider::Left );
    x->setMinimumSize( x->sizeHint() );
    vlayout->addWidget( x );
    QObject::connect( x, SIGNAL(valueChanged(int)),c1,SLOT(setXRotation(int)));
    QObject::connect( x, SIGNAL(valueChanged(int)),c2,SLOT(setZRotation(int)));

    QSlider* y = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "ysl" );
    y->setTickmarks( QSlider::Left );
    y->setMinimumSize( y->sizeHint() );
    vlayout->addWidget( y );
    QObject::connect( y, SIGNAL(valueChanged(int)),c1,SLOT(setYRotation(int)));
    QObject::connect( y, SIGNAL(valueChanged(int)),c2,SLOT(setXRotation(int)));

    QSlider* z = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "zsl" );
    z->setTickmarks( QSlider::Left );
    z->setMinimumSize( z->sizeHint() );
    vlayout->addWidget( z );
    QObject::connect( z, SIGNAL(valueChanged(int)),c1,SLOT(setZRotation(int)));
    QObject::connect( z, SIGNAL(valueChanged(int)),c2,SLOT(setYRotation(int)));

    // Start the geometry management
    hlayout->activate();
}
TxqPlot3DWindow::TxqPlot3DWindow( char *thisLabel, WindowType myWindow )
    : QWidget( )
{

    // set thisWindow so that all class members may access
    thisWindow = myWindow;

    // Set the title
    setPalette( QPalette( Qt::lightGray ) );
    setCaption(thisLabel);
    setIconText(thisLabel);

    // Create top-level layout manager
    QHBoxLayout* hlayout = new QHBoxLayout( this, 20, 20, "hlayout");

    // Create a popup menu containing Close
    QPopupMenu *file = new QPopupMenu();
    file->setPalette( QPalette( Qt::lightGray ) );
    file->insertItem( "Close",  this, SLOT( close() ), CTRL+Key_Q );

    // Create a menu bar
    QMenuBar *m = new QMenuBar( this );
    m->setSeparator( QMenuBar::InWindowsStyle );
    m->insertItem("&File", file );
    hlayout->setMenuBar( m );

    // Create a layout manager for the sliders
    QVBoxLayout* vlayout = new QVBoxLayout( 20, "vlayout");
    hlayout->addLayout( vlayout );

    // Create a nice frame tp put around the openGL widget
    QFrame* f = new QFrame( this, "frame" );
    f->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f->setLineWidth( 2 );
    hlayout->addWidget( f, 1 );

    // Create a layout manager for the openGL widget
    QHBoxLayout* flayout = new QHBoxLayout( f, 2, 2, "flayout");

    // Create an openGL widget
    plot3D = new GLPlot3D( f, "glbox");
    plot3D->setData(thisLabel, myWindow);
    plot3D->setMinimumSize( 50, 50 );
    flayout->addWidget( plot3D, 1 );
    flayout->activate();

    // Create the three sliders; one for each rotation axis
    QSlider* x = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "xsl" );
    x->setTickmarks( QSlider::Left );
    x->setMinimumSize( x->sizeHint() );
    vlayout->addWidget( x );
    QObject::connect( x, SIGNAL(valueChanged(int)),plot3D,SLOT(setXRotation(int)) );

    QSlider* y = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "ysl" );
    y->setTickmarks( QSlider::Left );
    y->setMinimumSize( y->sizeHint() );
    vlayout->addWidget( y );
    QObject::connect( y, SIGNAL(valueChanged(int)),plot3D,SLOT(setYRotation(int)) );

    QSlider* z = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "zsl" );
    z->setTickmarks( QSlider::Left );
    z->setMinimumSize( z->sizeHint() );
    vlayout->addWidget( z );
    QObject::connect( z, SIGNAL(valueChanged(int)),plot3D,SLOT(setZRotation(int)) );

    // create the slider for the eye translation
    QSlider* t = new QSlider ( -15, -5, 1, -15, QSlider::Vertical, this, "tsl" );
    t->setTickmarks( QSlider::Left );
    t->setMinimumSize( x->sizeHint() );
    vlayout->addWidget( t );
    QObject::connect( t, SIGNAL(valueChanged(int)),plot3D,SLOT(setTranslation(int)) );

    // Start the geometry management
    hlayout->activate();
}
Beispiel #21
0
MessageListWidget::MessageListWidget(QWidget *parent) :
    QWidget(parent), m_supportsFuzzySearch(false)
{
    tree = new MsgListView(this);

    m_quickSearchText = new LineEdit(this);
#if QT_VERSION >= 0x040700
    m_quickSearchText->setPlaceholderText(tr("Quick Search / Leading \":=\" for direct IMAP search"));
#endif
    m_queryPlaceholder = tr("<query>");

    connect(m_quickSearchText, SIGNAL(returnPressed()), this, SLOT(slotApplySearch()));
    connect(m_quickSearchText, SIGNAL(textChanged(QString)), this, SLOT(slotConditionalSearchReset()));
    connect(m_quickSearchText, SIGNAL(cursorPositionChanged(int, int)), this, SLOT(slotUpdateSearchCursor()));

    m_searchOptions = new QToolButton(this);
    m_searchOptions->setAutoRaise(true);
    m_searchOptions->setPopupMode(QToolButton::InstantPopup);
    m_searchOptions->setText("*");
    m_searchOptions->setIcon(loadIcon(QLatin1String("imap-search-details")));
    QMenu *optionsMenu = new QMenu(m_searchOptions);
    m_searchFuzzy = optionsMenu->addAction(tr("Fuzzy Search"));
    m_searchFuzzy->setCheckable(true);
    optionsMenu->addSeparator();
    m_searchInSubject = optionsMenu->addAction(tr("Subject"));
    m_searchInSubject->setCheckable(true);
    m_searchInSubject->setChecked(true);
    m_searchInBody = optionsMenu->addAction(tr("Body"));
    m_searchInBody->setCheckable(true);
    m_searchInSenders = optionsMenu->addAction(tr("Senders"));
    m_searchInSenders->setCheckable(true);
    m_searchInSenders->setChecked(true);
    m_searchInRecipients = optionsMenu->addAction(tr("Recipients"));
    m_searchInRecipients->setCheckable(true);

    optionsMenu->addSeparator();

    QMenu *complexMenu = new QMenu(tr("Complex IMAP query"), optionsMenu);
    connect(complexMenu, SIGNAL(triggered(QAction*)), this, SLOT(slotComplexSearchInput(QAction*)));
    complexMenu->addAction(tr("Not ..."))->setData("NOT " + m_queryPlaceholder);
    complexMenu->addAction(tr("Either... or..."))->setData("OR " + m_queryPlaceholder + " " + m_queryPlaceholder);
    complexMenu->addSeparator();
    complexMenu->addAction(tr("From sender"))->setData("FROM " + m_queryPlaceholder);
    complexMenu->addAction(tr("To receiver"))->setData("TO " + m_queryPlaceholder);
    complexMenu->addSeparator();
    complexMenu->addAction(tr("About subject"))->setData("SUBJECT " + m_queryPlaceholder);
    complexMenu->addAction(tr("Message contains ..."))->setData("BODY " + m_queryPlaceholder);
    complexMenu->addSeparator();
    complexMenu->addAction(tr("Before date"))->setData("BEFORE <d-mmm-yyyy>");
    complexMenu->addAction(tr("Since date"))->setData("SINCE <d-mmm-yyyy>");
    complexMenu->addSeparator();
    complexMenu->addAction(tr("Has been seen"))->setData("SEEN");

    optionsMenu->addMenu(complexMenu);

    m_searchOptions->setMenu(optionsMenu);
    connect (optionsMenu, SIGNAL(aboutToShow()), SLOT(slotDeActivateSimpleSearch()));

    delete m_quickSearchText->layout();
    QHBoxLayout *hlayout = new QHBoxLayout(m_quickSearchText);
    hlayout->setContentsMargins(0, 0, 0, 0);
    hlayout->addWidget(m_searchOptions);
    hlayout->addStretch();
    hlayout->addWidget(m_quickSearchText->clearButton());
    hlayout->activate(); // this processes the layout and ensures the toolbutton has it's final dimensions
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
    if (QGuiApplication::isLeftToRight())
#else
    if (qApp->keyboardInputDirection() == Qt::LeftToRight)
#endif
        m_quickSearchText->setTextMargins(m_searchOptions->width(), 0, 0, 0);
    else // ppl. in N Africa and the middle east write the wrong direction...
        m_quickSearchText->setTextMargins(0, 0, m_searchOptions->width(), 0);
    m_searchOptions->setCursor(Qt::ArrowCursor); // inherits I-Beam from lineedit otherwise

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->setSpacing(0);
    layout->addWidget(m_quickSearchText);
    layout->addWidget(tree);

    m_searchResetTimer = new QTimer(this);
    m_searchResetTimer->setSingleShot(true);
    connect(m_searchResetTimer, SIGNAL(timeout()), SLOT(slotApplySearch()));

    slotAutoEnableDisableSearch();
}
Beispiel #22
0
VW::VW( QWidget * parent, const char * name )
    : QWidget( parent, name )
{
    QHBoxLayout * hb;

    hb = new QHBoxLayout( this, 10 );

    QGroupBox * box;
    box = new QGroupBox( this, "input box" );
    hb->addWidget( box, 0, AlignTop );

    QVBoxLayout * b;

    // set up the input box
    b = new QVBoxLayout( box, 12 );

    QLabel * l = new QLabel( "Enter Vehicle Details", box, "header" );
    l->setMinimumSize( l->sizeHint() );
    b->addWidget( l );
    QFrame * f = new QFrame( box, "horizontal divider" );
    f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
    f->setMinimumHeight( 12 );
    b->addWidget( f );

    QGridLayout *grid = new QGridLayout( 3, 2 );
    b->addLayout( grid );

    // here we start on the input grid, with labels and other widget
    // neatly arranged. the variable names are reused all over the
    // place.

    QComboBox * model = new QComboBox( FALSE, box, "model selection" );
    model->insertItem( "Type 1 Beetle" );
    model->insertItem( "Camper" );
    model->insertItem( "Van" );
    model->insertItem( "Fastback" );
    model->insertItem( "Squareback" );
    model->insertItem( "Notchback" );
    model->insertItem( "411" );
    model->setCurrentItem( model->count() - 1 ); // I like the 411
    currentModel = "411";
    model->insertItem( "412" );
    model->insertItem( "Karmann Ghia" );
    model->insertItem( "Thing" );
    model->insertItem( "Safari" );
    model->insertItem( "Kubelwagen" );
    model->insertItem( "Trekker" );
    model->insertItem( "Baja" );
    model->setMinimumSize( model->sizeHint() );
    model->setMaximumHeight( model->minimumSize().height() );
    grid->addWidget( model, 0, 1 );

    l = new QLabel( model, "Model:", box, "model label" );
    l->setMinimumSize( l->sizeHint() );
    grid->addWidget( l, 0, 0 );

    QSpinBox * motor = new QSpinBox( 1000, 1600, 100, 
				     box, "motor size selection" );
    motor->setValue( 1000 );
    currentMotorSize = 1000;
    motor->setMinimumSize( motor->sizeHint() );
    motor->setMaximumHeight( motor->minimumSize().height() );
    grid->addWidget( motor, 1, 1 );

    l = new QLabel( motor, "Motor size (cc):", box, "motor size label" );
    l->setMinimumSize( l->sizeHint() );
    grid->addWidget( l, 1, 0 );

    QSpinBox * year = new QSpinBox( box, "model year" );
    year->setRange( 1949, 1981 );
    year->setValue( 1949 );
    currentYear = 1949;
    year->setMinimumSize( year->sizeHint() );
    year->setMaximumHeight( year->minimumSize().height() );
    grid->addWidget( year, 2, 1 );

    l = new QLabel( year, "Model:", box, "model year label" );
    l->setMinimumSize( l->sizeHint() );
    grid->addWidget( l, 2, 0 );

    b->addStretch( 1 );

    b->activate();

    // output box

    box = new QGroupBox( this, "output box" );
    hb->addWidget( box, 0, AlignTop );

    b = new QVBoxLayout( box, 12 );

    l = new QLabel( "Resulting Limousine:", box, "header" );
    l->setMinimumSize( l->sizeHint() );
    b->addWidget( l );

    f = new QFrame( box, "horizontal divider" );
    f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
    f->setMinimumHeight( 12 );
    b->addWidget( f );

    l = new QLabel( box, "output label" );
    l->setAlignment( AlignTop | AlignLeft | WordBreak );
    l->setText( "No VW selected yet." );
    b->addWidget( l, 1 );

    b->addStretch( 1 );

    b->activate();
    hb->activate();

    // set up connections
    connect( model, SIGNAL(activated(const char *)),
	     this, SLOT(modelSelected(const char *)) );
    connect( motor, SIGNAL(valueChanged(int)),
	     this, SLOT(motorSelected(int)) );
    connect( year, SIGNAL(valueChanged(int)),
	     this, SLOT(yearSelected(int)) );

    connect( this, SIGNAL(validSelectionMade(const char *)),
	     l, SLOT(setText(const char *)) );
}
MessageListWidget::MessageListWidget(QWidget *parent) :
    QWidget(parent), m_supportsFuzzySearch(false)
{
    tree = new MsgListView(this);

    m_quickSearchText = new LineEdit(this);
    m_quickSearchText->setHistoryEnabled(true);
    // Filter out newline. It will wreak havoc into the direct IMAP passthrough and could lead to data loss.
    QValidator *validator = new ReplaceCharValidator(QLatin1Char('\n'), QLatin1Char(' '), m_quickSearchText);
    m_quickSearchText->setValidator(validator);
#if QT_VERSION >= 0x040700
    m_quickSearchText->setPlaceholderText(tr("Quick Search"));
#endif
    m_quickSearchText->setToolTip(tr("Type in a text to search for within this mailbox. "
                                     "The icon on the left can be used to limit the search options "
                                     "(like whether to include addresses or message bodies, etc)."
                                     "<br/><hr/>"
                                     "Experts who have read RFC3501 can use the <code>:=</code> prefix and switch to a raw IMAP mode."));
    m_queryPlaceholder = tr("<query>");

    connect(m_quickSearchText, SIGNAL(returnPressed()), this, SLOT(slotApplySearch()));
    connect(m_quickSearchText, SIGNAL(textChanged(QString)), this, SLOT(slotConditionalSearchReset()));
    connect(m_quickSearchText, SIGNAL(cursorPositionChanged(int, int)), this, SLOT(slotUpdateSearchCursor()));

    m_searchOptions = new QToolButton(this);
    m_searchOptions->setAutoRaise(true);
    m_searchOptions->setPopupMode(QToolButton::InstantPopup);
    m_searchOptions->setText(QLatin1String("*"));
    m_searchOptions->setIcon(UiUtils::loadIcon(QLatin1String("imap-search-details")));
    QMenu *optionsMenu = new QMenu(m_searchOptions);
    m_searchFuzzy = optionsMenu->addAction(tr("Fuzzy Search"));
    m_searchFuzzy->setCheckable(true);
    optionsMenu->addSeparator();
    m_searchInSubject = optionsMenu->addAction(tr("Subject"));
    m_searchInSubject->setCheckable(true);
    m_searchInSubject->setChecked(true);
    m_searchInBody = optionsMenu->addAction(tr("Body"));
    m_searchInBody->setCheckable(true);
    m_searchInSenders = optionsMenu->addAction(tr("Senders"));
    m_searchInSenders->setCheckable(true);
    m_searchInSenders->setChecked(true);
    m_searchInRecipients = optionsMenu->addAction(tr("Recipients"));
    m_searchInRecipients->setCheckable(true);

    optionsMenu->addSeparator();

    QMenu *complexMenu = new QMenu(tr("Complex IMAP query"), optionsMenu);
    connect(complexMenu, SIGNAL(triggered(QAction*)), this, SLOT(slotComplexSearchInput(QAction*)));
    complexMenu->addAction(tr("Not ..."))->setData(QLatin1String("NOT ") + m_queryPlaceholder);
    complexMenu->addAction(tr("Either... or..."))->setData(QLatin1String("OR ") + m_queryPlaceholder + QLatin1Char(' ') + m_queryPlaceholder);
    complexMenu->addSeparator();
    complexMenu->addAction(tr("From sender"))->setData(QLatin1String("FROM ") + m_queryPlaceholder);
    complexMenu->addAction(tr("To receiver"))->setData(QLatin1String("TO ") + m_queryPlaceholder);
    complexMenu->addSeparator();
    complexMenu->addAction(tr("About subject"))->setData(QLatin1String("SUBJECT " )+ m_queryPlaceholder);
    complexMenu->addAction(tr("Message contains ..."))->setData(QLatin1String("BODY ") + m_queryPlaceholder);
    complexMenu->addSeparator();
    complexMenu->addAction(tr("Before date"))->setData(QLatin1String("BEFORE <d-mmm-yyyy>"));
    complexMenu->addAction(tr("Since date"))->setData(QLatin1String("SINCE <d-mmm-yyyy>"));
    complexMenu->addSeparator();
    complexMenu->addAction(tr("Has been seen"))->setData(QLatin1String("SEEN"));

    m_rawSearch = optionsMenu->addAction(tr("Allow raw IMAP search"));
    m_rawSearch->setCheckable(true);
    QAction *rawSearchMenu = optionsMenu->addMenu(complexMenu);
    rawSearchMenu->setVisible(false);
    connect (m_rawSearch, SIGNAL(toggled(bool)), rawSearchMenu, SLOT(setVisible(bool)));
    connect (m_rawSearch, SIGNAL(toggled(bool)), SIGNAL(rawSearchSettingChanged(bool)));

    m_searchOptions->setMenu(optionsMenu);
    connect (optionsMenu, SIGNAL(aboutToShow()), SLOT(slotDeActivateSimpleSearch()));

    delete m_quickSearchText->layout();
    QHBoxLayout *hlayout = new QHBoxLayout(m_quickSearchText);
    hlayout->setContentsMargins(0, 0, 0, 0);
    hlayout->addWidget(m_searchOptions);
    hlayout->addStretch();
    hlayout->addWidget(m_quickSearchText->clearButton());
    hlayout->activate(); // this processes the layout and ensures the toolbutton has it's final dimensions
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
    if (QGuiApplication::isLeftToRight())
#else
    if (qApp->keyboardInputDirection() == Qt::LeftToRight)
#endif
        m_quickSearchText->setTextMargins(m_searchOptions->width(), 0, 0, 0);
    else // ppl. in N Africa and the middle east write the wrong direction...
        m_quickSearchText->setTextMargins(0, 0, m_searchOptions->width(), 0);
    m_searchOptions->setCursor(Qt::ArrowCursor); // inherits I-Beam from lineedit otherwise

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->setSpacing(0);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->addWidget(m_quickSearchText);
    layout->addWidget(tree);

    m_searchResetTimer = new QTimer(this);
    m_searchResetTimer->setSingleShot(true);
    connect(m_searchResetTimer, SIGNAL(timeout()), SLOT(slotApplySearch()));

    slotAutoEnableDisableSearch();
}