Example #1
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    _ui(new Ui::MainWindow),
    _settings(),
    _model(), // Don't give it the window as parent since the destructor will destroy it anyway
    _actualFile()
{
    _ui->setupUi(this);

#ifdef Q_OS_MAC
    _ui->mainToolBar->setMovable(false);
    _ui->mainToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    _ui->statusBar->setSizeGripEnabled(false);
#endif

    _ui->testsTree->setModel(&_model);
    _ui->testsTree->setSelectionMode(QTreeView::SingleSelection);
    _ui->testsTree->setSelectionBehavior(QTreeView::SelectRows);
    _ui->testsTree->header()->resizeSection(0, 250);
    _ui->testsTree->header()->setStretchLastSection(false);
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
    _ui->testsTree->header()->setSectionResizeMode(0, QHeaderView::Stretch);
#else
    _ui->testsTree->header()->setResizeMode(0, QHeaderView::Stretch);
#endif

    // Setup splitter
    _ui->splitter->setStretchFactor(0, 1);
    _ui->splitter->setStretchFactor(1, 0);

    // Connect Widget & Action signals
    connect(_ui->testsTree->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
            this, SLOT(testsTree_selectionChanged(QItemSelection,QItemSelection)));

    connect(_ui->actionQuit, SIGNAL(triggered()), AppInstance, SLOT(CloseAndQuit()));
    connect(_ui->actionReport_a_bug, SIGNAL(triggered()), AppInstance, SLOT(ReportABug()));

    connect(_ui->actionRun_selected, SIGNAL(triggered()), &_model, SLOT(execute()));
    connect(_ui->actionTerminate, SIGNAL(triggered()), &_model, SLOT(terminate()));
    connect(_ui->actionShuffle_tests, SIGNAL(toggled(bool)), &_model, SLOT(setShuffle(bool)));
    connect(_ui->actionSelect_All, SIGNAL(triggered()), &_model, SLOT(selectAll()));
    connect(_ui->actionDeselect_All, SIGNAL(triggered()), &_model, SLOT(deselectAll()));
    connect(_ui->actionInvert_selection, SIGNAL(triggered()), &_model, SLOT(invertSelection()));

    // Connect Model signals
    connect(&_model, SIGNAL(changed()), this, SLOT(updateTitle()));
    connect(&_model, SIGNAL(executionStateChanged(bool)), this, SLOT(model_executionStateChanged(bool)));
    connect(&_model, SIGNAL(progressUpdated(int)), this, SLOT(model_progressUpdated(int)));
    connect(&_model, SIGNAL(testStarted(QString)), this, SLOT(model_testStarted(QString)));

    // Restore geometry
    restoreGeometry(_settings.value(SETTINGS_WINDOW_GEOMETRY).toByteArray());
    restoreState(_settings.value(SETTINGS_WINDOW_STATE).toByteArray());

    _ui->splitter->restoreState(_settings.value(SETTINGS_SPLITTER_STATE).toByteArray());

    _ui->testsTree->header()->restoreState(_settings.value(SETTINGS_TREEHEADER_STATE).toByteArray());

    Clean();
}
Example #2
0
/*
 *  Constructs a maintainBudget as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 */
maintainBudget::maintainBudget(QWidget* parent, const char* name, Qt::WFlags fl)
    : QMainWindow(parent, name, fl)
{
  setupUi(this);

  (void)statusBar();

  // signals and slots connections
  connect(_accountsAdd, SIGNAL(clicked()), this, SLOT(sAccountsAdd()));
  connect(_accountsDown, SIGNAL(clicked()), this, SLOT(sAccountsMoveDown()));
  connect(_accountsRemove, SIGNAL(clicked()), this, SLOT(sAccountsRemove()));
  connect(_accountsUp, SIGNAL(clicked()), this, SLOT(sAccountsMoveUp()));
  connect(_close, SIGNAL(clicked()), this, SLOT(close()));
  connect(_generate, SIGNAL(clicked()), this, SLOT(sGenerateTable()));
  connect(_save, SIGNAL(clicked()), this, SLOT(sSave()));
  connect(_print, SIGNAL(clicked()), this, SLOT(sPrint()));
  connect(_table, SIGNAL(valueChanged(int,int)), this, SLOT(sValueChanged(int,int)));
  connect(_periodsAll, SIGNAL(clicked()), this, SLOT(sPeriodsAll()));
  connect(_periodsInvert, SIGNAL(clicked()), _periods, SLOT(invertSelection()));
  connect(_periodsNone, SIGNAL(clicked()), _periods, SLOT(clearSelection()));

  _dirty = false;
  _budgheadid = -1;
  _mode = cNew;
  
  // populate _periods
  q.exec("SELECT period_id, (formatDate(period_start) || '-' || formatDate(period_end)) AS f_name "
         "  FROM period "
         "ORDER BY period_start DESC;" );
  while(q.next())
  {
    XListBoxText *item = new XListBoxText(q.value("f_name").toString(), q.value("period_id").toInt());
    _periods->insertItem(item);
  }
}
Example #3
0
    SelectionMode::SelectionMode(CSVWidget::SceneToolbar* parent, WorldspaceWidget& worldspaceWidget,
        unsigned int interactionMask)
        : SceneToolMode(parent, "Selection mode")
        , mWorldspaceWidget(worldspaceWidget)
        , mInteractionMask(interactionMask)
    {
        addButton(":placeholder", "cube-centre",
            "Centred cube"
            "<ul><li>Drag with primary (make instances the selection) or secondary (invert selection state) select button from the centre of the selection cube outwards</li>"
            "<li>The selection cube is aligned to the word space axis</li>"
            "<li>If context selection mode is enabled, a drag with primary/secondary edit not starting on an instance will have the same effect</li>"
            "</ul>"
            "<font color=Red>Not implemented yet</font color>");
        addButton(":placeholder", "cube-corner",
            "Cube corner to corner"
            "<ul><li>Drag with primary (make instances the selection) or secondary (invert selection state) select button from one corner of the selection cube to the opposite corner</li>"
            "<li>The selection cube is aligned to the word space axis</li>"
            "<li>If context selection mode is enabled, a drag with primary/secondary edit not starting on an instance will have the same effect</li>"
            "</ul>"
            "<font color=Red>Not implemented yet</font color>");
        addButton(":placeholder", "sphere",
            "Centred sphere"
            "<ul><li>Drag with primary (make instances the selection) or secondary (invert selection state) select button from the centre of the selection sphere outwards</li>"
            "<li>If context selection mode is enabled, a drag with primary/secondary edit not starting on an instance will have the same effect</li>"
            "</ul>"
            "<font color=Red>Not implemented yet</font color>");

        mSelectAll = new QAction("Select all", this);
        mDeselectAll = new QAction("Clear selection", this);
        mInvertSelection = new QAction("Invert selection", this);

        connect(mSelectAll, SIGNAL(triggered()), this, SLOT(selectAll()));
        connect(mDeselectAll, SIGNAL(triggered()), this, SLOT(clearSelection()));
        connect(mInvertSelection, SIGNAL(triggered()), this, SLOT(invertSelection()));
    }
Example #4
0
Kfind::Kfind( QWidget *parent, const char *name, const char *searchPath )
    : QWidget( parent, name )
  {
    // init IO buffer
    iBuffer = 0;

    //create tabdialog
    tabDialog = new KfindTabDialog(this,"dialog",searchPath);

    //prepare window for find results
    win = new KfindWindow(this,"window");
    win->hide();  //and hide it firstly    
    winsize=1;

    connect(win ,SIGNAL(resultSelected(bool)),
	    this,SIGNAL(resultSelected(bool)));
    connect(win ,SIGNAL(statusChanged(const char *)),
	    this,SIGNAL(statusChanged(const char *)));
    connect(this,SIGNAL(deleteFile()),
	    win,SLOT(deleteFiles()));
    connect(this,SIGNAL(properties()),
	    win,SLOT(fileProperties()));
    connect(this,SIGNAL(openFolder()),
	    win,SLOT(openFolder()));
    connect(this,SIGNAL(saveResults()),
	    win,SLOT(saveResults()));
    connect(this,SIGNAL(addToArchive()),
	    win,SLOT(addToArchive()));
    connect(this,SIGNAL(open()),
	    win,SLOT(openBinding()));
    connect(parentWidget(),SIGNAL(selectAll()),
	    win,SLOT(selectAll()));
    connect(parentWidget(),SIGNAL(unselectAll()),
	    win,SLOT(unselectAll()));
    connect(parentWidget(),SIGNAL(invertSelection()),
	    win,SLOT(invertSelection()));
    connect(&findProcess,SIGNAL(processExited(KProcess *)),
	    this,SLOT(processResults()));
    connect(&findProcess,SIGNAL(receivedStdout(KProcess *, char *, int)), 
	    this, SLOT(handleStdout(KProcess *, char *, int))) ;
    
    resize(sizeHint());
    //emit haveResults(false); // we're not connectd to anything yet!?
  };
Example #5
0
KornSubjectsDlg::KornSubjectsDlg(QWidget *parent)
    : KDialogBase(parent, "urldialog", true, "test", Close, Close, true), _mailDrop(new QPtrList< KMailDrop >),
      _subjects(0), _delete(0), mailDlg(0), _canDeleteMaildrop(true)
{
    _loadSubjectsCanceled = false;
    setModal(true);

    // The dialog contains a list view and several buttons.
    // Two box layouts hol dthem.
    QWidget *page = new QWidget(this);
    setMainWidget(page);
    invertSelButton = new KPushButton(i18n("&Invert Selection"), page);
    clearSelButton = new KPushButton(i18n("&Remove Selection"), page);
    deleteButton = new KPushButton(i18n("&Delete"), page);
    showButton = new KPushButton(i18n("&Show"), page);
    deleteButton->setEnabled(false);
    showButton->setEnabled(false);
    QVBoxLayout *topLayout = new QVBoxLayout(page, 0, spacingHint());
    QHBoxLayout *buttons = new QHBoxLayout();
    _list = new KListView(page);
    topLayout->addWidget(_list, 10);
    topLayout->addLayout(buttons, 0);
    buttons->addWidget(invertSelButton, 0);
    buttons->addWidget(clearSelButton, 0);
    buttons->addWidget(deleteButton, 0);
    buttons->addWidget(showButton, 0);
    buttons->addStretch(10);

    // feed the list view with its colums
    _list->setSelectionMode(QListView::Multi);
    _list->addColumn(i18n("From"));
    _list->addColumn(i18n("Subject"));
    _list->addColumn(i18n("Date"));
    _list->addColumn(i18n("Size (Bytes)"));

    // column 3 contains a number (change alignment)
    _list->setColumnAlignment(3, Qt::AlignRight);
    _list->setItemMargin(3);

    // connect the selection changed and double click events of the list view
    connect(_list, SIGNAL(selectionChanged()), this, SLOT(listSelectionChanged()));
    connect(_list, SIGNAL(executed(QListViewItem *)), this, SLOT(doubleClicked(QListViewItem *)));

    // connect the buttons
    connect(invertSelButton, SIGNAL(clicked()), this, SLOT(invertSelection()));
    connect(clearSelButton, SIGNAL(clicked()), this, SLOT(removeSelection()));
    connect(showButton, SIGNAL(clicked()), this, SLOT(showMessage()));
    connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteMessage()));
    setInitialSize(QSize(QApplication::desktop()->width(), QApplication::desktop()->height()));
}
void
QvisRecentPathRemovalWindow::CreateWindowContents()
{
    // Create the widgets needed to remove the paths.
    removalControlsGroup = new QGroupBox(central);
    removalControlsGroup->setTitle(tr("Select paths to remove"));
    topLayout->addWidget(removalControlsGroup, 5);

    QVBoxLayout *innerTopLayout = new QVBoxLayout(removalControlsGroup);
    
    // Create the listbox that lets us select the paths to remove.
    removalListBox = new QListWidget(removalControlsGroup);
    removalListBox->setSelectionMode(QAbstractItemView::MultiSelection);
    innerTopLayout->addWidget(removalListBox);

    // Create the pushbuttons that actually call the removal routines.
    QHBoxLayout *hLayout = new QHBoxLayout();
    innerTopLayout->addLayout(hLayout);
    hLayout->setSpacing(5);
    removeButton = new QPushButton(tr("Remove"), removalControlsGroup);
    connect(removeButton, SIGNAL(clicked()),
            this, SLOT(removePaths()));
    hLayout->addWidget(removeButton);
    removeAllButton = new QPushButton(tr("Remove all"), removalControlsGroup);
    connect(removeAllButton, SIGNAL(clicked()),
            this, SLOT(removeAllPaths()));
    hLayout->addWidget(removeAllButton);
    invertSelectionButton = new QPushButton(tr("Invert selection"), removalControlsGroup);
    connect(invertSelectionButton, SIGNAL(clicked()),
            this, SLOT(invertSelection()));
    hLayout->addWidget(invertSelectionButton);    

    // Create the ok and cancel buttons.
    QHBoxLayout *buttonLayout = new QHBoxLayout();
    topLayout->addLayout(buttonLayout);
    buttonLayout->addStretch(10);
    okButton = new QPushButton(tr("Ok"), central);
    connect(okButton, SIGNAL(clicked()),
            this, SLOT(applyDismiss()));
    buttonLayout->addWidget(okButton);
    cancelButton = new QPushButton(tr("Cancel"), central);
    connect(cancelButton, SIGNAL(clicked()),
            this, SLOT(handleCancel()));
    buttonLayout->addWidget(cancelButton);
}
bool QListView::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: clear(); break;
    case 1: invertSelection(); break;
    case 2: selectAll((bool)static_QUType_bool.get(_o+1)); break;
    case 3: triggerUpdate(); break;
    case 4: setContentsPos((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break;
    case 5: adjustColumn((int)static_QUType_int.get(_o+1)); break;
    case 6: updateContents(); break;
    case 7: doAutoScroll(); break;
    case 8: changeSortColumn((int)static_QUType_int.get(_o+1)); break;
    case 9: handleIndexChange(); break;
    case 10: updateDirtyItems(); break;
    case 11: makeVisible(); break;
    case 12: handleSizeChange((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2),(int)static_QUType_int.get(_o+3)); break;
    case 13: startRename(); break;
    case 14: openFocusItem(); break;
    default:
	return QScrollView::qt_invoke( _id, _o );
    }
    return TRUE;
}
Example #8
0
void MainWindow::createMenus()
{
   QAction* action;
   QString  name;
   QMenu*   menu;
   QMenu*   subMenu;

   // ----- File Menu -----
   menu = menuBar()->addMenu("File");

      name = "About";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), this, SLOT(showAbout()));

      name = "New Molecule";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), &m_viewerModel, SLOT(newMoleculeMenu()));
      action->setShortcut(QKeySequence::New);

      name = "New Viewer";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), this, SLOT(newViewer()));

      name = "Open";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), this, SLOT(openFile()));
      action->setShortcut(QKeySequence::Open);

      name = "Open Recent";
      m_recentFilesMenu = menu->addMenu(name);
      updateRecentFilesMenu();

      menu->addSeparator();

/*
      name = "Parse Test File";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), this, SLOT(parseFile()));

      menu->addSeparator();
*/

      name = "Close Viewer";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), this, SLOT(close()));
      action->setShortcut(QKeySequence::Close);

      name = "Save";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), &m_viewerModel, SLOT(saveAll()));
      action->setShortcut(QKeySequence::Save);

      name = "Save As";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), &m_viewerModel, SLOT(saveAs()));
      action->setShortcut(Qt::SHIFT + Qt::CTRL + Qt::Key_S);

      menu->addSeparator();

      name = "Save Picture";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), &m_viewer, SLOT(saveSnapshot()));
      action->setShortcut(Qt::CTRL + Qt::Key_P);

      name = "Record Animation";
      action = menu->addAction(name);
      action->setCheckable(true);
      action->setChecked(false);
      connect(action, SIGNAL(triggered()), this, SLOT(toggleRecordingActive()));
      action->setShortcut(Qt::SHIFT + Qt::CTRL + Qt::Key_P);
      m_recordAnimationAction = action;

      name = "Show Message Log";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), this, SLOT(showLogMessages()));
      action->setShortcut(Qt::CTRL + Qt::Key_L);

      name = "Quit";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), this, SLOT(quit()));
      action->setShortcut(Qt::CTRL + Qt::Key_Q);


   // ----- Edit Menu -----
   menu = menuBar()->addMenu("Edit");
  
      name = "Undo";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), &m_undoStack, SLOT(undo()));
      action->setShortcut(QKeySequence::Undo);
      connect(&m_undoStack, SIGNAL(canUndoChanged(bool)), action, SLOT(setEnabled(bool)));

      name = "Redo";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), &m_undoStack, SLOT(redo()));
      action->setShortcut(QKeySequence::Redo);
      connect(&m_undoStack, SIGNAL(canRedoChanged(bool)), action, SLOT(setEnabled(bool)));

      menu->addSeparator();

      name = "Cut";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), &m_viewerModel, SLOT(cutSelection()));
      action->setShortcut(Qt::CTRL + Qt::Key_X);

      name = "Copy";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), &m_viewerModel, SLOT(copySelectionToClipboard()));
      action->setShortcut(Qt::CTRL + Qt::Key_C);

      name = "Paste";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), &m_viewerModel, SLOT(pasteSelectionFromClipboard()));
      action->setShortcut(Qt::CTRL + Qt::Key_V);

      menu->addSeparator();

      name = "Select All";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), &m_viewerModel, SLOT(selectAll()));
      action->setShortcut(Qt::CTRL + Qt::Key_A);

      name = "Select None";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), &m_viewerModel, SIGNAL(clearSelection()));
      action->setShortcut(Qt::SHIFT + Qt::CTRL + Qt::Key_A);

      name = "Invert Selection";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), &m_viewerModel, SLOT(invertSelection()));
      action->setShortcut(Qt::CTRL + Qt::Key_I);

      menu->addSeparator();

      name = "Reindex Atoms";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), this, SLOT(reindexAtoms()));


      menu->addSeparator();

      name = "Preferences";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), this, SLOT(showPreferences()));


   // ----- Display Menu -----
   menu = menuBar()->addMenu("Display");

      name = "Full Screen";
      action = menu->addAction(name);
      action->setCheckable(true);
      action->setChecked(false);
      connect(action, SIGNAL(triggered()), this, SLOT(fullScreen()));
      action->setShortcut(Qt::CTRL + Qt::Key_0);
      m_fullScreenAction = action;

      name = "Reset View";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), &m_viewer, SLOT(resetView()));
      action->setShortcut(Qt::CTRL + Qt::Key_R);

      name = "Show Axes";
      action = menu->addAction(name);
      action->setCheckable(true);
      action->setChecked(false);
      connect(action, SIGNAL(triggered()), &m_viewerModel, SLOT(toggleAxes()));
      connect(&m_viewerModel, SIGNAL(axesOn(bool)), action, SLOT(setChecked(bool)));
      action->setShortcut(Qt::Key_A);


      menu->addSeparator();

      name = "Atom Labels";
      subMenu = menu->addMenu(name);

         name = "Element";
         action = subMenu->addAction(name);
         connect(action, SIGNAL(triggered()), this, SLOT(setLabel()));
         action->setData(Layer::Atom::Element);
         action->setShortcut(Qt::Key_E);
         action->setCheckable(true);
         m_labelActions << action;

         name = "Index";
         action = subMenu->addAction(name);
         connect(action, SIGNAL(triggered()), this, SLOT(setLabel()));
         action->setData(Layer::Atom::Index);
         action->setShortcut(Qt::Key_I);
         action->setCheckable(true);
         m_labelActions << action;
   
         name = "Mass";
         action = subMenu->addAction(name);
         connect(action, SIGNAL(triggered()), this, SLOT(setLabel()));
         action->setData(Layer::Atom::Mass);
         action->setShortcut(Qt::Key_M);
         action->setCheckable(true);
         m_labelActions << action;

/*
         name = "NMR Shifts";
         action = subMenu->addAction(name);
         connect(action, SIGNAL(triggered()), this, SLOT(setLabel()));
         action->setData(Layer::Atom::NmrShifts);
         action->setShortcut(Qt::Key_N);
         action->setCheckable(true);
         m_labelActions << action;
*/

         name = "Partial Charge";
         action = subMenu->addAction(name);
         connect(action, SIGNAL(triggered()), this, SLOT(setLabel()));
         action->setData(Layer::Atom::Charge);
         action->setShortcut(Qt::Key_Q);
         action->setCheckable(true);
         m_labelActions << action;

         name = "Spin Densities";
         action = subMenu->addAction(name);
         connect(action, SIGNAL(triggered()), this, SLOT(setLabel()));
         action->setData(Layer::Atom::Spin);
         action->setShortcut(Qt::Key_S);
         action->setCheckable(true);
         m_labelActions << action;

   menu->addSeparator();

   name = "Configure Appearance";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), this, SLOT(configureAppearance()));


      // These are not working correctly at the moment.
/*
      name = "Partial Charge Type";
      QActionGroup* partialChargeGroup = new QActionGroup(this);
      subMenu = menu->addMenu(name);

         QString pc("Gasteiger");
         action = subMenu->addAction(pc);
         action->setCheckable(true);
         action->setChecked(true);
         action->setData(pc);
         partialChargeGroup->addAction(action);
         connect(action, SIGNAL(triggered()), this, SLOT(setPartialChargeType()));

         pc = "Sanderson";
         action = subMenu->addAction(pc);
         action->setCheckable(true);
         action->setData(pc);
         partialChargeGroup->addAction(action);
         connect(action, SIGNAL(triggered()), this, SLOT(setPartialChargeType()));

         pc = "Mulliken";
         action = subMenu->addAction(pc);
         action->setCheckable(true);
         action->setData(pc);
         partialChargeGroup->addAction(action);
         connect(action, SIGNAL(triggered()), this, SLOT(setPartialChargeType()));
*/



   // ----- Build Menu -----
   menu = menuBar()->addMenu("Build");

      name = "Fill Valencies With Hydrogens";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), &m_viewerModel, SLOT(addHydrogens()));
      action->setShortcut(Qt::CTRL + Qt::Key_F);

      name = "Reperceive Bonds";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), &m_viewerModel, SLOT(reperceiveBonds()));

      menu->addSeparator();

      name = "Set Constraint";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), &m_viewerModel, SLOT(setConstraint()));
      action->setShortcut(Qt::CTRL + Qt::Key_K);

      name = "Minimize Structure";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), &m_viewerModel, SLOT(minimizeEnergy()));
      action->setShortcut(Qt::CTRL + Qt::Key_M);

      name = "Select Force Field";

      QActionGroup* forceFieldGroup = new QActionGroup(this);
      subMenu = menu->addMenu(name);

         QString ff("MMFF94");
         action = subMenu->addAction(ff);
         action->setCheckable(true);
         action->setData(ff);
         forceFieldGroup->addAction(action);
         connect(action, SIGNAL(triggered()), this, SLOT(setForceField()));
         if (Preferences::DefaultForceField() == ff) action->setChecked(true);

         ff = "MMFF94s";
         action = subMenu->addAction(ff);
         action->setCheckable(true);
         action->setData(ff);
         forceFieldGroup->addAction(action);
         connect(action, SIGNAL(triggered()), this, SLOT(setForceField()));
         if (Preferences::DefaultForceField() == ff) action->setChecked(true);

         ff = "UFF";
         action = subMenu->addAction(ff);
         action->setCheckable(true);
         action->setData(ff);
         forceFieldGroup->addAction(action);
         connect(action, SIGNAL(triggered()), this, SLOT(setForceField()));
         if (Preferences::DefaultForceField() == ff) action->setChecked(true);

         ff = "Ghemical";
         action = subMenu->addAction(ff);
         action->setCheckable(true);
         action->setData(ff);
         forceFieldGroup->addAction(action);
         connect(action, SIGNAL(triggered()), this, SLOT(setForceField()));
         if (Preferences::DefaultForceField() == ff) action->setChecked(true);

         ff = "Gaff";
         action = subMenu->addAction(ff);
         action->setCheckable(true);
         action->setData(ff);
         forceFieldGroup->addAction(action);
         connect(action, SIGNAL(triggered()), this, SLOT(setForceField()));
         if (Preferences::DefaultForceField() == ff) action->setChecked(true);

      menu->addSeparator();

      name = "Translate To Center";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), &m_viewerModel, SLOT(translateToCenter()));
      action->setShortcut(Qt::CTRL + Qt::Key_T );

      name = "Symmetrize Molecule";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), &m_viewerModel, SLOT(symmetrize()));
      action->setShortcut(Qt::CTRL + Qt::Key_Y );

      name = "Set Symmetry Tolerance";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), &m_viewerModel, SLOT(adjustSymmetryTolerance()));

      name = "Auto-detect Symmetry";
      action = menu->addAction(name);
      action->setCheckable(true);
      action->setChecked(false);
      connect(action, SIGNAL(triggered()), &m_viewerModel, SLOT(toggleAutoDetectSymmetry()));



   // ----- Calculation Menu -----
   menu = menuBar()->addMenu("Calculation");

      name = "Q-Chem Setup";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), this, SLOT(openQChemUI()));
      action->setShortcut(Qt::CTRL + Qt::Key_U );
      m_qchemSetupAction = action;

      name = "Job Monitor";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), this, SLOT(showProcessMonitor()));
      action->setShortcut(Qt::CTRL + Qt::Key_J );

      menu->addSeparator();

      name = "Edit Servers";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), this, SLOT(editServers()));

      name = "Remove All Processes";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), 
         &(ProcessMonitor::instance()), SLOT(clearProcessList()));

      name = "Reset Password Vault Key";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), this, SLOT(setVaultPassword()));



   // ----- Help Menu -----
   menu = menuBar()->addMenu("Help");

      name = "Show Help";
      action = menu->addAction(name);
      connect(action, SIGNAL(triggered()), this, SLOT(showHelp()));
}
Example #9
0
void KfindTop::menuInit()
  {
    KStdAccel stdAccel;

    _fileMenu   = new QPopupMenu;
    _editMenu   = new QPopupMenu;
    _optionMenu = new QPopupMenu;
    _helpMenu   = new QPopupMenu;        

    fileStart = _fileMenu->insertItem(i18n("&Start search"), _kfind,
			      SLOT(startSearch()), stdAccel.find());
    fileStop = _fileMenu->insertItem(i18n("S&top search"), _kfind,
			      SLOT(stopSearch()), Key_Escape);    
    _fileMenu->setItemEnabled(fileStop, FALSE);
    _fileMenu->insertSeparator();

    openWithM  = _fileMenu->insertItem(i18n("&Open"),
				       this,SIGNAL(open()), stdAccel.open());
    toArchM    = _fileMenu->insertItem(i18n("&Add to archive"),
				       this,SIGNAL(addToArchive()));
    _fileMenu             ->insertSeparator();
    deleteM    = _fileMenu->insertItem(i18n("&Delete"),
				       this,SIGNAL(deleteFile()));
    propsM     = _fileMenu->insertItem(i18n("&Properties"),
				       this,SIGNAL(properties()));
    _fileMenu             ->insertSeparator();
    openFldrM  = _fileMenu->insertItem(i18n("Open Containing &Folder"),
				       this,SIGNAL(openFolder()));
    _fileMenu             ->insertSeparator();
    saveSearchM= _fileMenu->insertItem(i18n("&Save Search"),
				       this,SIGNAL(saveResults()),stdAccel.save());
    _fileMenu             ->insertSeparator();
    quitM      = _fileMenu->insertItem(i18n("&Quit"),qApp,
				       SLOT(quit()),stdAccel.quit());

    for(int i=openWithM;i>quitM;i--)
       _fileMenu->setItemEnabled(i,FALSE);  
   
    int undo =       _editMenu->insertItem(i18n("&Undo"),
					   this, SIGNAL(undo()), stdAccel.undo() );
    _editMenu                 ->insertSeparator();
    int cut  =       _editMenu->insertItem(i18n("&Cut"),
					   this, SIGNAL(cut()), stdAccel.cut() );
    editCopy =       _editMenu->insertItem(i18n("&Copy"),
					   this, SLOT(copySelection()), stdAccel.copy() );
    _editMenu->insertSeparator();
    editSelectAll = _editMenu->insertItem(i18n("&Select All"),
					   this,SIGNAL(selectAll()) );
    editUnselectAll = _editMenu->insertItem(i18n("Unse&lect All"),
					   this,SIGNAL(unselectAll()) );
    editInvertSelection = _editMenu->insertItem(i18n("&Invert Selection"),
					   this,SIGNAL(invertSelection()) );

    _editMenu->setItemEnabled( undo      , FALSE );
    _editMenu->setItemEnabled( cut       , FALSE );
    _editMenu->setItemEnabled( editCopy  , FALSE );
    _editMenu->setItemEnabled( editSelectAll, FALSE );
    _editMenu->setItemEnabled( editUnselectAll, FALSE );
    _editMenu->setItemEnabled( editInvertSelection, FALSE ); 

    CHECK_PTR( _optionMenu ); 

    _optionMenu->insertItem(i18n("&Preferences ..."),
			    this,SLOT(prefs()));
    //_optionMenu->insertItem("Configure key bindings",this,SIGNAL(keys()));

    QString tmp;
    tmp.sprintf(i18n("KFind %s\nFrontend to find utility\nMiroslav Flídr <*****@*****.**>\n\nSpecial thanks to Stephan Kulow\n<*****@*****.**>"),
                KFIND_VERSION);
    _helpMenu=kapp->getHelpMenu( true, tmp );    

    _mainMenu = new KMenuBar(this, "_mainMenu");
    _mainMenu->insertItem( i18n("&File"), _fileMenu);
    _mainMenu->insertItem( i18n("&Edit"), _editMenu);
    _mainMenu->insertItem( i18n("&Options"), _optionMenu);
    _mainMenu->insertSeparator();
    _mainMenu->insertItem( i18n("&Help"), _helpMenu );
  };
Example #10
0
unsigned char * selectSegmentationForRGBFrame(unsigned char * source , unsigned int inputFrameWidth , unsigned int inputFrameHeight , struct SegmentationFeaturesRGB * segConf, struct calibration * calib,unsigned int * selectedPixels)
{
 unsigned int width = inputFrameWidth;
 unsigned int height = inputFrameHeight;

 //This will be our response segmentation
 unsigned char * selectedRGB   = (unsigned char*) malloc(width*height*sizeof(unsigned char));
 if (selectedRGB==0) { fprintf(stderr,"Could not allocate memory for RGB Selection\n"); return 0; }

 //if we don't need to segment , conserve our CPU
 if (justSelectAllRGBPixels(segConf,width,height))
    {
      fprintf(stderr,"======== Just Selecting All RGB Frame ======== \n");
      *selectedPixels=width*height;
      memset(selectedRGB,1,width*height*sizeof(unsigned char));
      return selectedRGB;
    }

 //We initially disqualify ( unselect ) the whole image , so we only PICK things that are ok
 *selectedPixels=0;   memset(selectedRGB,0,width*height*sizeof(unsigned char));

 //In case our bounds are impossible we get an unselected image..!
 if ( segConf->maxX > width )  { segConf->maxX = width; }
 if ( segConf->maxY > height ) { segConf->maxY = height; }
 if ( segConf->minX > segConf->maxX ) { return selectedRGB; }
 if ( segConf->minY > segConf->maxY ) { return selectedRGB; }


 unsigned char * sourceCopy = (unsigned char *) malloc( width * height * 3 * sizeof( unsigned char));
 if ( sourceCopy == 0) { fprintf(stderr,"Could not allocate a buffer to copy the source..\n"); return 0; }
 memcpy(sourceCopy,source,width*height*3*sizeof(char));

 removeFloodFillBeforeProcessing(sourceCopy,width,height,segConf);


 unsigned int posX = segConf->minX , posY = segConf->minY;
 unsigned int limX = segConf->maxX , limY = segConf->maxY;
 unsigned int patchWidth = limX-posX-1 , patchHeight = limY-posY-1;
 unsigned int sourceWidthStep = width * 3;

 unsigned char * sourcePixelsStart   = (unsigned char*) sourceCopy + ( (posX*3) + posY * sourceWidthStep );
 unsigned char * sourcePixelsLineEnd = sourcePixelsStart + ((patchWidth)*3);
 unsigned char * sourcePixelsEnd     = sourcePixelsLineEnd + ((patchHeight-1) * sourceWidthStep );
 unsigned char * sourcePixels = sourcePixelsStart;

 unsigned char * selectedPtrStart = selectedRGB + ( posX + (posY * width) ) ;
 unsigned char * selectedPtr = selectedPtrStart;


 register unsigned char selected;
 register unsigned char * R , * G , * B;
 while (sourcePixels<sourcePixelsEnd)
 {
   while (sourcePixels<sourcePixelsLineEnd)
      {
        R = sourcePixels++;
        G = sourcePixels++;
        B = sourcePixels++;

        selected=(
                       ( (*R!=segConf->replaceR) || (*G!=segConf->replaceG) || (*B!=segConf->replaceB) ) &&
                         (
                              (segConf->minR <= *R) && (*R <= segConf->maxR) &&
                              (segConf->minG <= *G) && (*G <= segConf->maxG) &&
                              (segConf->minB <= *B) && (*B <= segConf->maxB)
                         )
                  );

        *selectedPixels+=selected;
        *selectedPtr=selected;
        ++selectedPtr;
      }
   sourcePixelsStart+=sourceWidthStep;
   sourcePixels=sourcePixelsStart;
   sourcePixelsLineEnd+=sourceWidthStep;
   selectedPtrStart+=width;
   selectedPtr=selectedPtrStart;
 }

 if (segConf->enableRGBMotionDetection)
 {
  //In case we want motion detection we should record the first frame we have so that we can use it to select pixels
  if (! keepFirstRGBFrame(sourceCopy ,  width , height , segConf) )
  {
    selectBasedOnRGBMovement(selectedRGB, segConf->firstRGBFrame , sourceCopy ,
                             segConf->motionRThreshold , segConf->motionGThreshold , segConf->motionBThreshold ,  width , height  );
  }
 } else
 {
   if (segConf->firstRGBFrame!=0)
   {
     fprintf(stderr,"Freeing first frame for rgb motion detection\n");
     free(segConf->firstRGBFrame);
     segConf->firstRGBFrame=0;
   }
 }



  if (segConf->invert)
     { invertSelection(selectedRGB , inputFrameWidth ,   inputFrameHeight ,selectedPixels); }



 free(sourceCopy);
 return selectedRGB;
}
int Q3ListBox::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = Q3ScrollView::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: highlighted((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: selected((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: highlighted((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 3: selected((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 4: highlighted((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 5: selected((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 6: selectionChanged(); break;
        case 7: selectionChanged((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 8: currentChanged((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 9: clicked((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 10: clicked((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break;
        case 11: pressed((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 12: pressed((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break;
        case 13: doubleClicked((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 14: returnPressed((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 15: rightButtonClicked((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break;
        case 16: rightButtonPressed((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break;
        case 17: mouseButtonPressed((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< Q3ListBoxItem*(*)>(_a[2])),(*reinterpret_cast< const QPoint(*)>(_a[3]))); break;
        case 18: mouseButtonClicked((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< Q3ListBoxItem*(*)>(_a[2])),(*reinterpret_cast< const QPoint(*)>(_a[3]))); break;
        case 19: contextMenuRequested((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break;
        case 20: onItem((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break;
        case 21: onViewport(); break;
        case 22: clear(); break;
        case 23: ensureCurrentVisible(); break;
        case 24: clearSelection(); break;
        case 25: selectAll((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 26: invertSelection(); break;
        case 27: clearInputString(); break;
        case 28: refreshSlot(); break;
        case 29: doAutoScroll(); break;
        case 30: adjustItems(); break;
        }
        _id -= 31;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< uint*>(_v) = count(); break;
        case 1: *reinterpret_cast< int*>(_v) = numItemsVisible(); break;
        case 2: *reinterpret_cast< int*>(_v) = currentItem(); break;
        case 3: *reinterpret_cast< QString*>(_v) = currentText(); break;
        case 4: *reinterpret_cast< int*>(_v) = topItem(); break;
        case 5: *reinterpret_cast< SelectionMode*>(_v) = selectionMode(); break;
        case 6: *reinterpret_cast< bool*>(_v) = isMultiSelection(); break;
        case 7: *reinterpret_cast< LayoutMode*>(_v) = columnMode(); break;
        case 8: *reinterpret_cast< LayoutMode*>(_v) = rowMode(); break;
        case 9: *reinterpret_cast< int*>(_v) = numColumns(); break;
        case 10: *reinterpret_cast< int*>(_v) = numRows(); break;
        case 11: *reinterpret_cast< bool*>(_v) = variableWidth(); break;
        case 12: *reinterpret_cast< bool*>(_v) = variableHeight(); break;
        }
        _id -= 13;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 2: setCurrentItem(*reinterpret_cast< int*>(_v)); break;
        case 4: setTopItem(*reinterpret_cast< int*>(_v)); break;
        case 5: setSelectionMode(*reinterpret_cast< SelectionMode*>(_v)); break;
        case 6: setMultiSelection(*reinterpret_cast< bool*>(_v)); break;
        case 7: setColumnMode(*reinterpret_cast< LayoutMode*>(_v)); break;
        case 8: setRowMode(*reinterpret_cast< LayoutMode*>(_v)); break;
        case 11: setVariableWidth(*reinterpret_cast< bool*>(_v)); break;
        case 12: setVariableHeight(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 13;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 13;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 13;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Example #12
0
	//--------------------------------------------------------------------------------
	void World::invertSelection()
	{
		invertSelection(getRootWorldObject(), false);
	}
Example #13
0
	// text will be filled in by updateContextMenuState()
	select_objects_action = context_menu->addAction(QIcon(QStringLiteral(":/images/tool-edit.png")), {}, this, SLOT(selectObjectsExclusively()));
	select_objects_additionally_action = context_menu->addAction(QIcon(QStringLiteral(":/images/tool-edit.png")), {}, this, SLOT(selectObjectsAdditionally()));
	deselect_objects_action = context_menu->addAction(QIcon(QStringLiteral(":/images/tool-edit.png")), {}, this, SLOT(deselectObjects()));
	context_menu->addSeparator();
	hide_action = context_menu->addAction({}, this, SLOT(setSelectedSymbolVisibility(bool)));
	hide_action->setCheckable(true);
	protect_action = context_menu->addAction({}, this, SLOT(setSelectedSymbolProtection(bool)));
	protect_action->setCheckable(true);
	context_menu->addSeparator();
	
	QMenu* select_menu = new QMenu(tr("Select symbols"), context_menu);
	select_menu->addAction(tr("Select all"), this, SLOT(selectAll()));
	select_menu->addAction(tr("Select unused"), this, SLOT(selectUnused()));
	select_menu->addSeparator();
	select_menu->addAction(tr("Invert selection"), this, SLOT(invertSelection()));
	context_menu->addMenu(select_menu);
	
	QMenu* sort_menu = new QMenu(tr("Sort symbols"), context_menu);
	sort_menu->addAction(tr("Sort by number"), this, SLOT(sortByNumber()));
	sort_menu->addAction(tr("Sort by primary color"), this, SLOT(sortByColor()));
	sort_menu->addAction(tr("Sort by primary color priority"), this, SLOT(sortByColorPriority()));
	sort_manual_action = sort_menu->addAction(tr("Enable drag and drop"));
	sort_manual_action->setCheckable(true);
	context_menu->addMenu(sort_menu);
	
	connect(map, &Map::colorDeleted, this, QOverload<>::of(&QWidget::update));
	connect(map, &Map::symbolAdded, this, &SymbolRenderWidget::updateAll);
	connect(map, &Map::symbolDeleted, this, &SymbolRenderWidget::symbolDeleted);
	connect(map, &Map::symbolChanged, this, &SymbolRenderWidget::symbolChanged);
	connect(map, &Map::symbolIconChanged, this, &SymbolRenderWidget::updateSingleIcon);