void QmitkNumberPropertyEditor::adjustFactors(short newDecimalPlaces, bool newShowPercents)
{
    int oldMax = maxValue();
    int oldMin = minValue();

    m_DecimalPlaces = newDecimalPlaces;
    m_ShowPercents = newShowPercents;

    m_FactorPropertyToSpinbox = pow(10.0,m_DecimalPlaces);
    m_FactorSpinboxToDisplay = 1.0 / m_FactorPropertyToSpinbox;

    // commented line would set the default increase/decrease to 1.0, no matter how many decimal places are available
    //setLineStep( ROUND(m_FactorPropertyToSpinbox) );

    if ( m_ShowPercents )
    {
        m_FactorPropertyToSpinbox *= 100.0;
        //setLineStep( ROUND(0.01 *m_FactorPropertyToSpinbox) );
        setSuffix("%");
    }
    else
    {
        setSuffix("");
    }

    setMinValue(oldMin);
    setMaxValue(oldMax);
}
Example #2
0
	void CodeSpinBox::codeChanged(bool code)
	{
		if(!code)
		{
			if(mPrefix.isEmpty())
				mPrefix = prefix();
			if(mSuffix.isEmpty())
				mSuffix = suffix();

			setPrefix(mPrefix);
			setSuffix(mSuffix);
			
			setButtonSymbols(QAbstractSpinBox::UpDownArrows);
			setValue(text().toInt());
			codeLineEdit()->textChanged(codeLineEdit()->text());
		}
		else
		{
			setButtonSymbols(QAbstractSpinBox::NoButtons);
			
			mPrefix = prefix();
			mSuffix = suffix();
			
			int previousWidth = width();

			setPrefix(QString());
			setSuffix(QString());
			
			setMinimumWidth(previousWidth);//This is a hack to fix widget size under KDE, but a better fix has to be found
		}
	}
Example #3
0
// Set the EGU as the suffix
void QESpinBox::setSuffixEgu( qcaobject::QCaObject* qca )
{
    // If using the EGU as the suffix, and the EGU is available, set the suffix to the EGU
    // otherwise clear the suffix
    if( qca && addUnitsAsSuffix )
    {
        setSuffix( QString( " " ).append( qca->getEgu() ) );
    }
    else
    {
        setSuffix( "" );
    }
}
Example #4
0
void GIntSpinBox::UpdateUnits()
{
	if(!m_pParam)
		return;
	QString thesuffix(" ");
	thesuffix += m_pParam->Units();

	if(m_pParam->ShowingUnits()) {
		setSuffix(thesuffix);
	}
	else {
		setSuffix("");
	}
}
void QmitkNumberPropertyView::setShowPercent(bool show)
{
  if (show)
  {
    m_DisplayFactor = 100.0;
    setSuffix("%");
  }
  else
  {
    m_DisplayFactor = 1.0;
    setSuffix("");
  }
  
  //DisplayNumber(); // gets called in setSuffix
}
Example #6
0
	QString CodeSpinBox::text()
	{
		QString currentPrefix = prefix();
		QString currentSuffix = suffix();

		setPrefix(QString());
		setSuffix(QString());

		QString value = codeLineEdit()->text();

		setPrefix(currentPrefix);
		setSuffix(currentSuffix);

		return value;
	}
Example #7
0
WindowSizeWidget::WindowSizeWidget(QWidget *parent)
    : QGroupBox(parent), d(new Data)
{
    auto grid = new QGridLayout(this);

    auto signal = &WindowSizeWidget::valuesChanged;
    for (int i = 0; i < s_count; ++i) {
        auto base = d->widgets[i].base = new QComboBox;
        auto pcnt = d->widgets[i].percent = new QSpinBox;

        int c = 0;
        grid->addWidget(new QLabel(tr("Action %1").arg(i + 1) % ':'_q), i, c++);
        grid->addWidget(base, i, c++);
        grid->addWidget(new QLabel(u"x"_q), i, c++);
        grid->addWidget(pcnt, i, c++);
        grid->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding), i, c++);

        for (int i = 0; i < 2; ++i)
            base->addItem(WindowSize::baseText(i));
        pcnt->setRange(10, 900);
        pcnt->setSingleStep(5);
        pcnt->setAccelerated(true);
        pcnt->setSuffix(u"%"_q);

        PLUG_CHANGED(base);
        PLUG_CHANGED(pcnt);
    }
}
Example #8
0
void PlumedMain::readInputWords(const std::vector<std::string> & words) {
  plumed_assert(initialized);
  if(words.empty())return;
  else if(words[0]=="ENDPLUMED") return;
  else if(words[0]=="_SET_SUFFIX") {
    plumed_assert(words.size()==2);
    setSuffix(words[1]);
  } else {
    std::vector<std::string> interpreted(words);
    Tools::interpretLabel(interpreted);
    Action* action=actionRegister().create(ActionOptions(*this,interpreted));
    if(!action) {
      log<<"ERROR\n";
      log<<"I cannot understand line:";
      for(unsigned i=0; i<interpreted.size(); ++i) log<<" "<<interpreted[i];
      log<<"\n";
      log.flush();
      plumed_merror("I cannot understand line " + interpreted[0] + " " + interpreted[1]);
    };
    action->checkRead();
    actionSet.push_back(action);
  };

  pilots=actionSet.select<ActionPilot*>();
}
Example #9
0
void VideoData::setVideo(const QString &url, KOdfStore *store, VideoCollection *collection)
{
    if (collection) {
        // let the collection first check if it already has one. If it doesn't it'll call this method
        // again and we'll go to the other clause
        VideoData *other = collection->createVideoData(url, store);
        this->operator=(*other);
        delete other;
    } else {
        setSuffix(url);
        if (store->open(url)) {
            KOdfStorageDevice device(store);
            QByteArray data = device.readAll();
            if (!device.open(QIODevice::ReadOnly)) {
                kWarning(30006) << "open file from store " << url << "failed";
                errorCode = OpenFailed;
                store->close();
                return;
            }
            copyToTemporary(device);
        } else {
            kWarning(30006) << "Find file in store " << url << "failed";
            errorCode = OpenFailed;
            return;
        }
    }
}
Example #10
0
void ccOctreeSpinBox::onValueChange(int level)
{
	if (m_octreeBoxWidth > 0)
	{
		if (level >= 0/* && level <= CCLib::DgmOctree::MAX_OCTREE_LEVEL*/)
		{
			double cs = m_octreeBoxWidth / pow(2.0,static_cast<double>(level));
			setSuffix(QString(" (grid step = %1)").arg(cs));
		}
		else
		{
			//invalid level?!
			setSuffix(QString());
		}
	}
}
Example #11
0
void KIntSpinBox::setSuffix(const KLocalizedString& suffix)
{
    d->pluralSuffix = suffix;
    if (suffix.isEmpty())
        setSuffix(QString());
    else
        d->updateSuffix(value());
}
Example #12
0
void  TimeSpanSpinBox::setUnits( char units )
{
  // units displayed in QDoubleSpinBox suffix
  setSuffix( QString(" %1").arg(units) );

  // if units is seconds, no decimal places otherwise two decimal places
  if ( units == TimeSpan::UNIT_MINUTES ) setDecimals( 0 );
  else                                   setDecimals( 2 );
}
Example #13
0
MidiVolEntry::MidiVolEntry(QWidget* parent)
   : FloatEntry(parent)
      {
  	_max = 127;
      setRange(-98.0f, 0.0f);
      setSpecialText(tr("off"));
      setSuffix(tr("db"));
      setFrame(true);
      setPrecision(0);
      }
Example #14
0
void KoUnitDoubleSpinBox::setUnit( KoUnit unit )
{
    double oldvalue = d->unit.fromUserValue( QDoubleSpinBox::value() );
    QDoubleSpinBox::setMinimum( unit.toUserValue( d->lowerInPoints ) );
    QDoubleSpinBox::setMaximum( unit.toUserValue( d->upperInPoints ) );
    QDoubleSpinBox::setSingleStep( unit.toUserValue( d->stepInPoints ) );
    d->unit = unit;
    QDoubleSpinBox::setValue( KoUnit::ptToUnit( oldvalue, unit ) );
    setSuffix( KoUnit::unitName( unit ).prepend( ' ' ) );
}
Example #15
0
void ScrSpinBox::init(int unitIndex)
{
	m_unitIndex=unitIndex;
	m_tabAdvance=true;
	setSuffix(unitGetSuffixFromIndex(m_unitIndex));
	setDecimals(unitGetPrecisionFromIndex(m_unitIndex));
	setSingleStep(1.0);
	lineEdit()->setValidator(0);
	disconnect(this, SIGNAL(valueChanged(const QString &)), this, SLOT(textChanged()));
	connect(this, SIGNAL(valueChanged(const QString &)), this, SLOT(textChanged()));
	installEventFilter(this);
}
Example #16
0
int QDoubleSpinBox::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QAbstractSpinBox::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 3)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 3;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = prefix(); break;
        case 1: *reinterpret_cast< QString*>(_v) = suffix(); break;
        case 2: *reinterpret_cast< QString*>(_v) = cleanText(); break;
        case 3: *reinterpret_cast< int*>(_v) = decimals(); break;
        case 4: *reinterpret_cast< double*>(_v) = minimum(); break;
        case 5: *reinterpret_cast< double*>(_v) = maximum(); break;
        case 6: *reinterpret_cast< double*>(_v) = singleStep(); break;
        case 7: *reinterpret_cast< double*>(_v) = value(); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setPrefix(*reinterpret_cast< QString*>(_v)); break;
        case 1: setSuffix(*reinterpret_cast< QString*>(_v)); break;
        case 3: setDecimals(*reinterpret_cast< int*>(_v)); break;
        case 4: setMinimum(*reinterpret_cast< double*>(_v)); break;
        case 5: setMaximum(*reinterpret_cast< double*>(_v)); break;
        case 6: setSingleStep(*reinterpret_cast< double*>(_v)); break;
        case 7: setValue(*reinterpret_cast< double*>(_v)); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 8;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Example #17
0
void ccOctreeSpinBox::setOctree(CCLib::DgmOctree* octree)
{
	if (octree)
	{
		m_octreeBoxWidth = static_cast<double>(octree->getCellSize(0));
		onValueChange(value());
	}
	else
	{
		m_octreeBoxWidth = 0;
		setSuffix(QString());
	}
}
Example #18
0
KAuPlugin::KAuPlugin(QObject *parent, const char *name,
                       const QStringList &args)

    : KFilePlugin(parent, name, args)
{
    KFileMimeTypeInfo* info = addMimeTypeInfo( "audio/basic" );

    KFileMimeTypeInfo::GroupInfo* group = 0L;

    group = addGroupInfo(info, "Technical", i18n("Technical Details"));

    KFileMimeTypeInfo::ItemInfo* item;

    item = addItemInfo(group, "Length", i18n("Length"), QVariant::Int);
    setSuffix(item, "s");

    item = addItemInfo(group, "Sample Rate", i18n("Sample Rate"), QVariant::Int);
    setSuffix(item, "Hz");

    item = addItemInfo(group, "Channels", i18n("Channels"), QVariant::Int);

    item = addItemInfo(group, "Encoding", i18n("Encoding"), QVariant::String);

}
Example #19
0
void ScrSpinBox::setNewUnit(int unitIndex)
{
	double oldUnitRatio=unitGetRatioFromIndex(m_unitIndex);
	double oldVal = value() / oldUnitRatio;
	double oldMax = maximum() / oldUnitRatio;
	double oldMin = minimum() / oldUnitRatio;
	setSuffix(unitGetSuffixFromIndex(unitIndex));
	setDecimals(unitGetPrecisionFromIndex(unitIndex));
	double newUnitRatio=unitGetRatioFromIndex(unitIndex);
	setMinimum(oldMin * newUnitRatio);
	setMaximum(oldMax * newUnitRatio);
	setSingleStep(1.0);
	m_unitIndex=unitIndex;
 	setValue(oldVal * newUnitRatio);
}
Example #20
0
void VideoData::setExternalVideo(const QUrl &location, VideoCollection *col)
{
    if (collection) {
        // let the collection first check if it already has one. If it doesn't it'll call this method
        // again and we'll go to the other clause
        VideoData *other = col->createExternalVideoData(location);
        this->operator=(*other);
        delete other;
    } else {
        videoLocation = location;
        setSuffix(location.toEncoded());
        QCryptographicHash md5(QCryptographicHash::Md5);
        md5.addData(location.toEncoded());
        key = VideoData::generateKey(md5.result());
    }
}
Example #21
0
TagRenamerOptions::TagRenamerOptions(const CategoryID &category)
    : m_category(category.category)
{
    // Set some defaults

    bool disabled;
    unsigned categoryNum = category.categoryNumber;

    switch(category.category) {
    case Title:
    case Artist:
    case Genre:
    case Year:
    case Album:
    case Track:
        disabled = false;
        break;
    default:
        disabled = true;
    }

    // Make sure we don't use translated strings for the config file keys.

    QString typeKey = tagTypeText(category.category, false);
    KConfigGroup config(KGlobal::config(), "FileRenamer");

    if(categoryNum > 0)
        typeKey.append(QString::number(categoryNum));

    setSuffix(config.readEntry(QString("%1Suffix").arg(typeKey), QString()));
    setPrefix(config.readEntry(QString("%1Prefix").arg(typeKey), QString()));

    // Default the emptyAction to ignoring the empty tag.

    const QString emptyAction = config.readEntry(QString("%1EmptyAction").arg(typeKey), QString()).toLower();
    setEmptyAction(IgnoreEmptyTag);

    if(emptyAction == "forceemptyinclude")
        setEmptyAction(ForceEmptyInclude);
    else if(emptyAction == "usereplacementvalue")
        setEmptyAction(UseReplacementValue);

    setEmptyText(config.readEntry(QString("%1EmptyText").arg(typeKey), QString()));
    setTrackWidth(config.readEntry(QString("%1TrackWidth").arg(typeKey), 0));
    setDisabled(config.readEntry(QString("%1Disabled").arg(typeKey), disabled));
}
Example #22
0
bool Package::setData(int role, const QVariant &value) {
    switch (role) {
    case CategoryRole:
        setCategory(value.toString());
        return true;
    case CreateSubfolderRole:
        setCreateSubfolder(value.toBool());
        return true;
    case IdRole:
        setId(value.toString());
        return true;
    case NameRole:
        setName(value.toString());
        return true;
    case PriorityRole:
        setPriority(TransferItem::Priority(value.toInt()));
        return true;
    case StatusRole:
        switch (value.toInt()) {
        case Queued:
            queue();
            return true;
        case Downloading:
            start();
            return true;
        case Paused:
            pause();
            return true;
        case Canceled:
            cancel();
            return true;
        case CanceledAndDeleted:
            cancel(true);
            return true;
        default:
            return TransferItem::setData(role, value);
        }
    case SuffixRole:
        setSuffix(value.toString());
        return true;
    default:
        return TransferItem::setData(role, value);
    }
}
    WeightBox(qint8 weightType, QWidget* parent = 0) : QDoubleSpinBox(parent) {

      switch (weightType) {
      case WeightThreshold:
        setDecimals(0);
        setRange(0, 100);
        setValue(100);
        setSingleStep(5);
        setSuffix(tr(" %"));
        break;
      case WeightNormalized:
      default:
        setDecimals(1);
        setRange(ngrt4n::WEIGHT_MIN, ngrt4n::WEIGHT_MAX);
        setValue(ngrt4n::WEIGHT_UNIT);
        setSingleStep(ngrt4n::WEIGHT_UNIT);
        break;
      }
    }
Example #24
0
MappingDouble::MappingDouble(MappingWidget* parent, ControllerEmu::NumericSetting<double>* setting)
    : QDoubleSpinBox(parent), m_setting(*setting)
{
  setRange(m_setting.GetMinValue(), m_setting.GetMaxValue());
  setDecimals(2);

  if (const auto ui_suffix = m_setting.GetUISuffix())
    setSuffix(QStringLiteral(" ") + tr(ui_suffix));

  if (const auto ui_description = m_setting.GetUIDescription())
    setToolTip(tr(ui_description));

  connect(this, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
          [this, parent](double value) {
            m_setting.SetValue(value);
            parent->SaveSettings();
          });

  connect(parent, &MappingWidget::ConfigChanged, this, &MappingDouble::ConfigChanged);
}
void QmitkNumberPropertyEditor::initialize()
{   // only to be called from constructors

    // spinbox settings
    //setValidator(0);
    setSuffix("");

    // protected
    m_DecimalPlaces = 0;
    m_FactorPropertyToSpinbox = 1.0;
    m_FactorSpinboxToDisplay = 1.0;
    m_ShowPercents = false;

    // private
    m_SelfChangeLock = false;

    connect( this, SIGNAL(valueChanged(int)), this, SLOT(onValueChanged(int)) );

    // display current value of our property
    DisplayNumber();
}
Example #26
0
void File::setFile(QFile *file = 0)
{
    setModified(false);
    if(file){
        QFileInfo info(file->fileName());
        setName(info.fileName());
        setPath(info.filePath());
        setSuffix(info.suffix());

        QTextStream in(file);
        m_content = in.readAll();
        m_new = false;
        m_type = FileTypes.getTypeByExtension(m_suffix);
        setMode(m_type);
    }
    else{
        m_name = "untitled";
        m_path = m_suffix = m_content = "";
        m_new = true;
        m_type = m_mode = FileTypes.getDefaultType();
    }
}
Example #27
0
KMpcPlugin::KMpcPlugin( QObject *parent, 
                        const QStringList &args )
    : KFilePlugin( parent, args )
{
    kDebug(7034) << "mpc plugin\n";

    KFileMimeTypeInfo* info = addMimeTypeInfo( "audio/x-musepack" );

    KFileMimeTypeInfo::GroupInfo* group = 0;

    // comment group
    group = addGroupInfo(info, "Comment", i18n("Comment"));
    setAttributes(group, KFileMimeTypeInfo::Addable |
                         KFileMimeTypeInfo::Removable);

    KFileMimeTypeInfo::ItemInfo* item = 0;

    item = addItemInfo(group, "Artist", i18n("Artist"), QVariant::String);
    setHint(item, KFileMimeTypeInfo::Author);
    setAttributes(item, KFileMimeTypeInfo::Modifiable);

    item = addItemInfo(group, "Title", i18n("Title"), QVariant::String);
    setHint(item, KFileMimeTypeInfo::Name);
    setAttributes(item, KFileMimeTypeInfo::Modifiable);

    item = addItemInfo(group, "Album", i18n("Album"), QVariant::String);
    setAttributes(item, KFileMimeTypeInfo::Modifiable);

    item = addItemInfo(group, "Genre", i18n("Genre"), QVariant::String);
    setAttributes(item, KFileMimeTypeInfo::Modifiable);

    item = addItemInfo(group, "Tracknumber", i18n("Track Number"), QVariant::String);
    setAttributes(item, KFileMimeTypeInfo::Modifiable);

    item = addItemInfo(group, "Date", i18n("Date"), QVariant::String);
    setAttributes(item, KFileMimeTypeInfo::Modifiable);

    item = addItemInfo(group, "Description", i18n("Description"), QVariant::String);
    setAttributes(item, KFileMimeTypeInfo::Modifiable);

    item = addItemInfo(group, "Organization", i18n("Organization"), QVariant::String);
    setAttributes(item, KFileMimeTypeInfo::Modifiable);

    item = addItemInfo(group, "Location", i18n("Location"), QVariant::String);
    setAttributes(item, KFileMimeTypeInfo::Modifiable);

    item = addItemInfo(group, "Copyright", i18n("Copyright"), QVariant::String);
    setAttributes(item, KFileMimeTypeInfo::Modifiable);


    addVariableInfo(group, QVariant::String, KFileMimeTypeInfo::Addable |
                                             KFileMimeTypeInfo::Removable |
                                             KFileMimeTypeInfo::Modifiable);

    // technical group
    group = addGroupInfo(info, "Technical", i18n("Technical Details"));
    setAttributes(group, 0);

    addItemInfo(group, "Channels", i18n("Channels"), QVariant::Int);

    addItemInfo(group, "Version", i18n("Version"), QVariant::Int);

    item = addItemInfo(group, "Sample Rate", i18n("Sample Rate"), QVariant::Int);
    setSuffix(item, i18n(" Hz"));

    item = addItemInfo(group, "Bitrate", i18n("Average Bitrate"),
                       QVariant::Int);
    setAttributes(item, KFileMimeTypeInfo::Averaged);
    setHint(item, KFileMimeTypeInfo::Bitrate);
    setSuffix(item, i18n( " kbps"));

    item = addItemInfo(group, "Length", i18n("Length"), QVariant::Int);
    setAttributes(item, KFileMimeTypeInfo::Cummulative);
    setHint(item, KFileMimeTypeInfo::Length);
    setUnit(item, KFileMimeTypeInfo::Seconds);
}
Example #28
0
void KFlacPlugin::makeMimeTypeInfo(const QString& mimeType)
{
    KFileMimeTypeInfo* info = addMimeTypeInfo( mimeType );

    KFileMimeTypeInfo::GroupInfo* group = 0;

    // comment group
    group = addGroupInfo(info, "Comment", i18n("Comment"));
    setAttributes(group, KFileMimeTypeInfo::Addable |
                         KFileMimeTypeInfo::Removable);

    KFileMimeTypeInfo::ItemInfo* item = 0;

    item = addItemInfo(group, "Artist", i18n("Artist"), QVariant::String);
    setHint(item, KFileMimeTypeInfo::Author);
    setAttributes(item, KFileMimeTypeInfo::Modifiable);

    item = addItemInfo(group, "Title", i18n("Title"), QVariant::String);
    setHint(item, KFileMimeTypeInfo::Name);
    setAttributes(item, KFileMimeTypeInfo::Modifiable);

    item = addItemInfo(group, "Album", i18n("Album"), QVariant::String);
    setAttributes(item, KFileMimeTypeInfo::Modifiable);

    item = addItemInfo(group, "Genre", i18n("Genre"), QVariant::String);
    setAttributes(item, KFileMimeTypeInfo::Modifiable);

    item = addItemInfo(group, "Tracknumber", i18n("Track Number"), QVariant::String);
    setAttributes(item, KFileMimeTypeInfo::Modifiable);

    item = addItemInfo(group, "Date", i18n("Date"), QVariant::String);
    setAttributes(item, KFileMimeTypeInfo::Modifiable);

    item = addItemInfo(group, "Description", i18n("Description"), QVariant::String);
    setAttributes(item, KFileMimeTypeInfo::Modifiable);

    item = addItemInfo(group, "Organization", i18n("Organization"), QVariant::String);
    setAttributes(item, KFileMimeTypeInfo::Modifiable);

    item = addItemInfo(group, "Location", i18n("Location"), QVariant::String);
    setAttributes(item, KFileMimeTypeInfo::Modifiable);

    item = addItemInfo(group, "Copyright", i18n("Copyright"), QVariant::String);
    setAttributes(item, KFileMimeTypeInfo::Modifiable);


    addVariableInfo(group, QVariant::String, KFileMimeTypeInfo::Addable |
                                             KFileMimeTypeInfo::Removable |
                                             KFileMimeTypeInfo::Modifiable);

    // technical group
    group = addGroupInfo(info, "Technical", i18n("Technical Details"));
    setAttributes(group, 0);

    addItemInfo(group, "Channels", i18n("Channels"), QVariant::Int);

    item = addItemInfo(group, "Sample Rate", i18n("Sample Rate"), QVariant::Int);
    setSuffix(item, i18n(" Hz"));

    item = addItemInfo(group, "Sample Width", i18n("Sample Width"), QVariant::Int);
    setSuffix(item, i18n(" bits"));

    item = addItemInfo(group, "Bitrate", i18n("Average Bitrate"),
                       QVariant::Int);
    setAttributes(item, KFileMimeTypeInfo::Averaged);
    setHint(item, KFileMimeTypeInfo::Bitrate);
    setSuffix(item, i18n( " kbps"));

    item = addItemInfo(group, "Length", i18n("Length"), QVariant::Int);
    setAttributes(item, KFileMimeTypeInfo::Cummulative);
    setHint(item, KFileMimeTypeInfo::Length);
    setUnit(item, KFileMimeTypeInfo::Seconds);
}
Example #29
0
int AbstractMeter::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = WidgetWithBackground::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: valueChanged((*reinterpret_cast< double(*)>(_a[1]))); break;
        case 2: setValue((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 3: setValue((*reinterpret_cast< double(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 4;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< double*>(_v) = minimum(); break;
        case 1: *reinterpret_cast< double*>(_v) = maximum(); break;
        case 2: *reinterpret_cast< double*>(_v) = value(); break;
        case 3: *reinterpret_cast< double*>(_v) = nominal(); break;
        case 4: *reinterpret_cast< double*>(_v) = critical(); break;
        case 5: *reinterpret_cast< QString*>(_v) = prefix(); break;
        case 6: *reinterpret_cast< QString*>(_v) = suffix(); break;
        case 7: *reinterpret_cast< QFont*>(_v) = valueFont(); break;
        case 8: *reinterpret_cast< double*>(_v) = valueOffset(); break;
        case 9: *reinterpret_cast< QFont*>(_v) = digitFont(); break;
        case 10: *reinterpret_cast< double*>(_v) = digitOffset(); break;
        }
        _id -= 11;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setMinimum(*reinterpret_cast< double*>(_v)); break;
        case 1: setMaximum(*reinterpret_cast< double*>(_v)); break;
        case 2: setValue(*reinterpret_cast< double*>(_v)); break;
        case 3: setNominal(*reinterpret_cast< double*>(_v)); break;
        case 4: setCritical(*reinterpret_cast< double*>(_v)); break;
        case 5: setPrefix(*reinterpret_cast< QString*>(_v)); break;
        case 6: setSuffix(*reinterpret_cast< QString*>(_v)); break;
        case 7: setValueFont(*reinterpret_cast< QFont*>(_v)); break;
        case 8: setValueOffset(*reinterpret_cast< double*>(_v)); break;
        case 9: setDigitFont(*reinterpret_cast< QFont*>(_v)); break;
        case 10: setDigitOffset(*reinterpret_cast< double*>(_v)); break;
        }
        _id -= 11;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 11;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
void KLFUnitSpinBox::setUnitWithSuffix(double unitfactor, const QString& suffix)
{
  setUnit(unitfactor);
  if (pShowUnitSuffix)
    setSuffix("  "+suffix);
}