Example #1
0
void UIStateHelper::setLoading(int index, bool loading)
{
	UIStateHelperData *data = findData(index, false);
	if (!data) {
		return;
	}
	data->mLoading = loading;

	updateData(data);

	QMap<UIStateHelperObject, QPair<QString, bool> >::iterator it;
	for (it = data->mLoad.begin(); it != data->mLoad.end(); ++it) {
		const UIStateHelperObject &object = it.key();

		if (loading) {
			object.setPlaceholder(loading, it.value().first, it.value().second);
		} else {
			QString text;
			if (isWidgetLoading(object.widget(), text)) {
				object.setPlaceholder(true, text, it.value().second);
			} else {
				object.setPlaceholder(loading, "", it.value().second);
			}
		}
	}
}
void HbComboBoxPrivate::_q_textChanged( const QModelIndex & aIndex )
{
    Q_Q( HbComboBox );
    QVariant data = mDropDown->mList->model( )->data( aIndex );
    mText = data.toString( );
    if( !mEditable ) {
        if( mLineEdit ) {
            mLineEdit->setText( mText );
        } else {
            HbStyleOptionComboBox comboBoxOption;
            q->initStyleOption( &comboBoxOption );
            q->style( )->updatePrimitive( mTextItem, HbStyle::P_ComboBox_text, &comboBoxOption );
        }
        mCurrentIndex = aIndex;
    } else {
       q->disconnect( mLineEdit, SIGNAL( textChanged ( QString ) ), q,
           SLOT( _q_textChanged( QString ) ) );
       mLineEdit->setText( mText );
       mCurrentIndex = findData( mText );
       q->connect( mLineEdit, SIGNAL( textChanged ( QString ) ), q, 
           SLOT( _q_textChanged( QString ) ) );
    }
    if ( mDropDown->isVisible( ) ) {
        mDropDown->setVisible( false );
        q->setProperty( "state", "normal" );
    }
    currentIndexChanged( mCurrentIndex );
}
Example #3
0
void GxsIdChooser::setDefaultItem()
{
	int def = -1;

	if ((mFlags & IDCHOOSER_ANON_DEFAULT) && !(mFlags & IDCHOOSER_ID_REQUIRED)) {
		def = findData(TYPE_NO_ID, ROLE_TYPE);
	} else {
		if (!mDefaultId.isNull()) {
			QString id = QString::fromStdString(mDefaultId.toStdString());
			def = findData(id);
		}
	}

	if (def >= 0) {
		setCurrentIndex(def);
	}
}
Example #4
0
void ViewComboBox::setChoice(const QString& choice)
{
  const int index = findData(choice, Qt::DisplayRole, Qt::MatchFixedString);
  if (index >= 0)
    setCurrentIndex(index);
  else
    setEditText(choice);
}
Example #5
0
void methodComboBox::setCurrentMethod(const std::string& methodName) {
	int index = findData(QString::fromStdString(methodName), Qt::UserRole,
	                     Qt::MatchFixedString);

	if(index != -1) {
		setCurrentIndex(index);
	}
}
Example #6
0
void UIStateHelper::addClear(int index, RSTextBrowser *widget)
{
	UIStateHelperData *data = findData(index, true);
	if (data->mClear.contains(widget)) {
		return;
	}
	data->mClear.push_back(UIStateHelperObject(widget));
}
LPCTSTR CPluginStream::GetString(LPCTSTR id, LPCTSTR defValue)
{
	STREAM_DATA* data = findData(id);
	if(!data || data && data->type != SDT_DATA)
	{
		return defValue;
	}
	return (LPCTSTR) data->lpData;
}
Example #8
0
bool UIStateHelper::isActive(int index)
{
	UIStateHelperData *data = findData(index, false);
	if (data) {
		return data->mActive;
	}

	return true;
}
Example #9
0
bool UIStateHelper::isLoading(int index)
{
	UIStateHelperData *data = findData(index, false);
	if (data) {
		return data->mLoading;
	}

	return false;
}
Example #10
0
void FormatComboBox::setFormat(MailCommon::BackupJob::ArchiveType type)
{
    const int index = findData((int)type);
    if (index != -1) {
        setCurrentIndex(index);
    } else {
        setCurrentIndex(0);
    }
}
Example #11
0
void WComboBox::onConnectedControlChanged(double dParameter, double dValue) {
    Q_UNUSED(dParameter);
    // Enums are not currently represented using parameter space so it doesn't
    // make sense to use the parameter here yet.
    int index = findData(static_cast<int>(dValue));
    if (index != -1) {
        setCurrentIndex(index);
    }
}
Example #12
0
void UIStateHelper::setActive(int index, bool active)
{
	UIStateHelperData *data = findData(index, false);
	if (!data) {
		return;
	}
	data->mActive = active;

	updateData(data);
}
Example #13
0
FormatComboBox::FormatComboBox(QWidget *parent)
    : QComboBox(parent)
{
    // These combobox values have to stay in sync with the ArchiveType enum from BackupJob!
    addItem(i18n("Compressed Zip Archive (.zip)"), (int)MailCommon::BackupJob::Zip);
    addItem(i18n("Uncompressed Archive (.tar)"), (int)MailCommon::BackupJob::Tar);
    addItem(i18n("BZ2-Compressed Tar Archive (.tar.bz2)"), (int)MailCommon::BackupJob::TarBz2);
    addItem(i18n("GZ-Compressed Tar Archive (.tar.gz)"), (int)MailCommon::BackupJob::TarGz);
    setCurrentIndex(findData((int)MailCommon::BackupJob::TarBz2));
}
void ThreadSearchView::ThreadedSearch(const ThreadSearchFindData& aFindData)
{
    // We don't search empty patterns
    if ( aFindData.GetFindText() != wxEmptyString )
    {
        ThreadSearchFindData findData(aFindData);

        // Prepares logger
        m_pLogger->OnSearchBegin(aFindData);

        // Two steps thread creation
        m_pFindThread = new ThreadSearchThread(this, findData);
        if ( m_pFindThread != NULL )
        {
            if ( m_pFindThread->Create() == wxTHREAD_NO_ERROR )
            {
                // Thread execution
                if ( m_pFindThread->Run() != wxTHREAD_NO_ERROR )
                {
                    m_pFindThread->Delete();
                    m_pFindThread = NULL;
                    cbMessageBox(_("Failed to run search thread"));
                }
                else
                {
                    // Update combo box search history
                    AddExpressionToSearchCombos(findData.GetFindText(), findData.GetSearchPath(),
                                                findData.GetSearchMask());
                    UpdateSearchButtons(true, cancel);
                    EnableControls(false);

                    // Starts the timer used to managed events sent by m_pFindThread
                    m_Timer.Start(TIMER_PERIOD, wxTIMER_CONTINUOUS);
                }
            }
            else
            {
                // Error
                m_pFindThread->Delete();
                m_pFindThread = NULL;
                cbMessageBox(_("Failed to create search thread (2)"));
            }
        }
        else
        {
            // Error
            cbMessageBox(_("Failed to create search thread (1)"));
        }
    }
    else
    {
        // Error
        cbMessageBox(_("Search expression is empty !"));
    }
}
Example #15
0
void UIStateHelper::clear(int index)
{
	UIStateHelperData *data = findData(index, false);
	if (!data) {
		return;
	}
	QList<UIStateHelperObject>::iterator it;
	for (it = data->mClear.begin(); it != data->mClear.end(); ++it) {
		it->clear();
	}
}
LPBYTE CPluginStream::GetBIN(LPCTSTR id, DWORD* cbSize)
{
	STREAM_DATA* data = findData(id);
	if(cbSize) *cbSize = 0;
	if(!data || data && data->type != SDT_DATA)
	{
		return NULL;
	}
	if(cbSize) *cbSize = data->cbSize;
	return data->lpData;
}
Example #17
0
void ColorCombo::currentChanged(int index)
{
	if (itemData(index).isValid() && itemData(index) == QVariant((int)QVariant::UserType))
	{
		QColor color = QColorDialog::getColor(m_init, this);		
		if (color.isValid())
		{
			if (findData(color, int(Qt::DecorationRole)) == -1)
			{
				addItem(color.name());
				setItemData(count()-1, color, Qt::DecorationRole);
			}
			setCurrentIndex(findData(color, int(Qt::DecorationRole)));
		}
		else
        {
            setCurrentIndex(findData(m_init));
        }
	}
}
Example #18
0
void ColorCombo::setColor(QColor color)
{
	m_init = color;
	setCurrentIndex(findData(color, int(Qt::DecorationRole)));
	if (currentIndex() == -1)
	{
		addItem(color.name());
		setItemData(count()-1, color, Qt::DecorationRole);
		setCurrentIndex(count()-1);
	}
}
WORD CPluginStream::GetWORD(LPCTSTR id, WORD defValue)
{
	STREAM_DATA* data = findData(id);
	if(!data || data && (data->type != SDT_DATA || data->cbSize != sizeof(WORD)))
	{
		return defValue;
	}
	WORD ret = defValue;
	memcpy(&ret, data->lpData, sizeof(WORD));
	return ret;
}
Example #20
0
bool GxsIdChooser::setChosenId(const RsGxsId &gxsId)
{
	QString id = QString::fromStdString(gxsId.toStdString());

	/* Find text of exisiting item */
	int index = findData(id);
	if (index >= 0) {
		setCurrentIndex(index);
		return true;
	}
	return false;
}
Example #21
0
void LocaleComboBox::reset() {
	auto locale = currentLocale();
	clear();
	for (auto &it : d->items)
		it.update();
	qSort(d->items);
	d->system.update();
	addItem(tr("System locale[%1]").arg(d->system.name), d->system.locale);
	for (auto &it : d->items)
		addItem(it.name, it.locale);
	setCurrentIndex(findData(locale));
}
/**
 * Note that the returned pointer becomes invalid when additional metadata is set.
 */
bool MetaData::findCString(uint32_t key, const char **value) {
    uint32_t type;
    const void *data;
    size_t size;
    if (!findData(key, &type, &data, &size) || type != TYPE_C_STRING) {
        return false;
    }

    *value = (const char *)data;

    return true;
}
Example #23
0
    uint8 NodeMemory_v1::nextByte()
    {
        ByteStream* data = nullptr;
        uint16 offset = 0;

        //find the data to read from
        findData(m_currentAddress, &data, offset);

        m_currentAddress++;

        //read the data starting at the offset
        return data->read_uint8(offset);
    }
/******************************************************************************
* This is called whenever the node selection has changed.
******************************************************************************/
void SceneNodeSelectionBox::onSceneSelectionChanged()
{
	SelectionSet* selection = _datasetContainer.currentSet() ? _datasetContainer.currentSet()->selection() : nullptr;
	if(!selection || selection->empty()) {
		setCurrentText(tr("No selection"));
	}
	else if(selection->size() > 1) {
		setCurrentText(tr("%i selected objects").arg(selection->size()));
	}
	else {
		int index = findData(QVariant::fromValue(selection->node(0)));
		setCurrentIndex(index);
	}
}
bool MetaData::findPointer(uint32_t key, void **value) {
    uint32_t type;
    const void *data;
    size_t size;
    if (!findData(key, &type, &data, &size) || type != TYPE_POINTER) {
        return false;
    }

    CHECK_EQ(size, sizeof(*value));

    *value = *(void **)data;

    return true;
}
bool MetaData::findFloat(uint32_t key, float *value) {
    uint32_t type;
    const void *data;
    size_t size;
    if (!findData(key, &type, &data, &size) || type != TYPE_FLOAT) {
        return false;
    }

    CHECK_EQ(size, sizeof(*value));

    *value = *(float *)data;

    return true;
}
bool MetaData::findInt64(uint32_t key, int64_t *value) {
    uint32_t type;
    const void *data;
    size_t size;
    if (!findData(key, &type, &data, &size) || type != TYPE_INT64) {
        return false;
    }

    CHECK_EQ(size, sizeof(*value));

    *value = *(int64_t *)data;

    return true;
}
Example #28
0
void DictionaryComboBox::setCurrentByDictionary( const QString & dictionary )
{
    if ( dictionary.isEmpty() || dictionary == itemData( currentIndex() ).toString() )
        return;

    int idx = findData( dictionary );
    if ( idx == -1 ) {
        kDebug() << "dictionary not found" << dictionary;
        return;
    }

    setCurrentIndex( idx );
    d->slotDictionaryChanged( idx );
}
void FileParser::readFile(const std::string& filename) {
	m_contents.clear();
	if (filename.size() <= 0) { //obviously
		return;
	}

	m_filename = m_directory + filename;//set path

	std::ifstream input(m_directory + filename, std::ifstream::in);

	for (std::string line; getline(input, line);) {
		m_contents.push_back(line);
	}

	findData(); //get all the data
	findInstructions(); //get all the instructions
	moveToMemory(); //move them to memory

	input.close(); //close file
}
bool MetaData::findRect(
        uint32_t key,
        int32_t *left, int32_t *top,
        int32_t *right, int32_t *bottom) {
    uint32_t type;
    const void *data;
    size_t size;
    if (!findData(key, &type, &data, &size) || type != TYPE_RECT) {
        return false;
    }

    CHECK_EQ(size, sizeof(Rect));

    const Rect *r = (const Rect *)data;
    *left = r->mLeft;
    *top = r->mTop;
    *right = r->mRight;
    *bottom = r->mBottom;

    return true;
}