void AdminUsers::addButtonClicked()
{
#if DEBUG_ADMINUSERS
	qDebug("init addButtonClicked");
#endif
	QScrollView *scroll = new QScrollView(this, 0, Qt::WDestructiveClose);
	scroll->setResizePolicy(QScrollView::AutoOneFit);
	scroll->setMargin(10);
	
	FormAdminUsers *formAdminUsers = new FormAdminUsers(FormBase::Add, scroll->viewport() );
	connect(formAdminUsers, SIGNAL(message2osd(const QString& )) , this, SIGNAL(message2osd(const QString& )));

	formAdminUsers->setType( FormBase::Add);
	connect(formAdminUsers, SIGNAL(cancelled()), scroll, SLOT(close()));
	connect(formAdminUsers, SIGNAL(inserted(const QString& )), this, SLOT(addItem( const QString& )));

	scroll->addChild(formAdminUsers);
	formAdminUsers->setupButtons( FormBase::AcceptButton, FormBase::CancelButton );

	formAdminUsers->setTitle(i18n("Admin User"));
	formAdminUsers->setExplanation(i18n("Fill the fields with the user information"));
	
	emit sendWidget(scroll,i18n("Add user")); 
#if DEBUG_ADMINUSERS
	qDebug("end addButtonClicked");
#endif
}
KListDebugDialog::KListDebugDialog(QStringList areaList, QWidget *parent, const char *name, bool modal)
    : KAbstractDebugDialog(parent, name, modal), m_areaList(areaList)
{
    setCaption(i18n("Debug Settings"));

    QVBoxLayout *lay = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint());

    m_incrSearch = new KLineEdit(this);
    lay->addWidget(m_incrSearch);
    connect(m_incrSearch, SIGNAL(textChanged(const QString &)), SLOT(generateCheckBoxes(const QString &)));

    QScrollView *scrollView = new QScrollView(this);
    scrollView->setResizePolicy(QScrollView::AutoOneFit);
    lay->addWidget(scrollView);

    m_box = new QVBox(scrollView->viewport());
    scrollView->addChild(m_box);

    generateCheckBoxes(QString::null);

    QHBoxLayout *selectButs = new QHBoxLayout(lay);
    QPushButton *all = new QPushButton(i18n("&Select All"), this);
    QPushButton *none = new QPushButton(i18n("&Deselect All"), this);
    selectButs->addWidget(all);
    selectButs->addWidget(none);

    connect(all, SIGNAL(clicked()), this, SLOT(selectAll()));
    connect(none, SIGNAL(clicked()), this, SLOT(deSelectAll()));

    buildButtons(lay);
    resize(350, 400);
}
ParameterDialog::ParameterDialog(Miro::CFG::Type const& _parameterType,
				 QDomNode const& _parentNode, 
				 QDomNode const& _node,
				 ItemXML * _parentItem,
				 ItemXML * _item,
				 QWidget * _parent, const char * _name) :
  Super(_parentNode, _node, _parentItem, _item, _parent, _name),
  config_(ConfigFile::instance()),
  parameterType_(_parameterType),
  params_(config_->description().getFullParameterSet(parameterType_))
{
  MIRO_ASSERT(!_node.isNull());

  initDialog();

  QSize s = frame_->sizeHint();

  if (s.width() > 800 || 
      s.height() > 600) {

    delete frame_;
    QScrollView * sv = new QScrollView(groupBox_, "scrollview");
    frame_ = new QFrame(sv->viewport());
    sv->addChild(frame_);
    sv->setResizePolicy(QScrollView::AutoOneFit);
    
    initDialog();

    frame_->sizeHint();
  }

  groupBox_->sizeHint(); // we seem to need this to get the right size (hutz)
  groupBox_->setTitle("Parameters");
}
// FIXME: This should not be necessary.  Remove this once WebKit knows to properly schedule
// layouts using WebCore when objects resize.
void RenderPart::updateWidgetPositions()
{
    if (!m_widget)
        return;
#if KWIQ
    return;
#endif
    
    int x, y, width, height;
    absolutePosition(x,y);
    x += borderLeft() + paddingLeft();
    y += borderTop() + paddingTop();
    width = m_width - borderLeft() - borderRight() - paddingLeft() - paddingRight();
    height = m_height - borderTop() - borderBottom() - paddingTop() - paddingBottom();
    QRect newBounds(x,y,width,height);
    if (newBounds != m_widget->frameGeometry()) {
        // The widget changed positions.  Update the frame geometry.
        RenderArena *arena = ref();
        element()->ref();
        m_widget->setFrameGeometry(newBounds);
        element()->deref();
        deref(arena);
        
        QScrollView *view = static_cast<QScrollView *>(m_widget);
        if (view && view->inherits("KHTMLView"))
            static_cast<KHTMLView*>(view)->layout();
    }
}
Example #5
0
bool DateEntryEditor::showDialog( QString caption, OPimEvent& event ) {
    QDialog newDlg( m_parent, 0, TRUE );
    newDlg.setCaption( caption );
    QVBoxLayout *vb = new QVBoxLayout( &newDlg );
    QScrollView *sv = new QScrollView( &newDlg );
    sv->setResizePolicy( QScrollView::AutoOneFit );
    sv->setFrameStyle( QFrame::NoFrame );
    sv->setHScrollBarMode( QScrollView::AlwaysOff );
    vb->addWidget( sv );

    DateEntry *de = new DateEntry( weekStartOnMonday(), isAP(), &newDlg );

    de->comboLocation->clear();
    de->comboLocation->insertItem("");
    de->comboLocation->insertStringList( locations().names() );

    de->comboDescription->clear();
    de->comboDescription->insertItem("");
    de->comboDescription->insertStringList( descriptions().names() );

    de->setEvent( event );

    sv->addChild( de );
    while ( QPEApplication::execDialog( &newDlg ) ) {
        de->getEvent( event );
        QString error = checkEvent( event );
        if ( !error.isNull() ) {
            if ( QMessageBox::warning( m_parent, QObject::tr("Error!"), error, QObject::tr("Fix it"), QObject::tr("Continue"), 0, 0, 1 ) == 0 )
                continue;
        }
        return true;
    }
    return false;
}
void AdminUsers::modifyButtonClicked()
{
#if DEBUG_ADMINUSERS
	qDebug("init modifyButtonClicked");
#endif
	QScrollView *scroll = new QScrollView(this, 0, Qt::WDestructiveClose);
	scroll->setResizePolicy(QScrollView::AutoOneFit);
	scroll->setMargin(10);
	
	FormAdminUsers *formAdminUsers = new FormAdminUsers(FormBase::Edit, scroll->viewport() );
	
	connect(formAdminUsers, SIGNAL(message2osd(const QString& )) , this, SIGNAL(message2osd(const QString& )));

	KLSelect sqlquery(QStringList() << "ldt_users.docident" << "login" << "firstname" << "lastname" << "genre" << "address" << "phone" << "email" << "permissions", QStringList() << "ldt_users" << "ldt_persons" );
	
	sqlquery.setWhere("ldt_persons.docIdent=ldt_users.docIdent and login="******"No se puede analizar" << std::endl;
		return;
	}
	
	KLSqlResults results = m_xmlreader.results();
	
	std::cout << results["login"] << std::endl;

	formAdminUsers->setAddress( results["address"] );
	formAdminUsers->setEmail(results["email"]);
	formAdminUsers->setFirstName( results["firstname"]);
	formAdminUsers->setIdentification( results["ldt_users.docident"]);
	formAdminUsers->setLastName( results["lastname"]);
	formAdminUsers->setLogin( results["login"]);
	formAdminUsers->setPermissions( results["permissions"]);
	formAdminUsers->setPhone( results["phone"]);
	formAdminUsers->setGenre( results["genre"]);
	
	formAdminUsers->setType( FormBase::Edit );
	connect(formAdminUsers, SIGNAL(cancelled()), scroll, SLOT(close()));
	connect(formAdminUsers, SIGNAL(inserted(const QString& )), this, SLOT(updateItem(const QString &)));

	scroll->addChild(formAdminUsers);
	formAdminUsers->setupButtons( FormBase::AcceptButton, FormBase::CancelButton );
	formAdminUsers->setTextAcceptButton(i18n("Modify"));
	formAdminUsers->setTextCancelButton(i18n("Close"));
	formAdminUsers->setTitle(i18n("Admin User"));
	formAdminUsers->setExplanation(i18n("Modify the fields with the user information"));
	
	emit sendWidget(scroll,i18n("Modify user"));
#if DEBUG_ADMINUSERS
	qDebug("end addButtonClicked");
#endif
}
Example #7
0
QWidget* KCursorPrivateAutoHideEventFilter::actualWidget() const
{
    QWidget* w = m_widget;

    // Is w a scrollview ? Call setCursor on the viewport in that case.
    QScrollView * sv = dynamic_cast<QScrollView *>( w );
    if ( sv )
        w = sv->viewport();

    return w;
}
Example #8
0
ReportWindow::ReportWindow(ReportGridOptions * rgo, QWidget * parent, const char * name)
  : QMainWindow(parent, name, WDestructiveClose) {
    lastSaveToDb = FALSE;
    dbRecordGrade = -1;
    _modified = FALSE;
    _handler = 0;
    setCaption();
    setIcon(QPixmap(document_xpm));

    qsList = new QuerySourceList();
    pageOptions = new ReportPageOptions();
    gridOptions = rgo;

    rptHead = rptFoot = 0;
    pageHeadFirst = pageHeadOdd = pageHeadEven = pageHeadLast = pageHeadAny = 0;
    pageFootFirst = pageFootOdd = pageFootEven = pageFootLast = pageFootAny = 0;

    // Set default Watermark Properties
    _wmOpacity = 25;
    _wmFont = QFont("Arial");
    _wmUseDefaultFont = true;
    _wmUseStaticText = true;
    _wmText = QString::null;
    _wmColumn = QString::null;
    _wmQuery = QString::null;

    // Set default Background Properties
    _bgEnabled = false;
    _bgStatic = true;
    _bgImage = QString::null;
    _bgQuery = QString::null;
    _bgColumn = QString::null;
    _bgResizeMode = "clip";
    _bgAlign = Qt::AlignLeft | Qt::AlignTop;
    _bgBoundsX = 100;
    _bgBoundsY = 100;
    _bgBoundsWidth = 650;
    _bgBoundsHeight = 900;
    _bgOpacity = 25;

    QScrollView * sv = new QScrollView(this);
    vbox = new QWidget(sv->viewport());
    vboxlayout = new QVBoxLayout(vbox);
    sv->addChild(vbox);
    setCentralWidget(sv);
   
    ReportSectionDetail * rsd = new ReportSectionDetail(this,vbox);
    insertSection(detailSectionCount(), rsd);

    connect(pageOptions, SIGNAL(pageOptionsChanged()), this, SLOT(setModified()));
    connect(qsList, SIGNAL(updated()), this, SLOT(setModified()));
}
void GamesList::addButtonClicked()
{
	cout << "Add button clicked" << std::endl;
	KMdiChildView *view = new KMdiChildView(i18n("Add game"), this );
	
	( new QVBoxLayout( view ) )->setAutoAdd( true );

	QScrollView *scroll = new QScrollView(view);
	scroll->setResizePolicy(QScrollView::AutoOneFit);
	FormAdminGame *formAdminGame = new FormAdminGame( scroll->viewport() );
	scroll->addChild(formAdminGame);
	formAdminGame->setupButtons( FormBase::AcceptButton, FormBase::CancelButton );
	formAdminGame->setTitle(i18n("Admin game"));
	formAdminGame->setExplanation(i18n("fill the fields for add a new game"));
	emit sendWidget(view);
}
Example #10
0
ZLDialogContent &ZLQtOptionsDialog::createTab(const ZLResourceKey &key) {
	QScrollView *sv = new QScrollView(myTabWidget);
	sv->setResizePolicy(QScrollView::AutoOneFit);
	sv->setFrameStyle(QFrame::NoFrame);
	
	ZLQtDialogContent *tab = new ZLQtDialogContent(sv->viewport(), tabResource(key));
	sv->addChild(tab->widget());
	myMenu->insertItem(::qtString(tab->displayName()), -1, myTabs.size());
	myTabWidget->addWidget(sv, myTabs.size());
	myTabs.push_back(tab);

	if(myTabs.size() == 1) {
		raiseTab(0);
	}

	return *tab;
}
Example #11
0
void AddAppletDialog::resizeAppletView()
{
    int w, h;
    QScrollView *v = m_mainWidget->appletScrollView;
    
    if (m_closing)
        return;
    
    for (int i = 0; i < 3; i++)
    {
        m_appletBox->layout()->activate();
        w = v->visibleWidth();
        h = m_appletBox->layout()->minimumSize().height();
        v->resizeContents(w, QMAX(h, v->visibleHeight()));
        if (w == m_appletBox->width() && h == m_appletBox->height())
        break;
        m_appletBox->resize(w, h);
        v->updateScrollBars();
    }
}
Example #12
0
void XineConfig::createPage(const QString& cat, bool expert, QWidget* parent)
{
	xine_cfg_entry_t* ent;

	QScrollView* sv = new QScrollView(parent);
	sv->setResizePolicy(QScrollView::AutoOneFit);
	parent = new QWidget(sv->viewport());
	sv->addChild(parent);

	QGridLayout* grid = new QGridLayout(parent, 20 ,2);
	grid->setColStretch(1,8);
	grid->setSpacing(10);
	grid->setMargin(10);

	uint row = 0;
	QString entCat;

	/*********** read in xine config entries ***********/
	ent = new xine_cfg_entry_t;
	xine_config_get_first_entry(m_xine, ent);

	do
	{
		entCat = QString(ent->key);
		entCat = entCat.left(entCat.find("."));
		if (entCat == cat)
		{
			if (((!expert) && (QString(NON_EXPERT_OPTIONS).contains(ent->key))) ||
			        ((expert) && (!QString(NON_EXPERT_OPTIONS).contains(ent->key))))
			{
				m_entries.append(new XineConfigEntry(parent, grid, row, ent));
				delete ent;
				ent = new xine_cfg_entry_t;
				row += 2;
			}
		}
	}
	while(xine_config_get_next_entry(m_xine, ent));

	delete ent;
}
void RenderFrame::slotViewCleared()
{
    if(element() && m_widget->inherits("QScrollView")) {
#ifdef DEBUG_LAYOUT
        kdDebug(6031) << "frame is a scrollview!" << endl;
#endif
        QScrollView *view = static_cast<QScrollView *>(m_widget);
        if(!element()->frameBorder || !((static_cast<HTMLFrameSetElementImpl *>(element()->parentNode()))->frameBorder()))
            view->setFrameStyle(QFrame::NoFrame);
#if APPLE_CHANGES
        // Qt creates QScrollView w/ a default style of QFrame::StyledPanel | QFrame::Sunken.
        else
            view->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );

#else
        view->setHScrollBarMode(element()->scrolling );
        view->setVScrollBarMode(element()->scrolling );
#endif

        if(view->inherits("KHTMLView")) {
#ifdef DEBUG_LAYOUT
            kdDebug(6031) << "frame is a KHTMLview!" << endl;
#endif
            KHTMLView *htmlView = static_cast<KHTMLView *>(view);
            if(element()->marginWidth != -1) htmlView->setMarginWidth(element()->marginWidth);
            if(element()->marginHeight != -1) htmlView->setMarginHeight(element()->marginHeight);
        }
    }
}
void RenderPartObject::slotViewCleared()
{
  if(element() && m_widget->inherits("QScrollView") ) {
#ifdef DEBUG_LAYOUT
      kdDebug(6031) << "iframe is a scrollview!" << endl;
#endif
      QScrollView *view = static_cast<QScrollView *>(m_widget);
      int frameStyle = QFrame::NoFrame;
      QScrollView::ScrollBarMode scroll = QScrollView::Auto;
      int marginw = -1;
      int marginh = -1;
      if ( element()->id() == ID_IFRAME) {
	  HTMLIFrameElementImpl *frame = static_cast<HTMLIFrameElementImpl *>(element());
	  if(frame->frameBorder)
	      frameStyle = QFrame::Box;
          scroll = frame->scrolling;
	  marginw = frame->marginWidth;
	  marginh = frame->marginHeight;
      }
      view->setFrameStyle(frameStyle);

#if !APPLE_CHANGES
      view->setVScrollBarMode(scroll);
      view->setHScrollBarMode(scroll);
#endif

      if(view->inherits("KHTMLView")) {
#ifdef DEBUG_LAYOUT
          kdDebug(6031) << "frame is a KHTMLview!" << endl;
#endif
          KHTMLView *htmlView = static_cast<KHTMLView *>(view);
          htmlView->setIgnoreWheelEvents( element()->id() == ID_IFRAME );
          if(marginw != -1) htmlView->setMarginWidth(marginw);
          if(marginh != -1) htmlView->setMarginHeight(marginh);
        }
  }
}
Example #15
0
CharacterSelectorView::CharacterSelectorView(KBCatalog* catalog,QWidget *parent, Project::Ptr project)
    : KBCatalogView(catalog,parent,project)
{
    QVBoxLayout* layout = new QVBoxLayout( this );
    layout->setResizeMode( QLayout::Minimum );

    layout->setSpacing( KDialog::spacingHint() );
    
    QHBox* bar = new QHBox(this);
    bar->setSpacing( KDialog::spacingHint() );
    layout->addWidget (bar);
    
    QLabel *lTable = new QLabel( i18n( "Table:" ), bar );
    _tableNum = new QSpinBox( 0, 255, 1, bar );
    lTable->setBuddy( _tableNum );
    bar->setStretchFactor( _tableNum, 1 );
    
    QScrollView* scroll = new QScrollView( this );    
    _table = new KCharSelectTable(scroll,"charselector","helvetica",' ',0);
    _table->setNumCols(16);
    _table->setNumRows(16);
    
    scroll->addChild(_table);
    layout->addWidget (scroll);
    
    connect( _table, SIGNAL( doubleClicked() ), this, SLOT( emitChar() ) );
    connect( _tableNum, SIGNAL( valueChanged(int) ), this, SLOT( setTab(int) ));
    
    connect( _catalog, SIGNAL( signalFileOpened(bool) ), this, SLOT (setDisabled (bool)));
    connect( _catalog, SIGNAL( signalFileOpened(bool) ), _table, SLOT (setDisabled (bool)));

    QWhatsThis::add(this,
       i18n("<qt><p><b>Character Selector</b></p>"
         "<p>This tool allows to insert special characters using "
         "double click.</p></qt>"));
}
Example #16
0
void
MyPluginGUI::createGUI(DefaultGUIModel::variable_t *var, int size)
{

  setMinimumSize(200, 300); // Qt API for setting window size

  //overall GUI layout with a "horizontal box" copied from DefaultGUIModel

  QBoxLayout *layout = new QHBoxLayout(this);

  //additional GUI layouts with "vertical" layouts that will later
  // be added to the overall "layout" above
  QBoxLayout *leftlayout = new QVBoxLayout();
  //QBoxLayout *rightlayout = new QVBoxLayout();

  // this is a "horizontal button group"
  QHButtonGroup *bttnGroup = new QHButtonGroup("Button Panel:", this);

  // we add two pushbuttons to the button group
  QPushButton *aBttn = new QPushButton("Button A", bttnGroup);
  QPushButton *bBttn = new QPushButton("Button B", bttnGroup);

  // clicked() is a Qt signal that is given to pushbuttons. The connect()
  // function links the clicked() event to a function that is defined
  // as a "private slot:" in the header.
  QObject::connect(aBttn, SIGNAL(clicked()), this, SLOT(aBttn_event()));
  QObject::connect(bBttn, SIGNAL(clicked()), this, SLOT(bBttn_event()));

  //these 3 utility buttons are copied from DefaultGUIModel
  QHBox *utilityBox = new QHBox(this);
  pauseButton = new QPushButton("Pause", utilityBox);
  pauseButton->setToggleButton(true);
  QObject::connect(pauseButton, SIGNAL(toggled(bool)), this, SLOT(pause(bool)));
  QPushButton *modifyButton = new QPushButton("Modify", utilityBox);
  QObject::connect(modifyButton, SIGNAL(clicked(void)), this, SLOT(modify(void)));
  QPushButton *unloadButton = new QPushButton("Unload", utilityBox);
  QObject::connect(unloadButton, SIGNAL(clicked(void)), this, SLOT(exit(void)));

  // add custom button group at the top of the layout
  leftlayout->addWidget(bttnGroup);

  // copied from DefaultGUIModel DO NOT EDIT
  // this generates the text boxes and labels
  QScrollView *sv = new QScrollView(this);
  sv->setResizePolicy(QScrollView::AutoOneFit);
  leftlayout->addWidget(sv);

  QWidget *viewport = new QWidget(sv->viewport());
  sv->addChild(viewport);
  QGridLayout *scrollLayout = new QGridLayout(viewport, 1, 2);

  size_t nstate = 0, nparam = 0, nevent = 0, ncomment = 0;
  for (size_t i = 0; i < num_vars; i++)
    {
      if (vars[i].flags & (PARAMETER | STATE | EVENT | COMMENT))
        {
          param_t param;

          param.label = new QLabel(vars[i].name, viewport);
          scrollLayout->addWidget(param.label, parameter.size(), 0);
          param.edit = new DefaultGUILineEdit(viewport);
          scrollLayout->addWidget(param.edit, parameter.size(), 1);

          QToolTip::add(param.label, vars[i].description);
          QToolTip::add(param.edit, vars[i].description);

          if (vars[i].flags & PARAMETER)
            {
              if (vars[i].flags & DOUBLE)
                {
                  param.edit->setValidator(new QDoubleValidator(param.edit));
                  param.type = PARAMETER | DOUBLE;
                }
              else if (vars[i].flags & UINTEGER)
                {
                  QIntValidator *validator = new QIntValidator(param.edit);
                  param.edit->setValidator(validator);
                  validator->setBottom(0);
                  param.type = PARAMETER | UINTEGER;
                }
              else if (vars[i].flags & INTEGER)
                {
                  param.edit->setValidator(new QIntValidator(param.edit));
                  param.type = PARAMETER | INTEGER;
                }
              else
                param.type = PARAMETER;
              param.index = nparam++;
              param.str_value = new QString;
            }
          else if (vars[i].flags & STATE)
            {
              param.edit->setReadOnly(true);
              param.edit->setPaletteForegroundColor(Qt::darkGray);
              param.type = STATE;
              param.index = nstate++;
            }
          else if (vars[i].flags & EVENT)
            {
              param.edit->setReadOnly(true);
              param.type = EVENT;
              param.index = nevent++;
            }
          else if (vars[i].flags & COMMENT)
            {
              param.type = COMMENT;
              param.index = ncomment++;
            }

          parameter[vars[i].name] = param;
        }
    }

  // end DO NOT EDIT

  // add the 3 utility buttons to the bottom of the layout
  leftlayout->addWidget(utilityBox);

  // layouts can contain other layouts. if you added components to
  // "rightlayout" and added "rightlayout" to "layout," you would
  // have left and right panels in your custom GUI.
  layout->addLayout(leftlayout);
  //layout->addLayout(rightlayout);

  show(); // this line is required to render the GUI
}
Example #17
0
IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp)
{
    setCaption(tr("Settings") );
    m_config = new Config("OpieIRC");
    m_config->setGroup("OpieIRC");
    QHBoxLayout *l = new QHBoxLayout(this, 2, 2);
    OTabWidget *tw = new OTabWidget(this);
    l->addWidget(tw);
    /* General Configuration */
    QWidget *genwidget = new QWidget(tw);
    QGridLayout *layout = new QGridLayout(genwidget, 1, 4, 5, 0);
    QLabel *label = new QLabel(tr("Lines displayed :"), genwidget);
    layout->addWidget(label, 0, 0);
    m_lines = new QLineEdit(m_config->readEntry("Lines", "100"), genwidget);
    QWhatsThis::add(m_lines, tr("Amount of lines to be displayed in chats before old lines get deleted - this is necessary to restrain memory consumption. Set to 0 if you don't need this"));
    QIntValidator *validator = new QIntValidator(this);
    validator->setTop(10000);
    validator->setBottom(0);
    m_lines->setValidator(validator);
    layout->addWidget(m_lines, 0, 1);

    /*
     * include timestamp
     */
    m_displayTime = new QCheckBox( tr("Display time in chat log"), genwidget );
    m_displayTime->setChecked( m_config->readBoolEntry("DisplayTime", false) );
    layout->addMultiCellWidget(m_displayTime, 1, 1, 0, 4 );

    // add a spacer
    layout->addItem( new QSpacerItem(1,1, QSizePolicy::Minimum,
                                     QSizePolicy::MinimumExpanding),
                     2, 0 );

    tw->addTab(genwidget, "opieirc/settings", tr("General"));

    /* Color configuration */
    QScrollView *view = new QScrollView(this);
    view->setResizePolicy(QScrollView::AutoOneFit);
    view->setFrameStyle( QFrame::NoFrame );
    QWidget *widget = new QWidget(view->viewport());
    view->addChild(widget);
    layout = new QGridLayout(widget, 7, 2, 5, 0);
    label = new QLabel(tr("Background color :"), widget);
    layout->addWidget(label, 0, 0);
    m_background = new OColorButton(widget, m_config->readEntry("BackgroundColor", "#FFFFFF"));
    QWhatsThis::add(m_background, tr("Background color to be used in chats"));
    layout->addWidget(m_background, 0, 1);
    label = new QLabel(tr("Normal text color :"), widget);
    layout->addWidget(label, 1, 0);
    m_text = new OColorButton(widget, m_config->readEntry("TextColor", "#000000"));
    QWhatsThis::add(m_text, tr("Text color to be used in chats"));
    layout->addWidget(m_text, 1, 1);
    label = new QLabel(tr("Error color :"), widget);
    layout->addWidget(label, 2, 0);
    m_error = new OColorButton(widget, m_config->readEntry("ErrorColor", "#FF0000"));
    QWhatsThis::add(m_error, tr("Text color to be used to display errors"));
    layout->addWidget(m_error, 2, 1);
    label = new QLabel(tr("Text written by yourself :"), widget);
    layout->addWidget(label, 3, 0);
    m_self = new OColorButton(widget, m_config->readEntry("SelfColor", "#CC0000"));
    QWhatsThis::add(m_self, tr("Text color to be used to identify text written by yourself"));
    layout->addWidget(m_self, 3, 1);
    label = new QLabel(tr("Text written by others :"), widget);
    layout->addWidget(label, 4, 0);
    m_other = new OColorButton(widget, m_config->readEntry("OtherColor", "#0000BB"));
    QWhatsThis::add(m_other, tr("Text color to be used to identify text written by others"));
    layout->addWidget(m_other, 4, 1);
    label = new QLabel(tr("Text written by the server :"), widget);
    layout->addWidget(label, 5, 0);
    m_server = new OColorButton(widget, m_config->readEntry("ServerColor", "#0000FF"));
    QWhatsThis::add(m_server, tr("Text color to be used to identify text written by the server"));
    layout->addWidget(m_server, 5, 1);
    label = new QLabel(tr("Notifications :"), widget);
    layout->addWidget(label, 6, 0);
    m_notification = new OColorButton(widget, m_config->readEntry("NotificationColor", "#006400"));
    QWhatsThis::add(m_notification, tr("Text color to be used to display notifications"));
    layout->addWidget(m_notification, 6, 1);
    tw->addTab(view, "opieirc/colors", tr("Colors"));


    /*
     * IRC EditLine KeyConfiguration
     */
    m_keyConf = new Opie::Ui::OKeyConfigWidget(tw, "KEyConfig GUI" );
    m_keyConf->setChangeMode( OKeyConfigWidget::Queue );
    m_keyConf->insert( tr("Keyboard Shortcuts"),
                       IRCHistoryLineEdit::keyConfigInstance() );
    m_keyConf->load();
    tw->addTab(m_keyConf, "SettingsIcon", tr("Keyboard Shortcuts") );

    tw->setCurrentTab( genwidget );
    QPEApplication::showDialog( this );
}
Example #18
0
HelixConfigDialogBase::HelixConfigDialogBase( HelixEngine *engine, amaroK::PluginConfig *config, QWidget *p )
     : QTabWidget( p )
     , m_core(0)
     , m_plugin(0)
     , m_codec(0)
     , m_device(0)
     , m_engine( engine )
{
    int row = 0;
    QString currentPage;
    QWidget *parent = 0;
    QGridLayout *grid = 0;
    QScrollView *sv = 0;

    QString pageName( i18n("Main") );

    addTab( sv = new QScrollView, pageName );
    parent = new QWidget( sv->viewport() );

    sv->setResizePolicy( QScrollView::AutoOneFit );
    sv->setHScrollBarMode( QScrollView::AlwaysOff );
    sv->setFrameShape( QFrame::NoFrame );
    sv->addChild( parent );

    grid = new QGridLayout( parent, /*rows*/20, /*cols*/2, /*margin*/10, /*spacing*/10 );
    grid->setColStretch( 0, 1 );
    grid->setColStretch( 1, 1 );

    if( sv )
       sv->setMinimumWidth( grid->sizeHint().width() + 20 );

    engine->m_coredir = HelixConfig::coreDirectory();
    m_core = new HelixConfigEntry( parent, engine->m_coredir, 
                                   config, row, 
                                   i18n("Helix/Realplay core directory"), 
                                   HelixConfig::coreDirectory().utf8(),
                                   i18n("This is the directory where clntcore.so is located"));
    ++row;
    engine->m_pluginsdir = HelixConfig::pluginDirectory();
    m_plugin = new HelixConfigEntry( parent, engine->m_pluginsdir, 
                                     config, row, 
                                     i18n("Helix/Realplay plugins directory"), 
                                     HelixConfig::pluginDirectory().utf8(),
                                     i18n("This is the directory where, for example, vorbisrend.so is located"));
    ++row;
    engine->m_codecsdir = HelixConfig::codecsDirectory();
    m_codec = new HelixConfigEntry( parent, engine->m_codecsdir, 
                                     config, row, 
                                     i18n("Helix/Realplay codecs directory"), 
                                     HelixConfig::codecsDirectory().utf8(),
                                     i18n("This is the directory where, for example, cvt1.so is located"));
    ++row;
    grid->addMultiCellWidget( new KSeparator( KSeparator::Horizontal, parent ), row, row, 0, 1 );

    ++row;
    m_device = new HelixSoundDevice( parent, config, row, engine );

    // lets find the logo if we can
    QPixmap *pm = 0;
    QString logo = HelixConfig::coreDirectory();
    if (logo.isEmpty()) 
       logo = HELIX_LIBS "/common";

    logo.append("/../share/");

    QString tmp = logo;
    tmp.append("hxplay/logo.png");
    if (QFileInfo(tmp).exists())
    {
       logo = tmp;
       pm = new QPixmap(logo);
    }
    else
    {
       tmp = logo;
       tmp.append("realplay/logo.png");
       if (QFileInfo(tmp).exists())
       {
          logo = tmp;
          pm = new QPixmap(logo);
       }
    }

    if (pm)
    {
       QLabel *l = new QLabel(parent);
       l->setPixmap(*pm);
       grid->addMultiCellWidget( l, 20, 20, 1, 1, Qt::AlignRight );
    }

    entries.setAutoDelete( true );

    pageName = i18n("Plugins");

    addTab( sv = new QScrollView, pageName );
    parent = new QWidget( sv->viewport() );

    sv->setResizePolicy( QScrollView::AutoOneFit );
    sv->addChild( parent );

    QTextEdit *le = new QTextEdit( parent );
    if( sv )
       sv->setMinimumWidth( le->sizeHint().width() );

    grid = new QGridLayout( parent, /*rows*/1, /*cols*/1, /*margin*/2, /*spacing*/1 );
    grid->addMultiCellWidget( le, 0, 1, 0, 1, 0 );
    le->setWordWrap(QTextEdit::NoWrap);

    int n = engine->numPlugins();
    const char *description, *copyright, *moreinfourl;
    row = 0;
    for (int i=0; i<n; i++)
    {
       if (!engine->getPluginInfo(i, description, copyright, moreinfourl))
       {
          le->append(QString(description));
          le->append(QString(copyright));
          le->append(QString(moreinfourl));
          le->append(QString(" "));
       }
    }

    le->setReadOnly(true);
    le->setContentsPos(0,0);
}
Example #19
0
SequenceNumber::SequenceNumber(MainWindow* main)
    : QuasarWindow(main, "SequenceNumber")
{
    _helpSource = "seq_number.html";

    QFrame* frame = new QFrame(this);
    QScrollView* sv = new QScrollView(frame);
    _nums = new QButtonGroup(4, Horizontal, tr("Seq Numbers"), sv->viewport());

    new QLabel("Type", _nums);
    new QLabel("Minimum", _nums);
    new QLabel("Maximum", _nums);
    new QLabel("Next", _nums);

    addIdEdit(tr("Data Object:"), "data_object", "object_id");
    addIdEdit(tr("Journal Entry:"), "gltx", "Journal Entry");
    addIdEdit(tr("Ledger Transfer:"), "gltx", "Ledger Transfer");
    addIdEdit(tr("Card Adjustment:"), "gltx", "Card Adjustment");
    addIdEdit(tr("Customer Invoice:"), "gltx", "Customer Invoice");
    addIdEdit(tr("Customer Return:"), "gltx", "Customer Return");
    addIdEdit(tr("Customer Payment:"), "gltx", "Customer Payment");
    addIdEdit(tr("Customer Quote:"), "quote", "number");
    addIdEdit(tr("Vendor Invoice:"), "gltx", "Vendor Invoice");
    addIdEdit(tr("Vendor Claim:"), "gltx", "Vendor Claim");
    addIdEdit(tr("Purchase Order:"), "porder", "number");
    addIdEdit(tr("Packing Slip:"), "slip", "number");
    addIdEdit(tr("Nosale:"), "gltx", "Nosale");
    addIdEdit(tr("Payout:"), "gltx", "Payout");
    addIdEdit(tr("Withdraw:"), "gltx", "Withdraw");
    addIdEdit(tr("Shift:"), "gltx", "Shift");
    addIdEdit(tr("Item Adjustment:"), "gltx", "Item Adjustment");
    addIdEdit(tr("Item Transfer:"), "gltx", "Item Transfer");
    addIdEdit(tr("Physical Count:"), "pcount", "number");
    addIdEdit(tr("Label Batch:"), "label_batch", "number");
    addIdEdit(tr("Price Batch:"), "price_batch", "number");
    addIdEdit(tr("Promo Batch:"), "promo_batch", "number");
    addIdEdit(tr("Company Number:"), "company", "number");
    addIdEdit(tr("Store Number:"), "store", "number");
    addIdEdit(tr("Station Number:"), "station", "number");
    addIdEdit(tr("Tender Count #:"), "tender_count", "number");
    addIdEdit(tr("Tender Menu #:"), "tender", "menu_num");

    QFrame* buttons = new QFrame(frame);
    QPushButton* ok = new QPushButton(tr("&OK"), buttons);
    QPushButton* quit = new QPushButton(tr("&Close"), buttons);

    connect(ok, SIGNAL(clicked()), SLOT(slotOk()));
    connect(quit, SIGNAL(clicked()), SLOT(close()));

    QGridLayout* buttonGrid = new QGridLayout(buttons);
    buttonGrid->setSpacing(3);
    buttonGrid->setMargin(3);
    buttonGrid->setColStretch(0, 1);
    buttonGrid->addWidget(ok, 0, 1);
    buttonGrid->addWidget(quit, 0, 2);

    _nums->resize(_nums->sizeHint());
    sv->setVScrollBarMode(QScrollView::AlwaysOn);
    sv->resizeContents(_nums->width() + 20, _nums->height());

    QGridLayout* grid = new QGridLayout(frame);
    grid->setSpacing(6);
    grid->setMargin(6);
    grid->setRowStretch(0, 1);
    grid->addWidget(sv, 0, 0);
    grid->addWidget(buttons, 1, 0);

    for (unsigned int i = 0; i < _ids.size(); ++i) {
	IdInfo& info = _ids[i];
	_quasar->db()->getSequence(info.seq);
	info.minNum->setFixed(info.seq.minNumber());
	info.maxNum->setFixed(info.seq.maxNumber());
	info.nextNum->setFixed(info.seq.nextNumber());
    }

    statusBar()->hide();
    setCentralWidget(frame);
    setCaption(tr("Sequence Numbers"));
    finalize();

    if (!allowed("View")) {
	QTimer::singleShot(50, this, SLOT(slotNotAllowed()));
	return;
    }
}
Example #20
0
Kleo::KeyApprovalDialog::KeyApprovalDialog( const std::vector<Item> & recipients,
                                      const std::vector<GpgME::Key> & sender,
                                      QWidget * parent, const char * name,
                                      bool modal )
  : KDialogBase( parent, name, modal, i18n("Encryption Key Approval"), Ok|Cancel, Ok ),
    d( 0 )
{
  assert( !recipients.empty() );

  d = new Private();

  QFrame *page = makeMainWidget();
  QVBoxLayout * vlay = new QVBoxLayout( page, 0, spacingHint() );

  vlay->addWidget( new QLabel( i18n("The following keys will be used for encryption:"), page ) );

  QScrollView * sv = new QScrollView( page );
  sv->setResizePolicy( QScrollView::AutoOneFit );
  vlay->addWidget( sv );

  QWidget * view = new QWidget( sv->viewport() );

  QGridLayout * glay = new QGridLayout( view, 3, 2, marginHint(), spacingHint() );
  glay->setColStretch( 1, 1 );
  sv->addChild( view );

  int row = -1;

  if ( !sender.empty() ) {
    ++row;
    glay->addWidget( new QLabel( i18n("Your keys:"), view ), row, 0 );
    d->selfRequester = new EncryptionKeyRequester( true, EncryptionKeyRequester::AllProtocols, view );
    d->selfRequester->setKeys( sender );
    glay->addWidget( d->selfRequester, row, 1 );
    ++row;
    glay->addMultiCellWidget( new KSeparator( Horizontal, view ), row, row, 0, 1 );
  }

  const QStringList prefs = preferencesStrings();

  for ( std::vector<Item>::const_iterator it = recipients.begin() ; it != recipients.end() ; ++it ) {
    ++row;
    glay->addWidget( new QLabel( i18n("Recipient:"), view ), row, 0 );
    glay->addWidget( new QLabel( it->address, view ), row, 1 );
    d->addresses.push_back( it->address );

    ++row;
    glay->addWidget( new QLabel( i18n("Encryption keys:"), view ), row, 0 );
    KeyRequester * req = new EncryptionKeyRequester( true, EncryptionKeyRequester::AllProtocols, view );
    req->setKeys( it->keys );
    glay->addWidget( req, row, 1 );
    d->requesters.push_back( req );

    ++row;
    glay->addWidget( new QLabel( i18n("Encryption preference:"), view ), row, 0 );
    QComboBox * cb = new QComboBox( false, view );
    cb->insertStringList( prefs );
    glay->addWidget( cb, row, 1 );
    cb->setCurrentItem( pref2cb( it->pref ) );
    connect( cb, SIGNAL(activated(int)), SLOT(slotPrefsChanged()) );
    d->preferences.push_back( cb );
  }

  // calculate the optimal width for the dialog
  const int dialogWidth = marginHint()
                  + sv->frameWidth()
                  + view->sizeHint().width()
                  + sv->verticalScrollBar()->sizeHint().width()
                  + sv->frameWidth()
                  + marginHint()
                  + 2;
  // calculate the optimal height for the dialog
  const int dialogHeight = marginHint()
                   + fontMetrics().height()
                   + spacingHint()
                   + sv->frameWidth()
                   + view->sizeHint().height()
                   + sv->horizontalScrollBar()->sizeHint().height()
                   + sv->frameWidth()
                   + spacingHint()
                   + actionButton( KDialogBase::Cancel )->sizeHint().height()
                   + marginHint()
                   + 2;

  // don't make the dialog too large
  const QRect desk = KGlobalSettings::desktopGeometry( this );
  setInitialSize( QSize( kMin( dialogWidth, 3 * desk.width() / 4 ),
			 kMin( dialogHeight, 7 * desk.height() / 8 ) ) );
}
Example #21
0
FilterDlg::FilterDlg( QWidget *parent, OPackageManager *pm, const QString &name,
               const QString &server, const QString &destination,
               OPackageManager::Status status, const QString &category )
    : QDialog( parent, QString::null, true, WStyle_ContextHelp )
{
    setCaption( tr( "Filter packages" ) );

    QVBoxLayout *layout = new QVBoxLayout( this );
    QScrollView *sv = new QScrollView( this );
    layout->addWidget( sv, 0, 0 );
    sv->setResizePolicy( QScrollView::AutoOneFit );
    sv->setFrameStyle( QFrame::NoFrame );
    QWidget *container = new QWidget( sv->viewport() );
    sv->addChild( container );
    layout = new QVBoxLayout( container, 4, 4 );

    // Category
    m_categoryCB = new QCheckBox( tr( "Category:" ), container );
    QWhatsThis::add( m_categoryCB, tr( "Tap here to filter package list by application category." ) );
    connect( m_categoryCB, SIGNAL(toggled(bool)), this, SLOT(slotCategorySelected(bool)) );
    m_category = new QComboBox( container );
    QWhatsThis::add( m_category, tr( "Select the application category to filter by here." ) );
    m_category->insertStringList( pm->categories() );
    initItem( m_category, m_categoryCB, category );
    layout->addWidget( m_categoryCB );
    layout->addWidget( m_category );

    // Package name
    m_nameCB = new QCheckBox( tr( "Names containing:" ), container );
    QWhatsThis::add( m_nameCB, tr( "Tap here to filter package list by package name." ) );
    connect( m_nameCB, SIGNAL(toggled(bool)), this, SLOT(slotNameSelected(bool)) );
    m_name = new QLineEdit( name, container );
    QWhatsThis::add( m_name, tr( "Enter the package name to filter by here." ) );
    if ( !name.isNull() )
        m_nameCB->setChecked( true );
    m_name->setEnabled( !name.isNull() );
    layout->addWidget( m_nameCB );
    layout->addWidget( m_name );

    // Status
    m_statusCB = new QCheckBox( tr( "With the status:" ), container );
    QWhatsThis::add( m_statusCB, tr( "Tap here to filter package list by the package status." ) );
    connect( m_statusCB, SIGNAL(toggled(bool)), this, SLOT(slotStatusSelected(bool)) );
    m_status = new QComboBox( container );
    QWhatsThis::add( m_status, tr( "Select the package status to filter by here." ) );
    connect( m_status, SIGNAL(activated(const QString&)), this, SLOT(slotStatusChanged(const QString&)) );
    QString currStatus;
    switch ( status )
    {
        case OPackageManager::All : currStatus = tr( "All" );
            break;
        case OPackageManager::Installed : currStatus = tr( "Installed" );
            break;
        case OPackageManager::NotInstalled : currStatus = tr( "Not installed" );
            break;
        case OPackageManager::Updated : currStatus = tr( "Updated" );
            break;
        default : currStatus = QString::null;
    };
    m_status->insertItem( tr( "All" ) );
    m_status->insertItem( tr( "Installed" ) );
    m_status->insertItem( tr( "Not installed" ) );
    m_status->insertItem( tr( "Updated" ) );
    initItem( m_status, m_statusCB, currStatus );
    layout->addWidget( m_statusCB );
    layout->addWidget( m_status );

    // Server
    m_serverCB = new QCheckBox( tr( "Available from the following server:" ), container );
    QWhatsThis::add( m_serverCB, tr( "Tap here to filter package list by source server." ) );
    connect( m_serverCB, SIGNAL(toggled(bool)), this, SLOT(slotServerSelected(bool)) );
    m_server = new QComboBox( container );
    QWhatsThis::add( m_server, tr( "Select the source server to filter by here." ) );
    m_server->insertStringList( pm->servers() );
    initItem( m_server, m_serverCB, server );
    layout->addWidget( m_serverCB );
    layout->addWidget( m_server );

    // Destination
    m_destCB = new QCheckBox( tr( "Installed on device at:" ), container );
    QWhatsThis::add( m_destCB, tr( "Tap here to filter package list by destination where the package is installed to on this device." ) );
    connect( m_destCB, SIGNAL(toggled(bool)), this, SLOT(slotDestSelected(bool)) );
    m_destination = new QComboBox( container );
    QWhatsThis::add( m_destination, tr( "Select the destination location to filter by here." ) );
    m_destination->insertStringList( pm->destinations() );
    initItem( m_destination, m_destCB, destination );
    layout->addWidget( m_destCB );
    layout->addWidget( m_destination );
}
Example #22
0
// The constructor sets up the GUI, laying out the parameters on the left and 
// the two plots on the right. There's nothing special here, it's just long.
// The code for the labels and text boxes for the parameters (on the left) is 
// boilerplate ripped directly from default_gui_model, and should really be 
// refactored out of here.
Istep::Istep(void) : 
  QWidget(MainWindow::getInstance()->centralWidget()), 
  Workspace::Instance("Istep", ::vars, ::num_vars), 
  period(1.0), 
  delay(0.0), 
  Amin(-100.0), 
  Amax(100.0), 
  Nsteps(20), 
  Ncycles(1), 
  duty(50), 
  offset(0.0),
  factor(200.0),
  periodsSincePlot(0)
{
  setCaption(QString::number(getID()) + " Istep");
  
  QBoxLayout *layout = new QHBoxLayout(this); // overall GUI layout
  
  QBoxLayout *leftLayout = new QVBoxLayout();
  
  QHBox *utilityBox = new QHBox(this);
	pauseButton = new QPushButton("Pause", utilityBox);
	pauseButton->setToggleButton(true);
	QPushButton *modifyButton = new QPushButton("Modify", utilityBox);
	QPushButton *unloadButton = new QPushButton("Unload", utilityBox);
	QObject::connect(pauseButton, SIGNAL(toggled(bool)), this, SLOT(pause(bool)));
	QObject::connect(modifyButton, SIGNAL(clicked(void)), this, SLOT(modify(void)));
	QObject::connect(unloadButton, SIGNAL(clicked(void)), this, SLOT(exit(void)));
	QObject::connect(pauseButton, SIGNAL(toggled(bool)), modifyButton, SLOT(setEnabled(bool)));
	QToolTip::add(pauseButton, "Start/Stop Istep protocol");
	QToolTip::add(modifyButton, "Commit changes to parameter values and reset");
	QToolTip::add(unloadButton, "Close plug-in");
    
  // create default_gui_model GUI DO NOT EDIT
	QScrollView *sv = new QScrollView(this);
	sv->setResizePolicy(QScrollView::AutoOneFit);
	sv->setHScrollBarMode(QScrollView::AlwaysOff);

	QWidget *viewport = new QWidget(sv->viewport());
	sv->addChild(viewport);
	QGridLayout *scrollLayout = new QGridLayout(viewport, 1, 2);

	size_t nstate = 0, nparam = 0, nevent = 0, ncomment = 0;
	for (size_t i = 0; i < num_vars; i++)
	{
		if (vars[i].flags & (PARAMETER | STATE | EVENT | COMMENT))
		{
			param_t param = {0};

			param.label = new QLabel(vars[i].name, viewport);
			scrollLayout->addWidget(param.label, parameter.size(), 0);
			param.edit = new DefaultGUILineEdit(viewport);
			scrollLayout->addWidget(param.edit, parameter.size(), 1);

			QToolTip::add(param.label, vars[i].description);
			QToolTip::add(param.edit, vars[i].description);

			if (vars[i].flags & PARAMETER)
			{
				if (vars[i].flags & DOUBLE)
				{
					param.edit->setValidator(new QDoubleValidator(param.edit));
					param.type = PARAMETER | DOUBLE;
				}
				else if (vars[i].flags & UINTEGER)
				{
					QIntValidator *validator = new QIntValidator(param.edit);
					param.edit->setValidator(validator);
					validator->setBottom(0);
					param.type = PARAMETER | UINTEGER;
				}
				else if (vars[i].flags & INTEGER)
				{
					param.edit->setValidator(new QIntValidator(param.edit));
					param.type = PARAMETER | INTEGER;
				}
				else
					param.type = PARAMETER;
				param.index = nparam++;
				param.str_value = new QString;
			}
			else if (vars[i].flags & STATE)
			{
				param.edit->setReadOnly(true);
				param.type = STATE;
				param.index = nstate++;
			}
			else if (vars[i].flags & EVENT)
			{
				param.edit->setReadOnly(true);
				param.type = EVENT;
				param.index = nevent++;
			}
			else if (vars[i].flags & COMMENT)
			{
				param.type = COMMENT;
				param.index = ncomment++;
			}

			parameter[vars[i].name] = param;
		}
	}
	// end default_gui_model GUI DO NOT EDIT
	leftLayout->addWidget(sv);
	leftLayout->addWidget(utilityBox);
	layout->addLayout(leftLayout);
	
	QBoxLayout *rightLayout = new QVBoxLayout();
	rightLayout->setSpacing(15);
	rightLayout->setMargin(10);
	
	vplot = new IncrementalPlot(this);
	vplot->setMinimumSize(400, 200);
	rightLayout->addWidget(vplot, 2);
	iplot = new IncrementalPlot(this);
	iplot->setMinimumSize(400, 100);
	rightLayout->addWidget(iplot, 1);
	
	layout->addLayout(rightLayout);
	layout->setResizeMode(QLayout::Minimum);
	layout->setStretchFactor(leftLayout, 0);
	layout->setStretchFactor(rightLayout, 1);
	
	QRect thisRect = this->geometry();
	thisRect.setHeight(350);
	this->setGeometry(thisRect);
	
	// set GUI refresh rate
	QTimer *timer = new QTimer(this);
	timer->start(1000);
	QObject::connect(timer, SIGNAL(timeout(void)), this, SLOT(refresh(void)));
	show();
    
  stepSize = (Amax - Amin) / Nsteps;
  update(PERIOD);
  update(INIT);
  refresh();
}
Example #23
0
void
SigGen::createGUI(DefaultGUIModel::variable_t *var, int size)
{

  QBoxLayout *layout = new QVBoxLayout(this);

  QVButtonGroup *modeBox = new QVButtonGroup("Signal Type", this);

  waveShape = new QComboBox(FALSE, modeBox, "Signal Type:");
  waveShape->insertItem("Sine Wave");
  waveShape->insertItem("Monophasic Square Wave");
  waveShape->insertItem("Biphasic Square Wave");
  waveShape->insertItem("Sawtooth Wave");
  waveShape->insertItem("ZAP Stimulus");
  QToolTip::add(waveShape, "Choose a signal to generate.");
  QObject::connect(waveShape,SIGNAL(activated(int)), this, SLOT(updateMode(int)));

  // add custom GUI components to layout above default_gui_model components
  layout->addWidget(modeBox);
  //layout->addWidget(waveShape);

  QScrollView *sv = new QScrollView(this);
  sv->setResizePolicy(QScrollView::AutoOneFit);
  layout->addWidget(sv);

  QWidget *viewport = new QWidget(sv->viewport());
  sv->addChild(viewport);
  QGridLayout *scrollLayout = new QGridLayout(viewport, 1, 2);

  size_t nstate = 0, nparam = 0, nevent = 0, ncomment = 0;
  for (size_t i = 0; i < num_vars; i++)
    {
      if (vars[i].flags & (PARAMETER | STATE | EVENT | COMMENT))
        {
          param_t param;

          param.label = new QLabel(vars[i].name, viewport);
          scrollLayout->addWidget(param.label, parameter.size(), 0);
          param.edit = new DefaultGUILineEdit(viewport);
          scrollLayout->addWidget(param.edit, parameter.size(), 1);

          QToolTip::add(param.label, vars[i].description);
          QToolTip::add(param.edit, vars[i].description);

          if (vars[i].flags & PARAMETER)
            {
              if (vars[i].flags & DOUBLE)
                {
                  param.edit->setValidator(new QDoubleValidator(param.edit));
                  param.type = PARAMETER | DOUBLE;
                }
              else if (vars[i].flags & UINTEGER)
                {
                  QIntValidator *validator = new QIntValidator(param.edit);
                  param.edit->setValidator(validator);
                  validator->setBottom(0);
                  param.type = PARAMETER | UINTEGER;
                }
              else if (vars[i].flags & INTEGER)
                {
                  param.edit->setValidator(new QIntValidator(param.edit));
                  param.type = PARAMETER | INTEGER;
                }
              else
                param.type = PARAMETER;
              param.index = nparam++;
              param.str_value = new QString;
            }
          else if (vars[i].flags & STATE)
            {
              param.edit->setReadOnly(true);
              param.edit->setPaletteForegroundColor(Qt::darkGray);
              param.type = STATE;
              param.index = nstate++;
            }
          else if (vars[i].flags & EVENT)
            {
              param.edit->setReadOnly(true);
              param.type = EVENT;
              param.index = nevent++;
            }
          else if (vars[i].flags & COMMENT)
            {
              param.type = COMMENT;
              param.index = ncomment++;
            }

          parameter[vars[i].name] = param;
        }
    }

  QHBox *hbox1 = new QHBox(this);
  pauseButton = new QPushButton("Pause", hbox1);
  pauseButton->setToggleButton(true);
  QObject::connect(pauseButton,SIGNAL(toggled(bool)),this,SLOT(pause(bool)));
  QPushButton *modifyButton = new QPushButton("Modify", hbox1);
  QObject::connect(modifyButton,SIGNAL(clicked(void)),this,SLOT(modify(void)));
  QPushButton *unloadButton = new QPushButton("Unload", hbox1);
  QObject::connect(unloadButton,SIGNAL(clicked(void)),this,SLOT(exit(void)));
  layout->addWidget(hbox1);

  show();

}
Example #24
0
Expert::Expert( QWidget *parent ) : QTabDialog( parent )
{

  m_dependencies = new QDict< QList<IInput> >(257);
  m_dependencies->setAutoDelete(TRUE);
  m_inputWidgets = new QDict< IInput >;
  m_switches = new QDict< QObject >;
  m_changed = FALSE;

  setHelpButton();
  
  QListIterator<ConfigOption> options = Config::instance()->iterator();
  QVBoxLayout *pageLayout = 0;
  QFrame *page = 0;
  ConfigOption *option = 0;
  for (options.toFirst();(option=options.current());++options)
  {
    switch(option->kind())
    {
      case ConfigOption::O_Info:
        {
          if (pageLayout) pageLayout->addStretch(1);
          QScrollView *view = new QScrollView(this);
          view->setVScrollBarMode(QScrollView::Auto);
          view->setHScrollBarMode(QScrollView::AlwaysOff);
          view->setResizePolicy(QScrollView::AutoOneFit);
          page = new QFrame( view->viewport(), option->name() );
          pageLayout = new QVBoxLayout(page);
          pageLayout->setMargin(10);
          view->addChild(page);
          addTab(view,option->name());
          QWhatsThis::add(page, option->docs().simplifyWhiteSpace() );
          QToolTip::add(page, option->docs() );
        }
        break;
      case ConfigOption::O_String:
        {
          ASSERT(page!=0);
          InputString::StringMode sm=InputString::StringFree;
          switch(((ConfigString *)option)->widgetType())
          {
            case ConfigString::String: sm=InputString::StringFree; break;
            case ConfigString::File:   sm=InputString::StringFile; break;
            case ConfigString::Dir:    sm=InputString::StringDir;  break;
          }
          InputString *inputString = new InputString( 
                         option->name(),                        // name
                         page,                                  // widget
                         *((ConfigString *)option)->valueRef(), // variable 
                         sm                                     // type
                       ); 
          pageLayout->addWidget(inputString);
          QWhatsThis::add(inputString, option->docs().simplifyWhiteSpace() );
          QToolTip::add(inputString,option->docs());
          connect(inputString,SIGNAL(changed()),SLOT(changed()));
          m_inputWidgets->insert(option->name(),inputString);
          addDependency(m_switches,option->dependsOn(),option->name());
        }
        break;
      case ConfigOption::O_Enum:
        {
          ASSERT(page!=0);
          InputString *inputString = new InputString( 
                         option->name(),                        // name
                         page,                                  // widget
                         *((ConfigEnum *)option)->valueRef(),   // variable 
                         InputString::StringFixed               // type
                       ); 
          pageLayout->addWidget(inputString);
          QStrListIterator sli=((ConfigEnum *)option)->iterator();
          for (sli.toFirst();sli.current();++sli)
          {
            inputString->addValue(sli.current());
          }
          inputString->init();
          QWhatsThis::add(inputString, option->docs().simplifyWhiteSpace() );
          QToolTip::add(inputString, option->docs());
          connect(inputString,SIGNAL(changed()),SLOT(changed()));
          m_inputWidgets->insert(option->name(),inputString);
          addDependency(m_switches,option->dependsOn(),option->name());
        }
        break;
      case ConfigOption::O_List:
        {
          ASSERT(page!=0);
          InputStrList::ListMode lm=InputStrList::ListString;
          switch(((ConfigList *)option)->widgetType())
          {
            case ConfigList::String:     lm=InputStrList::ListString;  break;
            case ConfigList::File:       lm=InputStrList::ListFile;    break;
            case ConfigList::Dir:        lm=InputStrList::ListDir;     break;
            case ConfigList::FileAndDir: lm=InputStrList::ListFileDir; break;
          }
          InputStrList *inputStrList = new InputStrList(
                          option->name(),                         // name
                          page,                                   // widget
                          *((ConfigList *)option)->valueRef(),    // variable
                          lm                                      // type
                        );
          pageLayout->addWidget(inputStrList);
          QWhatsThis::add(inputStrList, option->docs().simplifyWhiteSpace() );
          QToolTip::add(inputStrList, option->docs());
          connect(inputStrList,SIGNAL(changed()),SLOT(changed()));
          m_inputWidgets->insert(option->name(),inputStrList);
          addDependency(m_switches,option->dependsOn(),option->name());
        }
        break;
        break;
      case ConfigOption::O_Bool:
        {
          ASSERT(page!=0);
          InputBool *inputBool = new InputBool(
                          option->name(),                         // name
                          page,                                   // widget
                          *((ConfigBool *)option)->valueRef()     // variable
                        );
          pageLayout->addWidget(inputBool);
          QWhatsThis::add(inputBool, option->docs().simplifyWhiteSpace() );
          QToolTip::add(inputBool, option->docs() );
          connect(inputBool,SIGNAL(changed()),SLOT(changed()));
          m_inputWidgets->insert(option->name(),inputBool);
          addDependency(m_switches,option->dependsOn(),option->name());
        }
        break;
      case ConfigOption::O_Int:
        {
          ASSERT(page!=0);
          InputInt *inputInt = new InputInt(
                          option->name(),                         // name
                          page,                                   // widget
                          *((ConfigInt *)option)->valueRef(),     // variable
                          ((ConfigInt *)option)->minVal(),        // min value
                          ((ConfigInt *)option)->maxVal()         // max value
                        );
          pageLayout->addWidget(inputInt);
          QWhatsThis::add(inputInt, option->docs().simplifyWhiteSpace() );
          QToolTip::add(inputInt, option->docs() );
          connect(inputInt,SIGNAL(changed()),SLOT(changed()));
          m_inputWidgets->insert(option->name(),inputInt);
          addDependency(m_switches,option->dependsOn(),option->name());
        }
        break;
      case ConfigOption::O_Obsolete:
        break;
    } 
  }
  if (pageLayout) pageLayout->addStretch(1);

  QDictIterator<QObject> di(*m_switches);
  QObject *obj = 0;
  for (di.toFirst();(obj=di.current());++di)
  {
    connect(obj,SIGNAL(toggle(const char *,bool)),SLOT(toggle(const char *,bool)));
    // UGLY HACK: assumes each item depends on a boolean without checking!
    emit toggle(di.currentKey(),((InputBool *)obj)->getState());
  }

  connect(this,SIGNAL(helpButtonPressed()),this,SLOT(handleHelp()));
  
}
Example #25
0
/** Render the document */
void reportView::render(){
    QFont generalFont = KGlobalSettings::generalFont();
    QString fntFamily = generalFont.family();
    int fntSize = generalFont.pointSize();
    if (fntSize == -1)
       fntSize = QFontInfo(generalFont).pointSize();

    QString textColor = KGlobalSettings::textColor().name();
    QString baseColor = KGlobalSettings::baseColor().name();
    QColorGroup cg = palette().active();
    QString bgColor = cg.background().name();
    QString hlColor = cg.highlight().name();
    QString hlTextColor = cg.highlightedText().name();

    QString locationName = m_weatherService->stationName(m_locationCode);
    QString countryName = m_weatherService->stationCountry(m_locationCode);
    QString temp = m_weatherService->temperature(m_locationCode);
    QString dewPoint = m_weatherService->dewPoint( m_locationCode);
    QString relHumidity = m_weatherService->relativeHumidity(m_locationCode );
    QString heatIndex = m_weatherService->heatIndex(m_locationCode );
    QString windChill = m_weatherService->windChill(m_locationCode );
    QString pressure = m_weatherService->pressure(m_locationCode );
    QString wind = m_weatherService->wind(m_locationCode );
    QString sunRiseTime = m_weatherService->sunRiseTime(m_locationCode );
    QString sunSetTime = m_weatherService->sunSetTime(m_locationCode );
    QString date = m_weatherService->date(m_locationCode );
    QString icon = m_weatherService->iconFileName(m_locationCode );
    QStringList cover = m_weatherService->cover(m_locationCode );
    QStringList weather = m_weatherService->weather(m_locationCode );

    setCaption(i18n("Weather Report - %1").arg( locationName ) );

    QString weatherText = "<ul>\n";

    if ( m_weatherService->stationNeedsMaintenance( m_locationCode ) )
    {
        weatherText += "<li>" + i18n( "Station reports that it needs maintenance" ) + " \n";
    }
    for (QStringList::const_iterator it = cover.begin();
            it != cover.end(); ++it)
        weatherText += "<li>" + *it + "\n";

    for (QStringList::const_iterator it = weather.begin();
            it != weather.end(); ++it)
        weatherText += "<li>" + *it + "\n";

    weatherText += "</ul>\n";

    QString contents =
    "<html><head><style type=\"text/css\">" +
    QString("body { font-family: \"%1\"; font-size: %2pt; color: %3; background-color: %4; }\n")
    .arg(fntFamily).arg(fntSize).arg(textColor).arg(baseColor) +
    QString("div.headerTitle { background-color: %1; color: %2; padding: 4px; font-size: 120%; border: solid %3 1px; }\n")
    .arg(hlColor).arg(hlTextColor).arg(textColor) +
    QString("div.headerMsg { background-color: %1; color: %2; border-bottom: solid %3 1px; "
    "border-left: solid %4 1px; border-right: solid %5 1px; margin-bottom: 1em; padding: 2px; }\n")
    .arg(bgColor).arg(textColor).arg(textColor).arg(textColor).arg(textColor) +    
    QString("</style><title></title></head><body dir=\"%1\">").arg( QApplication::reverseLayout()?"rtl":"ltr") + 
    "<div class=\"headerTitle\"><b>" + i18n( "Weather Report - %1 - %2" ).arg( locationName ).arg( countryName ) +        
    "</b></div>\n";

    if ( ! date.isEmpty() )
      contents += "<div class=\"headerMsg\"><b>" + i18n( "Latest data from %1" ).arg(date) + "</b></div>\n";

    contents += QString(
    "<table><tr><td width=\"60\" style=\"text-align: center; border: dotted %1 1px;\">"
    "<img width=\"64\" height=\"64\" src=\"%2\" /></td>"
    "<td style=\"vertical-align: top\">%3</td></tr>")
    .arg(bgColor).arg(KURL(icon).url()).arg(weatherText) +
    "</table><table>" +
    QString("<tr><th style=\"text-align: right\">" + i18n( "Temperature:" )
    + "</th><td>%1</td>"
    "<td width=\"50\">&nbsp;</td>"
    "<th style=\"text-align: right\">" + i18n( "Dew Point:" )
    + "</th><td>%2</td></tr>"
    "<tr><th style=\"text-align: right\">" + i18n( "Air Pressure:" )
    + "</th><td>%3</td>"
    "<td width=\"50\">&nbsp;</td>"
    "<th style=\"text-align: right\">" + i18n( "Rel. Humidity:" )
    + "</th><td>%4</td></tr>"
    "<tr><th style=\"text-align: right\">" + i18n( "Wind Speed:" )
    + "</th><td>%5</td>")
    .arg(temp).arg(dewPoint).arg(pressure).arg(relHumidity)
    .arg(wind) + "<td width=\"50\">&nbsp;</td>";

    if (!heatIndex.isEmpty())
        contents += QString("<th style=\"text-align: right\">"
        + i18n( "Heat Index:" ) + "</th><td>%1</td>").arg(heatIndex);
    else if (!windChill.isEmpty())
        contents += QString("<th style=\"text-align: right\">"
        + i18n( "Wind Chill:" ) + "</th><td>%1</td>").arg(windChill);
    else
        contents += "<td>&nbsp;</td><td>&nbsp;</td>";
    contents += "</tr>";

    contents += QString("<tr><th style=\"text-align: right\">"
    + i18n( "Sunrise:" ) + "</th><td>%1</td>" +
    "<td width=\"50\">&nbsp;</td><th style=\"text-align: right\">"
    + i18n( "Sunset:" ) + "</th><td>%2</td>")
    .arg(sunRiseTime).arg(sunSetTime);

    contents += "</tr></table></body></html>";

    m_reportView->begin();
    m_reportView->write( contents );
    m_reportView->end();
	
    QScrollView *view = m_reportView->view();
    kdDebug() << "Size " << view->size().height() << "," << view->size().width() << endl;
    kdDebug() << "Size " << view->visibleHeight() << "," << view->visibleWidth() << endl;

    m_reportView->view()->resize(view->size().width(), view->size().height());

}
void
TDDDriver::createGUI(DefaultGUIModel::variable_t *var, int size)
{

  setMinimumSize(200, 300); // Qt API for setting window size

  //overall GUI layout with a "horizontal box" copied from DefaultGUIModel

  QBoxLayout *layout = new QHBoxLayout(this);

  //additional GUI layouts with "vertical" layouts that will later
  // be added to the overall "layout" above
  QBoxLayout *leftlayout = new QVBoxLayout();
  QBoxLayout *rightlayout = new QVBoxLayout();

  //these 3 utility buttons are copied from DefaultGUIModel
  QHBox *utilityBox = new QHBox(this);
  pauseButton = new QPushButton("Pause", utilityBox);
  pauseButton->setToggleButton(true);
  QObject::connect(pauseButton, SIGNAL(toggled(bool)), this, SLOT(pause(bool)));
  QPushButton *modifyButton = new QPushButton("Modify", utilityBox);
  QObject::connect(modifyButton, SIGNAL(clicked(void)), this, SLOT(modify(void)));
  QPushButton *unloadButton = new QPushButton("Unload", utilityBox);
  QObject::connect(unloadButton, SIGNAL(clicked(void)), this, SLOT(exit(void)));

  QPixmap *drawsurface = new QPixmap(640,480);
  QWidget *drawplane = new QWidget;
  drawplane->resize(640, drawplane->width());
  drawsurface->fill(Qt::black);
  bitBlt(drawplane,0,0,drawsurface);
  printf("Widget Width = %d \n", drawplane->width());
  rightlayout->addWidget(drawplane);

  // copied from DefaultGUIModel DO NOT EDIT
  // this generates the text boxes and labels
  QScrollView *sv = new QScrollView(this);
  sv->setResizePolicy(QScrollView::AutoOneFit);
  leftlayout->addWidget(sv);

  QWidget *viewport = new QWidget(sv->viewport());
  sv->addChild(viewport);
  QGridLayout *scrollLayout = new QGridLayout(viewport, 1, 2);

  size_t nstate = 0, nparam = 0, nevent = 0, ncomment = 0;
  for (size_t i = 0; i < num_vars; i++)
    {
      if (vars[i].flags & (PARAMETER | STATE | EVENT | COMMENT))
        {
          param_t param;

          param.label = new QLabel(vars[i].name, viewport);
          scrollLayout->addWidget(param.label, parameter.size(), 0);
          param.edit = new DefaultGUILineEdit(viewport);
          scrollLayout->addWidget(param.edit, parameter.size(), 1);

          QToolTip::add(param.label, vars[i].description);
          QToolTip::add(param.edit, vars[i].description);

          if (vars[i].flags & PARAMETER)
            {
              if (vars[i].flags & DOUBLE)
                {
                  param.edit->setValidator(new QDoubleValidator(param.edit));
                  param.type = PARAMETER | DOUBLE;
                }
              else if (vars[i].flags & UINTEGER)
                {
                  QIntValidator *validator = new QIntValidator(param.edit);
                  param.edit->setValidator(validator);
                  validator->setBottom(0);
                  param.type = PARAMETER | UINTEGER;
                }
              else if (vars[i].flags & INTEGER)
                {
                  param.edit->setValidator(new QIntValidator(param.edit));
                  param.type = PARAMETER | INTEGER;
                }
              else
                param.type = PARAMETER;
              param.index = nparam++;
              param.str_value = new QString;
            }
          else if (vars[i].flags & STATE)
            {
              param.edit->setReadOnly(true);
              param.edit->setPaletteForegroundColor(Qt::darkGray);
              param.type = STATE;
              param.index = nstate++;
            }
          else if (vars[i].flags & EVENT)
            {
              param.edit->setReadOnly(true);
              param.type = EVENT;
              param.index = nevent++;
            }
          else if (vars[i].flags & COMMENT)
            {
              param.type = COMMENT;
              param.index = ncomment++;
            }

          parameter[vars[i].name] = param;
        }
    }

  // end DO NOT EDIT

  // add the 3 utility buttons to the bottom of the layout
  leftlayout->addWidget(utilityBox);

  // layouts can contain other layouts. if you added components to
  // "rightlayout" and added "rightlayout" to "layout," you would
  // have left and right panels in your custom GUI.
  layout->addLayout(leftlayout);
  layout->addLayout(rightlayout);

  show(); // this line is required to render the GUI
};
Example #27
0
// ---- initSettings ----------------------------------------------------------
QWidget *Configuration::initSettings(Cfg &cfg)
{
    QWidget *control = new QWidget( _mainWidget );

    QFontMetrics fm = fontMetrics();
	int fh = fm.height();

    QVBoxLayout *vb = new QVBoxLayout( control );

	QScrollView *sv = new QScrollView( control );
	vb->addWidget( sv, 0, 0 );
	sv->setResizePolicy( QScrollView::AutoOneFit );
	sv->setFrameStyle( QFrame::NoFrame );

	QWidget *container = new QWidget( sv->viewport() );
	sv->addChild( container );

	QGridLayout *layout = new QGridLayout( container );
	layout->setSpacing( 4 );
	layout->setMargin( 4 );

	QLabel *label = new QLabel( tr( "Enter currency symbol:" ), container );
	QWhatsThis::add( label, tr( "Enter your local currency symbol here." ) );
	label->setMaximumHeight( fh + 3 );
	layout->addWidget( label, 0, 0 );

	symbolEdit = new QLineEdit( cfg.getCurrencySymbol(), container );
	QWhatsThis::add( symbolEdit, tr( "Enter your local currency symbol here." ) );
	symbolEdit->setMaximumHeight( fh + 5 );
	symbolEdit->setFocus();
    layout->addWidget( symbolEdit, 0, 1 );

	lockCB = new QCheckBox( tr( "Show whether checkbook is password\nprotected" ), container );
	QWhatsThis::add( lockCB, tr( "Click here to select whether or not the main window will display that the checkbook is protected with a password." ) );
	lockCB->setChecked( cfg.getShowLocks() );
	layout->addMultiCellWidget( lockCB, 1, 1, 0, 1 );

	balCB = new QCheckBox( tr( "Show checkbook balances" ), container );
	QWhatsThis::add( balCB, tr( "Click here to select whether or not the main window will display the current balance for each checkbook." ) );
	balCB->setMaximumHeight( fh + 5 );
	balCB->setChecked( cfg.getShowBalances() );
	layout->addMultiCellWidget( balCB, 2, 2, 0, 1 );

    openLastBookCB = new QCheckBox( tr("Open last checkbook" ), container );
    QWhatsThis::add( openLastBookCB, tr("Click here to select whether the last open checkbook will be opened at startup.") );
    openLastBookCB->setMaximumHeight(fh+5);
    openLastBookCB->setChecked( cfg.isOpenLastBook() );
    layout->addMultiCellWidget( openLastBookCB, 3, 3, 0, 1 );

    lastTabCB = new QCheckBox( tr("Show last checkbook tab" ), container );
    QWhatsThis::add( lastTabCB, tr("Click here to select whether the last tab in a checkbook should be displayed.") );
    lastTabCB->setMaximumHeight(fh+5);
    lastTabCB->setChecked( cfg.isShowLastTab() );
    layout->addMultiCellWidget( lastTabCB, 4, 4, 0, 1 );

    savePayees = new QCheckBox( tr("Save new description as payee"), container );
    QWhatsThis::add( savePayees, tr("Click here to save new descriptions in the list of payess.") );
    savePayees->setMaximumHeight(fh+5);
    savePayees->setChecked( cfg.getSavePayees() );
    layout->addMultiCellWidget( savePayees, 5, 5, 0, 1 );

	smallFontCB = new QCheckBox( tr( "Use smaller font for list" ), container );
	QWhatsThis::add( smallFontCB, tr( "Click here to select smaller font for transactions." ) );
	smallFontCB->setChecked( cfg.getUseSmallFont() );
	layout->addMultiCellWidget( smallFontCB, 6, 6, 0, 1 );

    return(control);
}
Example #28
0
void
WaveMaker::createGUI(DefaultGUIModel::variable_t *var, int size)
{
  QBoxLayout *layout = new QHBoxLayout(this); // overall GUI layout

  // Left side GUI
  QBoxLayout *leftlayout = new QVBoxLayout();

  QHButtonGroup *fileBox = new QHButtonGroup("File:", this);
  QPushButton *loadBttn = new QPushButton("Load File", fileBox);
  QPushButton *previewBttn = new QPushButton("Preview File", fileBox);
  QObject::connect(loadBttn, SIGNAL(clicked()), this, SLOT(loadFile()));
  QObject::connect(previewBttn, SIGNAL(clicked()), this, SLOT(previewFile()));

  QHBox *utilityBox = new QHBox(this);
  pauseButton = new QPushButton("Pause", utilityBox);
  pauseButton->setToggleButton(true);
  QObject::connect(pauseButton, SIGNAL(toggled(bool)), this, SLOT(pause(bool)));
  QObject::connect(pauseButton, SIGNAL(toggled(bool)), loadBttn, SLOT(setEnabled(bool)));
  QPushButton *modifyButton = new QPushButton("Modify", utilityBox);
  QObject::connect(modifyButton, SIGNAL(clicked(void)), this, SLOT(modify(void)));
  QPushButton *unloadButton = new QPushButton("Unload", utilityBox);
  QObject::connect(unloadButton, SIGNAL(clicked(void)), this, SLOT(exit(void)));
  QObject::connect(pauseButton, SIGNAL(toggled(bool)), modifyButton, SLOT(setEnabled(bool)));
  QToolTip::add(pauseButton, "Start/Stop Plug-in");
  QToolTip::add(modifyButton, "Commit Changes to Parameter Values");
  QToolTip::add(unloadButton, "Close Plug-in");

  // Add custom left side GUI components to layout above default_gui_model components
  leftlayout->addWidget(fileBox);

  QScrollView *sv = new QScrollView(this);
  sv->setResizePolicy(QScrollView::AutoOneFit);
  leftlayout->addWidget(sv);

  QWidget *viewport = new QWidget(sv->viewport());
  sv->addChild(viewport);
  QGridLayout *scrollLayout = new QGridLayout(viewport, 1, 2);

  size_t nstate = 0, nparam = 0, nevent = 0, ncomment = 0;
  for (size_t i = 0; i < num_vars; i++)
    {
      if (vars[i].flags & (PARAMETER | STATE | EVENT | COMMENT))
        {
          param_t param;

          param.label = new QLabel(vars[i].name, viewport);
          scrollLayout->addWidget(param.label, parameter.size(), 0);
          param.edit = new DefaultGUILineEdit(viewport);
          scrollLayout->addWidget(param.edit, parameter.size(), 1);

          QToolTip::add(param.label, vars[i].description);
          QToolTip::add(param.edit, vars[i].description);

          if (vars[i].flags & PARAMETER)
            {
              if (vars[i].flags & DOUBLE)
                {
                  param.edit->setValidator(new QDoubleValidator(param.edit));
                  param.type = PARAMETER | DOUBLE;
                }
              else if (vars[i].flags & UINTEGER)
                {
                  QIntValidator *validator = new QIntValidator(param.edit);
                  param.edit->setValidator(validator);
                  validator->setBottom(0);
                  param.type = PARAMETER | UINTEGER;
                }
              else if (vars[i].flags & INTEGER)
                {
                  param.edit->setValidator(new QIntValidator(param.edit));
                  param.type = PARAMETER | INTEGER;
                }
              else
                param.type = PARAMETER;
              param.index = nparam++;
              param.str_value = new QString;
            }
          else if (vars[i].flags & STATE)
            {
              param.edit->setReadOnly(true);
              param.edit->setPaletteForegroundColor(Qt::darkGray);
              param.type = STATE;
              param.index = nstate++;
            }
          else if (vars[i].flags & EVENT)
            {
              param.edit->setReadOnly(true);
              param.type = EVENT;
              param.index = nevent++;
            }
          else if (vars[i].flags & COMMENT)
            {
              param.type = COMMENT;
              param.index = ncomment++;
            }

          parameter[vars[i].name] = param;
        }
    }

  // add custom components to layout below default_gui_model components
  leftlayout->addWidget(utilityBox);
  // Add left and right side layouts to the overall layout
  layout->addLayout(leftlayout);
  //	layout->setResizeMode(QLayout::Fixed);

  // set GUI refresh rate
  QTimer *timer = new QTimer(this);
  timer->start(1000);
  QObject::connect(timer, SIGNAL(timeout(void)), this, SLOT(refresh(void)));
  show();

}