Esempio n. 1
0
void tst_QMenu::indexBasedInsertion()
{
    // test the compat'ed index based insertion

    QFETCH(int, indexForInsertion);
    QFETCH(int, expectedIndex);

    {
        QMenu menu;
        menu.addAction("Regular Item");

        menu.insertItem("New Item", -1 /*id*/, indexForInsertion);

        QAction *act = menu.actions().value(expectedIndex);
        QVERIFY(act);
        QCOMPARE(act->text(), QString("New Item"));
    }
    {
        QMenu menu;
        menu.addAction("Regular Item");

        menu.insertSeparator(indexForInsertion);

        QAction *act = menu.actions().value(expectedIndex);
        QVERIFY(act);
        QVERIFY(act->isSeparator());
    }
}
Esempio n. 2
0
todoList::todoList(QWidget* parent, const char* name, Qt::WFlags fl)
    : XWidget(parent, name, fl)
{
  setupUi(this);

	QSqlDatabase db = QSqlDatabase::database();

  _parameterWidget->setType(tr("CRM Account"), "crmAccountId", ParameterWidget::Crmacct);
  _parameterWidget->setType(tr("Assigned"), "assigned_username", ParameterWidget::User, db.userName());
  _parameterWidget->setType(tr("Owner"), "owner_username", ParameterWidget::User);
  _parameterWidget->setType(tr("Assigned Pattern"), "assigned_usr_pattern", ParameterWidget::Text);
  _parameterWidget->setType(tr("Owner Pattern"), "owner_usr_pattern", ParameterWidget::Text);
  _parameterWidget->setType(tr("Start Date Before"), "startStartDate", ParameterWidget::Date);
  _parameterWidget->setType(tr("Start Date After"), "startEndDate", ParameterWidget::Date);
	_parameterWidget->setType(tr("Due Date Before"), "dueStartDate", ParameterWidget::Date);
  _parameterWidget->setType(tr("Due Date After"), "dueEndDate", ParameterWidget::Date);
  _parameterWidget->applyDefaultFilterSet();

  _crmAccount->hide();
  
  q.exec("SELECT current_user;");

  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    close();
  }

  connect(_parameterWidget, SIGNAL(updated()), this, SLOT(sFillList()));

	connect(_query, SIGNAL(clicked()), this, SLOT(sFillList()));
  connect(_autoUpdate,	SIGNAL(toggled(bool)),	this,	SLOT(sHandleAutoUpdate(bool)));
  connect(_close,	SIGNAL(clicked()),	this,	SLOT(sClose()));
  connect(_completed,	SIGNAL(toggled(bool)),	this,	SLOT(sFillList()));
  connect(_delete,	SIGNAL(clicked()),	this,	SLOT(sDelete()));

  connect(_todolist,    SIGNAL(toggled(bool)),  this,   SLOT(sFillList()));
  connect(_incidents,	SIGNAL(toggled(bool)),	this,	SLOT(sFillList()));
  connect(_projects,	SIGNAL(toggled(bool)),	this,	SLOT(sFillList()));
  connect(_new,		SIGNAL(clicked()),	this,	SLOT(sNew()));
  connect(_print,	SIGNAL(clicked()),	this,	SLOT(sPrint()));
  connect(_todoList,	SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));
  connect(_todoList,	SIGNAL(populateMenu(QMenu*, QTreeWidgetItem*, int)),
	    this,	SLOT(sPopulateMenu(QMenu*)));
  connect(_todoList,	SIGNAL(itemSelectionChanged()),	this,	SLOT(handlePrivs()));

  connect(_edit,	SIGNAL(clicked()),	this,	SLOT(sEdit()));
  connect(_view,	SIGNAL(clicked()),	this,	SLOT(sView()));
  

  _todoList->addColumn(tr("Type"),      _userColumn,  Qt::AlignCenter, true, "type");
  _todoList->addColumn(tr("Seq"),        _seqColumn,  Qt::AlignRight,  false, "seq");
  _todoList->addColumn(tr("Priority"),  _userColumn,  Qt::AlignLeft,   true, "priority");
  _todoList->addColumn(tr("Assigned To"),_userColumn,  Qt::AlignLeft,   true, "usr");
  _todoList->addColumn(tr("Name"),              100,  Qt::AlignLeft,   true, "name");
  _todoList->addColumn(tr("Description"),        -1,  Qt::AlignLeft,   true, "descrip");
  _todoList->addColumn(tr("Status"),  _statusColumn,  Qt::AlignLeft,   true, "status");
  _todoList->addColumn(tr("Start Date"),_dateColumn,  Qt::AlignLeft,   false, "start");
  _todoList->addColumn(tr("Due Date"),  _dateColumn,  Qt::AlignLeft,   true, "due");
  _todoList->addColumn(tr("Parent#"),  _orderColumn,  Qt::AlignLeft,   true, "number");
  _todoList->addColumn(tr("Customer#"),_orderColumn,  Qt::AlignLeft,   false, "cust");
  _todoList->addColumn(tr("Account#"), _orderColumn,  Qt::AlignLeft,   false, "crmacct_number");
  _todoList->addColumn(tr("Account Name"),      100,  Qt::AlignLeft,   true, "crmacct_name");
  _todoList->addColumn(tr("Owner"),     _userColumn,  Qt::AlignLeft,   false,"owner");

  int menuItem;
  QMenu * todoMenu = new QMenu;
  menuItem = todoMenu->insertItem(tr("Incident"), this, SLOT(sNewIncdt()));
  if (!_privileges->check("MaintainIncidents"))
    todoMenu->setItemEnabled(menuItem, FALSE);
  menuItem = todoMenu->insertItem(tr("To-Do Item"),   this, SLOT(sNew()));
  if (!_privileges->check("MaintainPersonalTodoList") &&
      !_privileges->check("MaintainOtherTodoLists"))
    todoMenu->setItemEnabled(menuItem, FALSE);
  _new->setMenu(todoMenu);

  if (_preferences->boolean("XCheckBox/forgetful"))
    _incidents->setChecked(true);

  handlePrivs();
  sHandleAutoUpdate(_autoUpdate->isChecked());
}
Esempio n. 3
0
void QucsHelp::setupActions()
{
  QToolBar *toolbar = new QToolBar(this,"main_toolbar");

  this->addToolBar(toolbar);

  QMenuBar *bar = menuBar();

  const QKeySequence ks = QKeySequence();

  QAction *quitAction = new QAction(QIcon((":/bitmaps/quit.png")),
                                    tr("&Quit"), (const QKeySequence&)Qt::CTRL+Qt::Key_Q, this,"");
  QAction *backAction = new QAction(QIcon((":/bitmaps/back.png")),
                                    tr("&Back"), Qt::ALT+Qt::Key_Left, this,"");
  QAction *forwardAction = new QAction(QIcon((":/bitmaps/forward.png")),
                                       tr("&Forward"), Qt::ALT+Qt::Key_Right, this,"");
  QAction *homeAction = new QAction(QIcon((":/bitmaps/home.png")),
                                    tr("&Home"),Qt::CTRL+Qt::Key_H,this,"");
  previousAction = new QAction(QIcon((":/bitmaps/previous.png")),tr("&Previous"),
                               ks, this,"");
  nextAction = new QAction(QIcon((":/bitmaps/next.png")),
                           tr("&Next"), ks, this,"");
  viewBrowseDock = new QAction(tr("&Table of Contents"), 0, this,"");
  viewBrowseDock->setToggleAction(true);
  viewBrowseDock->setOn(true);
  viewBrowseDock->setStatusTip(tr("Enables/disables the table of contents"));
  viewBrowseDock->setWhatsThis(tr("Table of Contents\n\nEnables/disables the table of contents"));

  connect(quitAction,SIGNAL(activated()),qApp,SLOT(quit()));

  connect(backAction,SIGNAL(activated()),textBrowser,SLOT(backward()));
  connect(textBrowser,SIGNAL(backwardAvailable(bool)),backAction,SLOT(setEnabled(bool)));

  connect(forwardAction,SIGNAL(activated()),textBrowser,SLOT(forward()));
  connect(textBrowser,SIGNAL(forwardAvailable(bool)),forwardAction,SLOT(setEnabled(bool)));

  connect(homeAction,SIGNAL(activated()),textBrowser,SLOT(home()));
  connect(homeAction,SIGNAL(activated()),this,SLOT(gohome()));

  connect(textBrowser,SIGNAL(sourceChanged(const QUrl &)),this,SLOT(slotSourceChanged(const QUrl &)));
  connect(previousAction,SIGNAL(activated()),this,SLOT(previousLink()));
  connect(nextAction,SIGNAL(activated()),this,SLOT(nextLink()));
  connect(viewBrowseDock, SIGNAL(toggled(bool)), SLOT(slotToggleSidebar(bool)));

  backAction->addTo(toolbar);
  forwardAction->addTo(toolbar);
  toolbar->addSeparator();
  homeAction->addTo(toolbar);
  previousAction->addTo(toolbar);
  nextAction->addTo(toolbar);
  toolbar->addSeparator();
  quitAction->addTo(toolbar);

  QMenu *fileMenu = new QMenu(this);
  quitAction->addTo(fileMenu);

  QMenu *viewMenu = new QMenu(this);
  backAction->addTo(viewMenu);
  forwardAction->addTo(viewMenu);
  homeAction->addTo(viewMenu);
  previousAction->addTo(viewMenu);
  nextAction->addTo(viewMenu);
  viewMenu->insertSeparator();
  viewBrowseDock->addTo(viewMenu);

  QMenu *helpMenu = new QMenu(this);
  helpMenu->insertItem(tr("&About Qt"),qApp,SLOT(aboutQt()));

  bar->insertItem(tr("&File"), fileMenu );
  bar->insertItem(tr("&View"),viewMenu);
  bar->insertSeparator();
  bar->insertItem(tr("&Help"),helpMenu);
}
Esempio n. 4
0
void dspCashReceipts::sHandleButtons(bool valid)
{      
  int menuItem = -1;
  QMenu * editMenu = new QMenu;
  QMenu * viewMenu = new QMenu;   

  _reverse->setVisible(!_applications->isChecked());

  if (valid && _arapply->id() > -1)
  {
    // Handle Edit Button
    // Cash Receipt
    if (_arapply->currentItem()->rawValue("voided").toBool())
    {
      _post->hide();
      _reverse->hide();
    }
    else if (!_arapply->currentItem()->rawValue("posted").toBool())
    {
      editMenu->insertItem(tr("Cash Receipt..."), this, SLOT(sEditCashrcpt()), 0);
      editMenu->setItemEnabled(menuItem, _privileges->check("MaintainCashReceipts"));
        
      _post->show();
      _reverse->setVisible(!_applications->isChecked());
      _reverse->setEnabled(false);
      _post->setEnabled(_privileges->check("PostCashReceipts"));
    }
    else
    {
      _post->show();
      _reverse->setVisible(!_applications->isChecked());
      _post->setEnabled(false);
      _reverse->setEnabled(_privileges->check("ReversePostedCashReceipt")
                           && _cashreceipts->isChecked()
                           && !_arapply->altId());
    } 
        
    if (_arapply->currentItem()->id("target") > -1)
    {
      editMenu->insertItem(tr("Receivable Item..."), this, SLOT(sEditAropen()), 0);
      editMenu->setItemEnabled(menuItem, _privileges->check("EditAROpenItem"));
    }
    
    // Handle View Button
    // Cash Receipt             
    viewMenu->insertItem(tr("Cash Receipt..."), this, SLOT(sViewCashrcpt()), 0);
    viewMenu->setItemEnabled(menuItem, _privileges->check("ViewCashReceipts") || _privileges->check("MaintainCashReceipts"));
   
    // Open Item
    if (_arapply->currentItem()->id("target") > -1)
    {
      viewMenu->insertItem(tr("Receivable Item..."), this, SLOT(sViewAropen()), 0);
      viewMenu->setItemEnabled(menuItem, _privileges->check("ViewAROpenItems") || _privileges->check("EditAROpenItem"));
    }   
    
    _edit->setMenu(editMenu);
    _edit->setEnabled(!editMenu->isEmpty());
    _view->setMenu(viewMenu);
    _view->setEnabled(!viewMenu->isEmpty());
  }
  else
  {
    _edit->setEnabled(false);
    _view->setEnabled(false);
    _post->setEnabled(false);
    _reverse->setEnabled(false);
  }
}
Esempio n. 5
0
todoList::todoList(QWidget* parent, const char* name, Qt::WFlags fl)
    : XWidget(parent, name, fl)
{
  setupUi(this);

  _crmAccount->hide();
  _dueDates->setStartNull(tr("Earliest"), omfgThis->startOfTime(), TRUE);
  _dueDates->setEndNull(tr("Latest"),	  omfgThis->endOfTime(),   TRUE);
  _startDates->setStartNull(tr("Earliest"), omfgThis->startOfTime(), TRUE);
  _startDates->setEndNull(tr("Latest"),	  omfgThis->endOfTime(),   TRUE);

  _usrGroup->setEnabled(_privileges->check("MaintainOtherTodoLists"));
  q.exec("SELECT current_user;");
  if (q.first())
    _usr->setUsername(q.value("current_user").toString());
  else if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    close();
  }

  connect(_autoUpdate,	SIGNAL(toggled(bool)),	this,	SLOT(sHandleAutoUpdate(bool)));
  connect(_close,	SIGNAL(clicked()),	this,	SLOT(sClose()));
  connect(_completed,	SIGNAL(toggled(bool)),	this,	SLOT(sFillList()));
  connect(_delete,	SIGNAL(clicked()),	this,	SLOT(sDelete()));
  connect(_dueDates,	SIGNAL(updated()),	this,   SLOT(sFillList()));
  connect(_startDates,	SIGNAL(updated()),	this,   SLOT(sFillList()));
  connect(_todolist,    SIGNAL(toggled(bool)),  this,   SLOT(sFillList()));
  connect(_incidents,	SIGNAL(toggled(bool)),	this,	SLOT(sFillList()));
  connect(_projects,	SIGNAL(toggled(bool)),	this,	SLOT(sFillList()));
  connect(_new,		SIGNAL(clicked()),	this,	SLOT(sNew()));
  connect(_print,	SIGNAL(clicked()),	this,	SLOT(sPrint()));
  connect(_todoList,	SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));
  connect(_todoList,	SIGNAL(populateMenu(QMenu*, QTreeWidgetItem*, int)),
	    this,	SLOT(sPopulateMenu(QMenu*)));
  connect(_todoList,	SIGNAL(itemSelectionChanged()),	this,	SLOT(handlePrivs()));
  connect(_all,		SIGNAL(clicked()),	this,	SLOT(sFillList()));
  connect(_all,		SIGNAL(clicked()),	this,	SLOT(handlePrivs()));
  connect(_selected,	SIGNAL(clicked()),	this,	SLOT(sFillList()));
  connect(_selected,	SIGNAL(clicked()),	this,	SLOT(handlePrivs()));
  connect(_usr,		SIGNAL(newId(int)),	this,	SLOT(sFillList()));
  connect(_usr,		SIGNAL(newId(int)),	this,	SLOT(handlePrivs()));
  connect(_pattern,	SIGNAL(editingFinished()),	this,	SLOT(sFillList()));
  connect(_pattern,	SIGNAL(editingFinished()),	this,	SLOT(handlePrivs()));
  connect(_edit,	SIGNAL(clicked()),	this,	SLOT(sEdit()));
  connect(_view,	SIGNAL(clicked()),	this,	SLOT(sView()));
  connect(_duedateGroup, SIGNAL(toggled(bool)), this, SLOT(sFillList()));
  connect(_startdateGroup, SIGNAL(toggled(bool)), this, SLOT(sFillList()));
  connect(_assignedTo, SIGNAL(toggled(bool)), this, SLOT(sFillList()));
  connect(_ownedBy, SIGNAL(toggled(bool)), this, SLOT(sFillList()));

  _todoList->addColumn(tr("Type"),      _userColumn,  Qt::AlignCenter, true, "type");
  _todoList->addColumn(tr("Seq"),        _seqColumn,  Qt::AlignRight,  false, "seq");
  _todoList->addColumn(tr("Priority"),  _userColumn,  Qt::AlignLeft,   true, "priority");
  _todoList->addColumn(tr("Assigned To"),_userColumn,  Qt::AlignLeft,   true, "usr");
  _todoList->addColumn(tr("Name"),              100,  Qt::AlignLeft,   true, "name");
  _todoList->addColumn(tr("Description"),        -1,  Qt::AlignLeft,   true, "descrip");
  _todoList->addColumn(tr("Status"),  _statusColumn,  Qt::AlignLeft,   true, "status");
  _todoList->addColumn(tr("Start Date"),_dateColumn,  Qt::AlignLeft,   false, "start");
  _todoList->addColumn(tr("Due Date"),  _dateColumn,  Qt::AlignLeft,   true, "due");
  _todoList->addColumn(tr("Parent#"),  _orderColumn,  Qt::AlignLeft,   true, "number");
  _todoList->addColumn(tr("Customer#"),_orderColumn,  Qt::AlignLeft,   false, "cust");
  _todoList->addColumn(tr("Account#"), _orderColumn,  Qt::AlignLeft,   false, "crmacct_number");
  _todoList->addColumn(tr("Account Name"),      100,  Qt::AlignLeft,   true, "crmacct_name");
  _todoList->addColumn(tr("Owner"),     _userColumn,  Qt::AlignLeft,   false,"owner");

  int menuItem;
  QMenu * todoMenu = new QMenu;
  menuItem = todoMenu->insertItem(tr("Incident"), this, SLOT(sNewIncdt()));
  if (!_privileges->check("MaintainIncidents"))
    todoMenu->setItemEnabled(menuItem, FALSE);
  menuItem = todoMenu->insertItem(tr("To-Do Item"),   this, SLOT(sNew()));
  if (!_privileges->check("MaintainPersonalTodoList") &&
      !_privileges->check("MaintainOtherTodoLists"))
    todoMenu->setItemEnabled(menuItem, FALSE);
  _new->setMenu(todoMenu);

  if (_preferences->boolean("XCheckBox/forgetful"))
    _incidents->setChecked(true);

  handlePrivs();
  sHandleAutoUpdate(_autoUpdate->isChecked());
}
ossimQtSingleImageWindow::ossimQtSingleImageWindow(QWidget* parent,
        const char* name,
        Qt::WFlags f)
    : QMainWindow(parent, name, f),
      ossimConnectableObject(),
      ossimConnectableDisplayListener(),
      theImageWidget(0),
      theLastOpenedDirectory(),
      theResolutionLevelMenu(0)
{
    ossimReferenced::ref();
    setCaption("iview");

    QSize size(DEFAULT_WIDTH, DEFAULT_HEIGHT);
    setBaseSize(size);

    // This set the window's widget size.
    setGeometry(0,0,DEFAULT_WIDTH-1,DEFAULT_HEIGHT-1);

    // Create the image widget parenting it to this.
    theImageWidget = new ossimQtScrollingImageWidget(this, "image_widget");

    // This will clear out any initial garbage in the widget.
    theImageWidget->refresh();

    // Disable random caching scheme.
    theImageWidget->setRandomPriorityQueueEnabledFlag(false);

    // Set the the width and height of the window.
    theImageWidget->resize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    // Make the image widget the centralized widget.
    setCentralWidget(theImageWidget);

    // Make the "File" pull down menu.
    QMenu* file = new QMenu( this );
    menuBar()->insertItem( "&File", file );
    file->insertItem( "&Open Image",  this, SLOT(openImage()), Qt::CTRL+Qt::Key_O );
    file->insertItem( "&Close Image",  this, SLOT(closeImage()), Qt::CTRL+Qt::Key_C );
    file->insertItem( "&Export",  this, SLOT(exportImage()), Qt::CTRL+Qt::Key_E );
    file->insertItem( "&Quit",  this, SLOT(closeWindow()), Qt::CTRL+Qt::Key_Q );

    // Make the "Edit" pull down menu.
    QMenu* edit = new QMenu( this );
    menuBar()->insertItem( "&Edit", edit );
    edit->insertItem( "Image Chain",  this, SLOT(editImageChain()));

    // Make the "Utilities" pull down menu.
    QMenu* utilities = new QMenu( this );
    menuBar()->insertItem( "&Utilities", utilities );
    utilities->insertItem( "Refresh",  this, SLOT(refreshDisplay()));

    // Make the "Resolution_Level" pull down menu.
    theResolutionLevelMenu = new QMenu( this );
    menuBar()->insertItem( "&Resolution_Level",  theResolutionLevelMenu);

    QAction* rsetAct = new QAction(QString("0"), this);
    rsetAct->setCheckable(true);
    rsetAct->setChecked(true);
    rsetAct->setData(0);
    rsetAct->setEnabled(false);

    theResolutionLevelMenu->addAction( rsetAct );

    // Connect the activated signal to the changeResolutionLevel slot.
    connect( theResolutionLevelMenu, SIGNAL( triggered( QAction * ) ),
             this, SLOT ( changeResolutionLevel( QAction * ) ) );

    // Make the "Help" pull down menu.
    QMenu* help = new QMenu( this );
    menuBar()->insertItem( "&Help", help );
    help->insertItem( "&About",  this, SLOT(about()), Qt::CTRL+Qt::Key_A );

    // Connect up the slot to capture mouse events.
    connect(theImageWidget,
            SIGNAL(scrollingImageWidgetMouseEvent(ossimQtMouseEvent*)),
            this,
            SLOT(trackImageWidget(ossimQtMouseEvent*)));

    // Add us in as a listener for display events like refresh.
    addListener((ossimConnectableDisplayListener*)this);

    //---
    // Connect this display up to "theImageWidget" so that event propagation
    // comes up the chain to us.
    //---
    connectMyInputTo(theImageWidget);

    // Send a dummy message to make the status bar show.
    statusBar()->message( QString(" ") );

    //---
    // Set the last open directory to the current working dir so the open image
    // dialog will come up where you started.
    //---
    theLastOpenedDirectory = getenv("PWD");
}
Esempio n. 7
0
HelpWindow::HelpWindow( const QString& home_, const QString& _path,
  QWidget* parent, const char *name) :
  Q3MainWindow( parent, name, Qt::WDestructiveClose ),
  pathCombo( 0 ), selectedURL()
{
  DigitDebug::ctor(QString("helpwindow " + QString::number((ulong) this, 16)));
  
  readHistory();
  readBookmarks();

  browser = new Q3TextBrowser( this );
  CHECK_PTR_ENGAUGE(browser);

  browser->mimeSourceFactory()->setFilePath( _path );
  browser->setFrameStyle( Q3Frame::Panel | Q3Frame::Sunken );
  connect( browser, SIGNAL( textChanged() ),
    this, SLOT( textChanged() ) );

  setCentralWidget( browser );

  if ( !home_.isEmpty() )
    browser->setSource( home_ );

  connect( browser, SIGNAL( highlighted( const QString&) ),
    statusBar(), SLOT( message( const QString&)) );

  // display help window in previous position with same size
  DefaultSettings& rSettings = DefaultSettings::instance();
  move(rSettings.getWindowHelpPosition());
  resize(rSettings.getWindowHelpSize());

  QMenu* file = new QMenu( this );
  CHECK_PTR_ENGAUGE(file);
  file->insertItem( tr("&Open File"), this, SLOT( openFile() ), Qt::CTRL+Qt::Key_O );
  file->insertItem( tr("&Print"), this, SLOT( print() ), Qt::CTRL+Qt::Key_P );
  file->insertSeparator();
  file->insertItem( tr("&Close"), this, SLOT( close() ), Qt::CTRL+Qt::Key_Q );
//file->insertItem( tr("E&xit"), qApp, SLOT( closeAllWindows() ), Qt::CTRL+Qt::Key_X );

  // The same three icons are used twice each.
  QPixmap helpback (helpback_xpm);
  QPixmap helpforward (helpforward_xpm);
  QPixmap helphome (helphome_xpm);
  
  QIcon icon_back (helpback);
  QIcon icon_forward (helpforward);
  QIcon icon_home (helphome);

  QMenu* go = new QMenu( this );
  CHECK_PTR_ENGAUGE(go);
  backwardId = go->insertItem( icon_back,
    tr("&Backward"), browser, SLOT( backward() ),
    Qt::CTRL+Qt::Key_Left );
  forwardId = go->insertItem( icon_forward,
    tr("&Forward"), browser, SLOT( forward() ),
    Qt::CTRL+Qt::Key_Right );
  go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) );

  hist = new QMenu( this );
  CHECK_PTR_ENGAUGE(hist);
  QStringList::Iterator it = history.begin();
  for ( ; it != history.end(); ++it )
    mHistory[ hist->insertItem( *it ) ] = *it;
    connect( hist, SIGNAL( activated( int ) ),
    this, SLOT( histChosen( int ) ) );

  bookm = new QMenu( this );
  CHECK_PTR_ENGAUGE(bookm);
  bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) );
  bookm->insertSeparator();

  QStringList::Iterator it2 = bookmarks.begin();
  for ( ; it2 != bookmarks.end(); ++it2 )
    mBookmarks[ bookm->insertItem( *it2 ) ] = *it2;
  connect( bookm, SIGNAL( activated( int ) ),
    this, SLOT( bookmChosen( int ) ) );

  menuBar()->insertItem( tr("&File"), file );
  menuBar()->insertItem( tr("&Go"), go );
  menuBar()->insertItem( tr( "History" ), hist );
  menuBar()->insertItem( tr( "Bookmarks" ), bookm );

  menuBar()->setItemEnabled( forwardId, FALSE);
  menuBar()->setItemEnabled( backwardId, FALSE);
  connect( browser, SIGNAL( backwardAvailable( bool ) ),
    this, SLOT( setBackwardAvailable( bool ) ) );
  connect( browser, SIGNAL( forwardAvailable( bool ) ),
    this, SLOT( setForwardAvailable( bool ) ) );

  Q3ToolBar* toolbar = new Q3ToolBar( this );
  CHECK_PTR_ENGAUGE(toolbar);
  addToolBar( toolbar, "Toolbar");
  QToolButton* button;

  button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar );
  CHECK_PTR_ENGAUGE(button);
  connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
  button->setEnabled( FALSE );
  button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar );
  CHECK_PTR_ENGAUGE(button);
  connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
  button->setEnabled( FALSE );
  button = new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar );
  CHECK_PTR_ENGAUGE(button);

  toolbar->addSeparator();

  pathCombo = new QComboBox( TRUE, toolbar );
  CHECK_PTR_ENGAUGE(pathCombo);
  connect( pathCombo, SIGNAL( activated( const QString & ) ),
    this, SLOT( pathSelected( const QString & ) ) );
  toolbar->setStretchableWidget( pathCombo );
  setRightJustification( TRUE );
  setDockEnabled( Qt::DockLeft, FALSE );
  setDockEnabled( Qt::DockRight, FALSE );

  pathCombo->insertItem( home_ );
  browser->setFocus();
}
Esempio n. 8
0
SingleAlignmentView::SingleAlignmentView(Root::Agent * a, Spec::FragmentAssignment* ass ):
	QWidget( 0 ), d_threshold( 0 ), d_parent( a )
{
	setAttribute(Qt::WA_DeleteOnClose);
	assert( a );
	QVBoxLayout* vbox = new QVBoxLayout(this);
	vbox->setMargin( 1 );
	vbox->setSpacing( 1 );
	QHBoxLayout* hbox = new QHBoxLayout();
	hbox->setMargin( 0 );
	hbox->setSpacing( 0 );

	d_edit = new QSpinBox( 0, 100, 1, this );
	d_list = new _SingleAlignmentList( this );
	d_list->setAllColumnsShowFocus( true );
	d_list->setShowSortIndicator( true );
	d_list->setRootIsDecorated( false );
	d_list->addColumn( "Sequence/Fragment" );
	d_list->addColumn( "Fitness" );
	d_list->addColumn( "Assigned" );
	d_list->setItemDelegate( new _SingleAlignmentViewDeleg( d_list ) );
	d_list->setUniformRowHeights( true );
	d_list->setItemsExpandable( false );
	d_list->header()->setStretchLastSection( false );
	d_list->header()->setMovable( false );

	g_textWidth = d_list->fontMetrics().width( "(W000)" );	// RISK
	if( ass->getMatchCount() > 0 )
	{
		ass->getMatch(0).d_start->formatLabel( s_buf, sizeof(s_buf) );
		int w = d_list->fontMetrics().width( s_buf );
		if( w > g_textWidth )
			g_textWidth = w + w * 0.5;
	}
	
	d_label = new QLabel( this );
	d_label->setFrameStyle( QFrame::WinPanel | QFrame::Sunken );

	hbox->addWidget( d_label );
	QLabel* lbl = new QLabel( "Threshold:", this );
	lbl->setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
	hbox->addWidget( lbl );

	hbox->addWidget( d_edit );
	vbox->addLayout( hbox );
	d_header = 0;
	if( ass )
	{
		d_header = new _FragViewImp( this, d_label->minimumHeight(), ass->getFragment() );
		vbox->addWidget( d_header );
	}
	vbox->addWidget( d_list );

	d_ass = ass;
	load();

	d_list->setSorting( 1, false );

	QString str = "Fragment Alignment";
	if( ass )
		str.sprintf( "Fragment Alignment: #%d - #%d", 
		ass->getFragment().front()->getId(), ass->getFragment().back()->getId() );
	setCaption( str );

    d_list->header()->setResizeMode( 0, QHeaderView::Fixed );
    d_list->setColumnWidth(0, d_header->sizeHint().width() );
    d_list->resizeColumnToContents( 1 );
    d_list->resizeColumnToContents( 2 );

	connect( d_edit, SIGNAL( valueChanged ( int ) ), this, SLOT( handleValueChanged ( int ) ) );

	QMenu* pop = new Gui::Menu( d_list, true ); 
	pop->insertItem( "Assign", this, SLOT( handleAssign() ) );
	d_geom = new QAction( this ); 
	d_geom->setCheckable( true );
	d_geom->setText( "Geometric Mapping" );
	d_geom->setOn( true );
	connect( d_geom, SIGNAL( toggled ( bool ) ), this, SLOT( handleGeom(bool) ) );
	d_geom->addTo( pop );
	d_exp = new QAction( this ); 
	d_exp->setText( "Use Neighbours" );
	d_exp->setCheckable( true );
	d_exp->setOn( true );
	connect( d_exp, SIGNAL( toggled ( bool ) ), this, SLOT( handleExp(bool) ) );
	d_exp->addTo( pop );
	d_strict = new QAction( this ); 
	d_strict->setText( "Drop Zero-Peaks" );
	d_strict->setCheckable( true );
	d_strict->setOn( true );
	connect( d_strict, SIGNAL( toggled ( bool ) ), this, SLOT( handleStrict(bool) ) );
	d_strict->addTo( pop );
	pop->insertItem( "Update", this, SLOT( handleUpdate() ) );
}