Example #1
0
void RenderWindow::sAdd()
{
  ParameterProperties pedit(this);
  if (pedit.exec() == QDialog::Accepted)
  {
    QString  name    = pedit.name();

    if (_params.contains(name))
    {
      QMessageBox::warning(this, tr("Name already exists"),
                           tr("<p>The name for the parameter you specified "
                              "already exists in the list."));
      return;
    }
    _params[name] = pedit.value();

    int r = _table->rowCount();
    _table->setRowCount(r+1);
    QTableWidgetItem * ctItem = new QTableWidgetItem();
    ctItem->setFlags(Qt::ItemIsUserCheckable);
    ctItem->setCheckState((pedit.active() ? Qt::Checked : Qt::Unchecked));
    _table->setItem(r, 0, ctItem);
    _table->setItem(r, 1, new QTableWidgetItem(name));
    _table->setItem(r, 2, new QTableWidgetItem(pedit.value().typeName()));
    _table->setItem(r, 3, new QTableWidgetItem(pedit.value().toString()));
    sSelectionChanged();
  }
}
Example #2
0
/*
 *  Constructs a maintainItemCosts as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 */
maintainItemCosts::maintainItemCosts(QWidget* parent, const char* name, Qt::WFlags fl)
    : XWidget(parent, name, fl)
{
    setupUi(this);


    // signals and slots connections
    connect(_item, SIGNAL(newId(int)), this, SLOT(sFillList()));
    connect(_new, SIGNAL(clicked()), this, SLOT(sNew()));
    connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
    connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete()));
    connect(_close, SIGNAL(clicked()), this, SLOT(close()));
    connect(_itemcost, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*,int)), this, SLOT(sPopulateMenu(QMenu*,QTreeWidgetItem*)));
    connect(_itemcost, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));
    connect(_itemcost, SIGNAL(itemSelectionChanged()), this, SLOT(sSelectionChanged()));
    
    _itemcost->addColumn(tr("Element"),     -1,           Qt::AlignLeft,   true, "costelem_type");
    _itemcost->addColumn(tr("Lower"),       _costColumn,  Qt::AlignCenter, true, "itemcost_lowlevel" );
    _itemcost->addColumn(tr("Std. Cost"),   _costColumn,  Qt::AlignRight,  true, "itemcost_stdcost"  );
    _itemcost->addColumn(tr("Currency"),    _currencyColumn, Qt::AlignLeft,true, "baseCurr" );
    _itemcost->addColumn(tr("Posted"),      _dateColumn,  Qt::AlignCenter, true, "itemcost_posted" );
    _itemcost->addColumn(tr("Act. Cost"),   _costColumn,  Qt::AlignRight,  true, "itemcost_actcost"  );
    _itemcost->addColumn(tr("Currency"),    _currencyColumn, Qt::AlignLeft,true, "costCurr" );
    _itemcost->addColumn(tr("Updated"),     _dateColumn,  Qt::AlignCenter, true, "itemcost_updated" );

    if (omfgThis->singleCurrency())
    {
	_itemcost->hideColumn(3);
	_itemcost->hideColumn(6);
    }

    if (_privileges->check("CreateCosts"))
      connect(_item, SIGNAL(valid(bool)), _new, SLOT(setEnabled(bool)));
}
Example #3
0
ParamListEdit::ParamListEdit(QWidget* parent, Qt::WindowFlags fl)
    : QDialog(parent, fl)
{
    setupUi(this);

    // signals and slots connections
    connect(_cancel, SIGNAL(clicked()), this, SLOT(reject()));
    connect(_select, SIGNAL(clicked()), this, SLOT(accept()));
    connect(_list, SIGNAL(itemSelectionChanged()), this, SLOT(sSelectionChanged()));
}
Example #4
0
/*
 *  Constructs a RenderList as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  true to construct a modal dialog.
 */
RenderList::RenderList(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : QDialog(parent, name, modal, fl)
{
    setupUi(this);


    // signals and slots connections
    connect(_cancel, SIGNAL(clicked()), this, SLOT(reject()));
    connect(_select, SIGNAL(clicked()), this, SLOT(accept()));
    connect(_list, SIGNAL(selectionChanged()), this, SLOT(sSelectionChanged()));
}
Example #5
0
/*
 *  Constructs a ReportParameter as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  true to construct a modal dialog.
 */
ReportParameter::ReportParameter(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : QDialog(parent, name, modal, fl)
{
    setupUi(this);

    QButtonGroup * buttonGroup = new QButtonGroup(this);
    buttonGroup->addButton(_staticList, 0);
    buttonGroup->addButton(_dynamicList, 1);

    // signals and slots connections
    connect(_btnOk, SIGNAL(clicked()), this, SLOT(accept()));
    connect(_btnCancel, SIGNAL(clicked()), this, SLOT(reject()));
    connect(buttonGroup, SIGNAL(buttonClicked(int)), _stack, SLOT(setCurrentIndex(int)));
    connect(_listValues, SIGNAL(selectionChanged()), this, SLOT(sSelectionChanged()));
    connect(_add, SIGNAL(clicked()), this, SLOT(sAdd()));
    connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
    connect(_remove, SIGNAL(clicked()), this, SLOT(sRemove()));
}
Example #6
0
/*
 *  Constructs a RenderWindow as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 */
RenderWindow::RenderWindow(QWidget* parent, const char* name, Qt::WFlags fl)
    : QMainWindow(parent, name, fl)
{
    setupUi(this);

    (void)statusBar();

    // signals and slots connections
    connect(fileOpenAction, SIGNAL(activated()), this, SLOT(fileOpen()));
    connect(filePrintAction, SIGNAL(activated()), this, SLOT(filePrint()));
    connect(filePrintToPDFAction, SIGNAL(activated()), this, SLOT(filePrintToPDF()));
    connect(fileExitAction, SIGNAL(activated()), this, SLOT(fileExit()));
    connect(helpAboutAction, SIGNAL(activated()), this, SLOT(helpAbout()));
    connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete()));
    connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
    connect(_add, SIGNAL(clicked()), this, SLOT(sAdd()));
    connect(_table, SIGNAL(selectionChanged()), this, SLOT(sSelectionChanged()));
    connect(_list, SIGNAL(clicked()), this, SLOT(sList()));
}
Example #7
0
RenderWindow::RenderWindow(QWidget* parent, Qt::WindowFlags fl)
    : QMainWindow(parent, fl)
{
  setupUi(this);

  (void)statusBar();

  // signals and slots connections
  connect(fileOpenAction, SIGNAL(activated()), this, SLOT(fileOpen()));
  connect(fileLoadFromDB, SIGNAL(activated()), this, SLOT(fileLoad()));
  connect(filePrintPreviewAction, SIGNAL(activated()), this, SLOT(filePreview()));
  connect(filePrintAction, SIGNAL(activated()), this, SLOT(filePrint()));
  connect(filePrintToPDFAction, SIGNAL(activated()), this, SLOT(filePrintToPDF()));
  connect(fileExitAction, SIGNAL(activated()), this, SLOT(fileExit()));
  connect(helpAboutAction, SIGNAL(activated()), this, SLOT(helpAbout()));
  connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete()));
  connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
  connect(_add, SIGNAL(clicked()), this, SLOT(sAdd()));
  connect(_table, SIGNAL(itemSelectionChanged()), this, SLOT(sSelectionChanged()));
  connect(_list, SIGNAL(clicked()), this, SLOT(sList()));
  _autoPrint = false;                    //AUTOPRINT
}
Example #8
0
void RenderWindow::sAdd()
{
    bool ok = false;
    bool active = false;

    QString name;
    QString varType;
    QVariant var;

    NewVariant newVar(this);

    while(!ok)
    {
        if(newVar.exec() != QDialog::Accepted)
            return;

        name = newVar._name->text();
        varType = newVar._type->currentText();

        ok = !_params.contains(name);
        if(!ok)
            QMessageBox::warning(this, tr("Name already exists"), tr("The name for the parameter you specified already exists in the list."));
    }


    BoolEdit * be = 0;
    IntEdit * ie = 0;
    DoubleEdit * de = 0;
    StringEdit * se = 0;
    ListEdit * le = 0;

    if(varType == NewVariant::tr("String")) {
        se = new StringEdit(this);
        se->_name->setText(name);
        ok = (se->exec() == QDialog::Accepted);
        var = QVariant(se->_value->text());
        active = se->_active->isChecked();
        delete se;
        se = 0;
    } else if(varType == NewVariant::tr("Int")) {
        ie = new IntEdit(this);
        ie->_name->setText(name);
        ok = (ie->exec() == QDialog::Accepted);
        var = QVariant(ie->_value->text().toInt());
        active = ie->_active->isChecked();
        delete ie;
        ie = 0;
    } else if(varType == NewVariant::tr("Double")) {
        de = new DoubleEdit(this);
        de->_name->setText(name);
        ok = (de->exec() == QDialog::Accepted);
        var = QVariant(de->_value->text().toDouble());
        active = de->_active->isChecked();
        delete de;
        de = 0;
    } else if(varType == NewVariant::tr("Bool")) {
        be = new BoolEdit(this);
        be->_name->setText(name);
        ok = (be->exec() == QDialog::Accepted);
        var = QVariant(be->value(), 0);
        active = be->_active->isChecked();
        delete be;
        be = 0;
    } else if(varType == NewVariant::tr("List")) {
        le = new ListEdit(this);
        le->_name->setText(name);
        ok = (le->exec() == QDialog::Accepted);
        var = QVariant(le->list());
        active = le->_active->isChecked();
        delete le;
        le = 0;
    } else {
        QMessageBox::warning(this, tr("Unknown Type"), QString(tr("I do not understand the type %1.")).arg(varType));
        return;
    }

    if(!ok)
        return;

    _params[name] = var;

    int r = _table->numRows();
    _table->setNumRows(r+1);
    Q3CheckTableItem * ctItem = new Q3CheckTableItem(_table, QString::null);
    ctItem->setChecked(active);
    _table->setItem(r, 0, ctItem);
    _table->setText(r, 1, name);
    _table->setText(r, 2, var.typeName());
    _table->setText(r, 3, var.toString());
    sSelectionChanged();
}