Exemplo n.º 1
0
void toDatatype::changeType(int id)
{
    QString type = Type->itemText(id);
    for (std::list<toExtract::datatype>::iterator i = Datatypes.begin(); i != Datatypes.end(); i++)
    {
        if ((*i).name() == type)
        {
            if ((*i).hasLength())
            {
                Size->show();
                bSizeVisible = true;
                Size->setMaximum((*i).maxLength());
            }
            else
            {
                Size->hide();
                bSizeVisible = false;
            }
            if ((*i).hasPrecision())
            {
                Precision->show();
                bPrecVisible = true;
                Precision->setMaximum((*i).maxPrecision());
            }
            else
            {
                Precision->hide();
                bPrecVisible = false;
            }
            break;
        }
    }
    setupLabels();
}
Exemplo n.º 2
0
void BAMseek::setupTable(){
  tableview = new QTableWidget;
  tableview->setRowCount(PAGE_SIZE);
  tableview->setColumnCount(11);
  tableview->setEditTriggers(QAbstractItemView::NoEditTriggers);
    
  setupLabels(0);
}
Exemplo n.º 3
0
/*!
    Constructs an UiAnalogGroup with the given \a parent.
*/
UiAnalogGroup::UiAnalogGroup(QWidget *parent) :
    QGroupBox(parent),
    mMinSize(0, 0)
{
    setTitle("Analog Measurements");

    mNumSignals = 0;
    setupLabels();
}
Exemplo n.º 4
0
/*!
    Constructs an UiSelfmixedGroup with the given \a parent.
*/
UiSelfmixedGroup::UiSelfmixedGroup(QWidget *parent) :
    QGroupBox(parent),
    mMinSize(0, 0)
{
    setTitle("Selfmixed Measurements");

    mNumSignals = 0;
    setupLabels();
}
Exemplo n.º 5
0
RoomControlWidget::RoomControlWidget(QWidget *parent, int roomNumber) :
    QWidget(parent)
{
    m_iRoomNumber = roomNumber;    
    setupLabels();
    setupFunctionalWidgets();
    setupWidgetsAndLayout();
    setupRoomConstraints();
    setupConnections();
}
Exemplo n.º 6
0
bool BAMseek::jumpToPage(int page_no){
  tableview->clear();

  if(!pr.get()) return false;
  if(!pr->jumpToPage(page_no)) return false;
  
  std::vector<std::string> fields;
  int row = 0;
  int col_no = 0;
  
  while(pr->getNextRecord(fields)){
    if((int)fields.size() > col_no){
      col_no = fields.size();
      tableview->setColumnCount(col_no);
    }
    for(size_t i = 0; i < fields.size(); i++){
      QTableWidgetItem * item = new QTableWidgetItem(tr(fields.at(i).c_str()));
      //item->setForeground(Qt::red);
      //item->setForeground(QColor::fromRgbF(0,1,0,1));
      if(i==9 && fields.size() > 9 && fields.at(10).size() == fields.at(9).size()){
	item->setToolTip(prettyPrintBaseQual(fields.at(9), fields.at(10)).c_str());
      //item->setToolTip(tr("<font color=\"blue\">This is a</font> <b>tool</b> tip"));
      }
      if(i==1){
	item->setToolTip(prettyPrintFlag(atoi(fields.at(i).c_str())).c_str());
      }
      if(i==5){
	item->setToolTip(prettyPrintCigar(fields.at(5)).c_str());
      }
      tableview->setItem(row, i, item);
    }
    row++;
  }
  
  setupLabels(col_no);
  return true;
}
FullEraseConfirmationWindow::FullEraseConfirmationWindow()
{
	m_boundingRect.setRect(-SystemUiController::instance()->currentUiWidth()/2, -SystemUiController::instance()->currentUiHeight()/2,
			               SystemUiController::instance()->currentUiWidth(), SystemUiController::instance()->currentUiHeight());

	m_secondsLeft = 6;

	m_timer.setInterval(1000);
	m_timer.setSingleShot(false);
	connect(&m_timer, SIGNAL(timeout()), SLOT(slotTimerTicked()));

	std::string iconPath = Settings::LunaSettings()->lunaSystemResourcesPath + "/warning-system.png";
	m_warningPix.load(qFromUtf8Stl(iconPath));
	if (m_warningPix.isNull()) {
		g_warning("FullEraseConfirmationWindow failed to load the icon");
	}
	m_warningOffsetY = m_boundingRect.y() + (m_boundingRect.height() * iconRatio);

	m_font = QFont(QString::fromStdString(Settings::LunaSettings()->fontBanner));

	setupLabels();

	m_timer.start();
}
PlotItemDialog::PlotItemDialog(PlotItem *item, QWidget *parent)
    : ViewItemDialog(item, parent), _plotItem(item), _defaultTagString("<Auto Name>") {

  Q_ASSERT(_plotItem);

  _store = kstApp->mainWindow()->document()->objectStore();

  setWindowTitle(tr("Edit Plot Item"));

  _contentTab = new ContentTab(this, _store);
  connect(_contentTab, SIGNAL(apply()), this, SLOT(contentChanged()));
  DialogPage *contentsPage = new DialogPage(this);
  contentsPage->setPageTitle(tr("Contents"));
  contentsPage->addDialogTab(_contentTab);
  addDialogPage(contentsPage, true);

  _labelTab = new LabelTab(_plotItem, this);
  _topLabelTab = new OverrideLabelTab(tr("Top Font"), this);
  _bottomLabelTab = new OverrideLabelTab(tr("Bottom Font"), this);
  _leftLabelTab = new OverrideLabelTab(tr("Left Font"), this);
  _rightLabelTab = new OverrideLabelTab(tr("Right Font"), this);
  _axisLabelTab = new OverrideLabelTab(tr("Axis Font"), this);

  _labelPage = new DialogPageTab(this);
  _labelPage->setPageTitle(tr("Labels"));
  _labelPage->addDialogTab(_labelTab);
  _labelPage->addDialogTab(_topLabelTab);
  _labelPage->addDialogTab(_bottomLabelTab);
  _labelPage->addDialogTab(_leftLabelTab);
  _labelPage->addDialogTab(_rightLabelTab);
  _labelPage->addDialogTab(_axisLabelTab);
  addDialogPage(_labelPage, true);

  connect(_labelTab, SIGNAL(apply()), this, SLOT(labelsChanged()));
  connect(_labelTab, SIGNAL(globalFontUpdate()), this, SLOT(globalFontUpdate()));

  connect(_topLabelTab, SIGNAL(useDefaultChanged(bool)), this, SLOT(useTopDefaultChanged(bool)));
  connect(_bottomLabelTab, SIGNAL(useDefaultChanged(bool)), this, SLOT(useBottomDefaultChanged(bool)));
  connect(_leftLabelTab, SIGNAL(useDefaultChanged(bool)), this, SLOT(useLeftDefaultChanged(bool)));
  connect(_rightLabelTab, SIGNAL(useDefaultChanged(bool)), this, SLOT(useRightDefaultChanged(bool)));
  connect(_axisLabelTab, SIGNAL(useDefaultChanged(bool)), this, SLOT(useAxisDefaultChanged(bool)));

  _rangeTab = new RangeTab(_plotItem, this);
  DialogPage *rangePage = new DialogPage(this);
  rangePage->setPageTitle(tr("Range/Zoom"));
  rangePage->addDialogTab(_rangeTab);
  addDialogPage(rangePage, true);
  connect(_rangeTab, SIGNAL(apply()), this, SLOT(rangeChanged()));

  _xAxisTab = new AxisTab(this);
  _xAxisPage = new DialogPage(this);
  _xAxisPage->setPageTitle(tr("X-Axis"));
  _xAxisPage->addDialogTab(_xAxisTab);
  addDialogPage(_xAxisPage, true);
  connect(_xAxisTab, SIGNAL(apply()), this, SLOT(xAxisChanged()));

  _yAxisTab = new AxisTab(this);
  _yAxisTab->setAsYAxis();
  _yAxisPage = new DialogPage(this);
  _yAxisPage->setPageTitle(tr("Y-Axis"));
  _yAxisPage->addDialogTab(_yAxisTab);
  addDialogPage(_yAxisPage, true);
  connect(_yAxisTab, SIGNAL(apply()), this, SLOT(yAxisChanged()));

  _xMarkersTab = new MarkersTab(this);
  DialogPage *xMarkersPage = new DialogPage(this);
  xMarkersPage->setPageTitle(tr("X-Axis Markers"));
  xMarkersPage->addDialogTab(_xMarkersTab);
  addDialogPage(xMarkersPage, true);
  _xMarkersTab->setObjectStore(_store);
  connect(_xMarkersTab, SIGNAL(apply()), this, SLOT(xAxisPlotMarkersChanged()));

  _yMarkersTab = new MarkersTab(this);
  DialogPage *yMarkersPage = new DialogPage(this);
  yMarkersPage->setPageTitle(tr("Y-Axis Markers"));
  yMarkersPage->addDialogTab(_yMarkersTab);
  addDialogPage(yMarkersPage, true);
  _yMarkersTab->setObjectStore(_store);
  connect(yMarkersPage, SIGNAL(apply()), this, SLOT(yAxisPlotMarkersChanged()));

  // addRelations(); This tends to clutter the plot dialog, let's test skipping it

  setupContent();
  setupAxis();
  setupRange();
  setupLabels();
  setupMarkers();

  setSupportsMultipleEdit(true);

  if (_plotItem->descriptiveNameIsManual()) {
    setTagString(_plotItem->descriptiveName());
  } else {
    setTagString(_defaultTagString);
  }

  QList<PlotItem*> list = ViewItem::getItems<PlotItem>();
  clearMultipleEditOptions();
  foreach(PlotItem* plot, list) {
    addMultipleEditOption(plot->plotName(), plot->descriptionTip(), plot->shortName());
  }
Exemplo n.º 9
0
// Function tries to split given datatype (type) into a number of
// ui widgets (type, scale and precision). If it is unable to do
// that - custom style (pure edit text widget) is used
void toDatatype::setType(const QString &type)
{
    try
    {
        // Intentionally not using the SQL parser for this
        enum
        {
            Initial,
            AtType,
            AtSize,
            AtPrecision,
            AtEnd
        } state = Initial;
        int startType = -1;
        int endType = -1;
        int size = -1;
        int precision = -1;
        bool valid = !PreferCustom;
        bool endoftoken = false;
        if (valid)
        {
            for (int pos = 0; pos < type.length(); pos++)
            {
                QChar c = type.at(pos);
                if (c.isSpace())
                {
                    endoftoken = true;
                    continue;
                }
                switch (state)
                {
                case Initial:
                    state = AtType;
                    startType = pos;
                    endoftoken = false;
                    break;
                case AtType:
                    if (c == '(')
                    {
                        state = AtSize;
                        endoftoken = false;
                    }
                    else if (endoftoken)
                    {
                        valid = false;
                    }
                    else
                        endType = pos;
                    break;
                case AtSize:
                    if (c.isDigit() && (!endoftoken || size == -1))
                    {
                        if (size == -1)
                            size = (c.toAscii()) - '0';
                        else
                            size = size * 10 + (c.toAscii()) - '0';
                        endoftoken = false;
                    }
                    else if (size == -1)
                        valid = false;
                    else if (c == ')')
                    {
                        endoftoken = false;
                        state = AtEnd;
                    }
                    else if (c == ',')
                    {
                        endoftoken = false;
                        state = AtPrecision;
                    }
                    else
                        valid = false;
                    break;
                case AtPrecision:
                    if (c.isDigit() && (!endoftoken || precision == -1))
                    {
                        if (precision == -1)
                            precision = (c.toAscii()) - '0';
                        else
                            precision = precision * 10 + (c.toAscii()) - '0';
                        endoftoken = false;
                    }
                    else if (precision == -1)
                        valid = false;
                    else if (c == ')')
                    {
                        endoftoken = false;
                        state = AtEnd;
                    }
                    else
                        valid = false;
                    break;
                case AtEnd:
                    valid = false;
                    break;
                }
                if (!valid)
                    break;
            }
        }
        if (valid)
        {
            if (endType == -1)
                endType = type.length();
            if (startType >= 0)
            {
                QString actualtype = type.mid(startType, endType - startType + 1).toUpper();
                valid = false;
                for (int i = 0; i < Type->count(); i++)
                {
                    if (actualtype == Type->itemText(i))
                    {
                        Type->show();
                        bCustomVisible = false;
                        Type->setCurrentIndex(i);
                        valid = true;
                        break;
                    }
                }
                if (valid)
                {
                    valid = false;
                    for (std::list<toExtract::datatype>::iterator i = Datatypes.begin(); i != Datatypes.end(); i++)
                    {
                        if ((*i).name() == actualtype)
                        {
                            valid = true;
                            if ((*i).hasLength())
                            {
                                if (size > (*i).maxLength())
                                    valid = false;
                                else
                                {
                                    Size->show();
                                    bSizeVisible = true;
                                    Size->setMaximum((*i).maxLength());
                                    if (size != -1)
                                        Size->setValue(size);
                                    else
                                        //Size->setValue((*i).maxLength());
                                        Size->setValue(0); // set value "not specified"
                                }
                            }
                            else if (size != -1)
                                valid = false;
                            else
                            {
                                Size->hide();
                                bSizeVisible = false;
                            }
                            if ((*i).hasPrecision())
                            {
                                if (precision > (*i).maxPrecision())
                                    valid = false;
                                else
                                {
                                    Precision->show();
                                    bPrecVisible = true;
                                    Precision->setMaximum((*i).maxPrecision());
                                    if (precision != -1)
                                        Precision->setValue(precision);
                                    else
                                        // Set precision to 0 (meaning "precision not specified").
                                        // If precision 0 can actually be used -1 should be used
                                        // here and minimum value on precision spinner should be
                                        // changed to -1 so that spinner would allow choosing 0
                                        Precision->setValue(0);
                                }
                            }
                            else if (precision != -1)
                                valid = false;
                            else
                            {
                                Precision->hide();
                                bPrecVisible = false;
                            }
                            break;
                        }
                    }
                }
            }
        }
        if (!valid)
        {
            Custom->setText(type);
            Custom->show();
            bCustomVisible = true;
            Precision->hide();
            bPrecVisible = false;
            Size->hide();
            bSizeVisible = false;
            Type->hide();
        }
        else
        {
            Custom->hide();
            bCustomVisible = false; // probably set already above but just for clarity...
        }

        setupLabels();
    }
    TOCATCH
}