Example #1
0
int main(int argc, char *argv[])
{
   QCoreApplication app(argc, argv);
   QCoreApplication::setApplicationName("Find_books");
   QCoreApplication::setApplicationVersion("1.0");

   QCommandLineParser parser;
   parser.addHelpOption();
   parser.addVersionOption();
   parser.setApplicationDescription(QCoreApplication::translate("main","Find books from Gornica.ru."));


   parser.addPositionalArgument("s_file", QCoreApplication::translate("main", "Source file from read."));
   parser.addPositionalArgument("t_delay", QCoreApplication::translate("main", "Delay time."));

   parser.process(app);

   QList<QString> args = parser.positionalArguments();

   d_time=0;


#ifdef Q_OS_WIN32
   QTextCodec::setCodecForLocale(QTextCodec::codecForName("IBM 866"));
#endif

#ifdef Q_OS_LINUX
   QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
#endif
   //QTextStream Qcout(stdout);

   downloader = new Downloader(); // Инициализируем Downloader

   if (((args.size() < 1))) {
      printf("%s\n", qPrintable(QCoreApplication::translate("main", "Error: Must specify one filename argument.")));
      parser.showHelp(1);
   }
   else
   {

      m_File.append(args.value(0));
      d_time = args.value(1,"8000").toInt();
      m_CreateLists(m_File);
   }

   qDebug()  <<m_File;

   m_ReadF();
   app.exit();
}
Example #2
0
void qtDLGDisassembler::OnF2BreakPointPlace()
{
	QList<QTableWidgetItem *> currentSelectedItems = tblDisAs->selectedItems();
	if(currentSelectedItems.count() <= 0) return;

	quint64 dwSelectedVA = currentSelectedItems.value(0)->text().toULongLong(0,16);
	if(coreDebugger->AddBreakpointToList(NULL,DR_EXECUTE,-1,dwSelectedVA,NULL,true))
		currentSelectedItems.value(0)->setForeground(QColor(qtNanomiteDisAsColor->colorBP));
	else
	{// exists
		coreDebugger->RemoveBPFromList(dwSelectedVA,NULL);
		currentSelectedItems.value(0)->setForeground(QColor("Black"));
	}	
	return;
}
Example #3
0
QVariant QXmppInvokable::dispatch( const QByteArray & method, const QList< QVariant > & args )
{
    buildMethodHash();

    if( !m_methodHash.contains(method))
        return QVariant();

    int idx = m_methodHash[method];
    if( paramTypes( args) != metaObject()->method(idx).parameterTypes ())
        return QVariant();

    const char *typeName = metaObject()->method(idx).typeName();
    int resultType = QMetaType::type(typeName);
    void *result = QMetaType::construct(resultType, 0);

    QGenericReturnArgument ret( typeName, result );
    QList<QGenericArgument> genericArgs;
    QList<QVariant>::ConstIterator iter = args.begin();
    while( iter != args.end())
    {
        const void *data = iter->data();
        const char *name = iter->typeName();
        genericArgs << QGenericArgument(name,data);
        ++iter;
    }

    if( QMetaObject::invokeMethod ( this, method.constData(), ret,
                                    genericArgs.value(0, QGenericArgument() ),
                                    genericArgs.value(1, QGenericArgument() ),
                                    genericArgs.value(2, QGenericArgument() ),
                                    genericArgs.value(3, QGenericArgument() ),
                                    genericArgs.value(4, QGenericArgument() ),
                                    genericArgs.value(5, QGenericArgument() ),
                                    genericArgs.value(6, QGenericArgument() ),
                                    genericArgs.value(7, QGenericArgument() ),
                                    genericArgs.value(8, QGenericArgument() ),
                                    genericArgs.value(9, QGenericArgument() )) )
    {
        QVariant returnValue( resultType, result);
        QMetaType::destroy(resultType, result);
        return returnValue;
    }
    else
    {
        qDebug("No such method '%s'", method.constData() );
        return QVariant();
    }
}
Example #4
0
	void EntryBase::SetDiscoIdentities (const QString& variant, const QList<QXmppDiscoveryIq::Identity>& ids)
	{
		Variant2Identities_ [variant] = ids;

		const QString& name = ids.value (0).name ();
		const QString& type = ids.value (0).type ();
		if (name.contains ("Kopete"))
		{
			Variant2ClientInfo_ [variant] ["client_type"] = "kopete";
			Variant2ClientInfo_ [variant] ["client_name"] = "Kopete";
			Variant2ClientInfo_ [variant] ["raw_client_name"] = "kopete";
			emit statusChanged (GetStatus (variant), variant);
		}
		else if (name.contains ("emacs", Qt::CaseInsensitive) ||
				name.contains ("jabber.el", Qt::CaseInsensitive))
		{
			Variant2ClientInfo_ [variant] ["client_type"] = "jabber.el";
			Variant2ClientInfo_ [variant] ["client_name"] = "Emacs Jabber.El";
			Variant2ClientInfo_ [variant] ["raw_client_name"] = "jabber.el";
			emit statusChanged (GetStatus (variant), variant);
		}
		else if (type == "mrim")
		{
			Variant2ClientInfo_ [variant] ["client_type"] = "mailruagent";
			Variant2ClientInfo_ [variant] ["client_name"] = "Mail.Ru Agent Gateway";
			Variant2ClientInfo_ [variant] ["raw_client_name"] = "mailruagent";
			emit statusChanged (GetStatus (variant), variant);
		}
	}
Example #5
0
void qtDLGPEEditor::InsertImports()
{
	QList<APIData> imports = m_pEManager->getImports(m_currentFile);
	if(imports.size() <= 0) return;

	QTreeWidgetItem *topElement,
					*moduleElement;
	QString lastTopElement;
	quint64	dwOffset = NULL;

	topElement = new QTreeWidgetItem();
	topElement->setText(0,"Imports");
	treePE->addTopLevelItem(topElement);

	for(int importCount = 0; importCount < imports.size(); importCount++)
	{
		QStringList currentElement = imports.value(importCount).APIName.split("::");

		if(currentElement[0].compare(lastTopElement) != NULL)
		{	
			moduleElement = new QTreeWidgetItem(topElement);
			moduleElement->setText(0,currentElement[0]);  
			lastTopElement = currentElement[0];
			dwOffset = clsHelperClass::CalcOffsetForModule((PTCHAR)currentElement[0].toLower().toStdWString().c_str(),NULL,m_processID);
		}
		
		QTreeWidgetItem* childElement = new QTreeWidgetItem(moduleElement);
		childElement->setText(0,currentElement[1]);
		if(dwOffset == 0)
			childElement->setText(1,QString("%1").arg(0,16,16,QChar('0')));
		else
			childElement->setText(1,QString("%1").arg(clsHelperClass::RemoteGetProcAddr(currentElement[1],dwOffset,m_processID),16,16,QChar('0')));
	}
}
Example #6
0
Note* Score::upAlt(Element* element)
{
    Element* re = 0;
    if (element->type() == Element::REST) {
        if (_is.track() <= 0)
            return 0;
        _is.setTrack(_is.track() - 1);
        re = searchNote(static_cast<Rest*>(element)->tick(), _is.track());
    }
    else if (element->type() == Element::NOTE) {
        // find segment
        Chord* chord     = static_cast<Note*>(element)->chord();
        Segment* segment = chord->segment();

        // collect all notes for this segment in noteList:
        QList<Note*> rnl;
        int tracks = nstaves() * VOICES;
        for (int track = 0; track < tracks; ++track) {
            Element* el = segment->element(track);
            if (!el || el->type() != Element::CHORD)
                continue;
            rnl.append(static_cast<Chord*>(el)->notes());
            qSort(rnl.begin(), rnl.end(), noteLessThan);
            int idx = rnl.indexOf(static_cast<Note*>(element));
            if (idx < rnl.size()-1)
                ++idx;
            re = rnl.value(idx);
        }
    }
    if (re == 0)
        return 0;
    if (re->type() == Element::CHORD)
        re = ((Chord*)re)->notes().front();
    return (Note*)re;
}
Example #7
0
void MainWidget::refreshTable(QList<srt_stampuserInfo> stampUsrInfoList)
{
     m_tbWidget->setRowCount(stampUsrInfoList.size());
    for (int i=0; i<stampUsrInfoList.size(); i++)
    {
        srt_stampuserInfo stampUsrInfo=stampUsrInfoList.value(i);
        QTableWidgetItem *item1=new QTableWidgetItem(stampUsrInfo.usrName);
        item1->setTextAlignment(Qt::AlignCenter);
        QTableWidgetItem *item2=new QTableWidgetItem(stampUsrInfo.usrPassword);
        item2->setTextAlignment(Qt::AlignCenter);
        QTableWidgetItem *item3=new QTableWidgetItem(stampUsrInfo.usrPhone);
        item3->setTextAlignment(Qt::AlignCenter);
        QTableWidgetItem *item4= new QTableWidgetItem(stampUsrInfo.usrCode);
        item4->setTextAlignment(Qt::AlignCenter);
        QTableWidgetItem *item5= new QTableWidgetItem(stampUsrInfo.usrLoginState);
        item5->setTextAlignment(Qt::AlignCenter);
        QTableWidgetItem *item6= new QTableWidgetItem(stampUsrInfo.usrOrderStatue);
        item6->setTextAlignment(Qt::AlignCenter);
        m_tbWidget->setItem(i, 0, item1);
        m_tbWidget->setItem(i, 1, item2);
        m_tbWidget->setItem(i, 2, item3);
        m_tbWidget->setItem(i, 3, item4);
        m_tbWidget->setItem(i, 4, item5);
        m_tbWidget->setItem(i,5,item6);

    }
}
static PyObject *convertFrom_QList_1800(void *sipCppV, PyObject *)
{
   QList<int> *sipCpp = reinterpret_cast<QList<int> *>(sipCppV);

#line 632 "/Users/ktaylora/PLJV/tillage_likelihood_model/gui/PyQt4/sip/QtCore/qlist.sip"
    // Create the list.
    PyObject *l;

    if ((l = PyList_New(sipCpp->size())) == NULL)
        return NULL;

    // Set the list elements.
    for (int i = 0; i < sipCpp->size(); ++i)
    {
        PyObject *pobj;

        if ((pobj = SIPLong_FromLong(sipCpp->value(i))) == NULL)
        {
            Py_DECREF(l);

            return NULL;
        }

        PyList_SET_ITEM(l, i, pobj);
    }

    return l;
#line 139 "/Users/ktaylora/PLJV/tillage_likelihood_model/gui/PyQt4/QtCore/sipQtCoreQList1800.cpp"
}
Example #9
0
QWidget* PageClientQGraphicsWidget::ownerWidget() const
{
    if (QGraphicsScene* scene = view->scene()) {
        const QList<QGraphicsView*> views = scene->views();
        return views.value(0);
    }
    return 0;
}
Example #10
0
void QDBusViewer::callMethod(const BusSignature &sig)
{
    QDBusInterface iface(sig.mService, sig.mPath, sig.mInterface, c);
    const QMetaObject *mo = iface.metaObject();

    // find the method
    QMetaMethod method;
    for (int i = 0; i < mo->methodCount(); ++i) {
        const QString signature = QString::fromLatin1(mo->method(i).signature());
        if (signature.startsWith(sig.mName) && signature.at(sig.mName.length()) == QLatin1Char('('))
            if (getDbusSignature(mo->method(i)) == sig.mTypeSig)
                method = mo->method(i);
    }
    if (!method.signature()) {
        QMessageBox::warning(this, tr("Unable to find method"),
                tr("Unable to find method %1 on path %2 in interface %3").arg(
                    sig.mName).arg(sig.mPath).arg(sig.mInterface));
        return;
    }

    PropertyDialog dialog;
    QList<QVariant> args;

    const QList<QByteArray> paramTypes = method.parameterTypes();
    const QList<QByteArray> paramNames = method.parameterNames();
    QList<int> types; // remember the low-level D-Bus type
    for (int i = 0; i < paramTypes.count(); ++i) {
        const QByteArray paramType = paramTypes.at(i);
        if (paramType.endsWith('&'))
            continue; // ignore OUT parameters

        QVariant::Type type = QVariant::nameToType(paramType);
        dialog.addProperty(QString::fromLatin1(paramNames.value(i)), type);
        types.append(QMetaType::type(paramType));
    }

    if (!types.isEmpty()) {
        dialog.setInfo(tr("Please enter parameters for the method \"%1\"").arg(sig.mName));

        if (dialog.exec() != QDialog::Accepted)
            return;

        args = dialog.values();
    }

    // Special case - convert a value to a QDBusVariant if the
    // interface wants a variant
    for (int i = 0; i < args.count(); ++i) {
        if (types.at(i) == qMetaTypeId<QDBusVariant>())
            args[i] = QVariant::fromValue(QDBusVariant(args.at(i)));
    }

    QDBusMessage message = QDBusMessage::createMethodCall(sig.mService, sig.mPath, sig.mInterface,
            sig.mName);
    message.setArguments(args);
    c.callWithCallback(message, this, SLOT(dumpMessage(QDBusMessage)));
}
bool AddQtCreatorArrayValueOperation::performOperation()
{
    const QStringList args = arguments();

    if (args.count() != 4) {
        setError(InvalidArguments);
        setErrorString(tr("Invalid arguments in %0: %1 arguments given, exact 4 expected(group, "
                          "arrayname, key, value).").arg(name()).arg( arguments().count()));
        return false;
    }


    PackageManagerCore *const core = qVariantValue<PackageManagerCore*>(value(QLatin1String("installer")));
    if (!core) {
        setError(UserDefinedError);
        setErrorString(tr("Needed installer object in \"%1\" operation is empty.").arg(name()));
        return false;
    }
    const QString &rootInstallPath = core->value(scTargetDir);

    QSettings settings(rootInstallPath + QLatin1String(QtCreatorSettingsSuffixPath),
                       QSettings::IniFormat);

    const QString &group = groupName(args.at(0));
    const QString &arrayName = args.at(1);
    const QString &key = args.at(2);
    const QString &value = args.at(3);

    if (!group.isEmpty())
        settings.beginGroup(group);

    QList<QString> oldArrayValues;
    int arraySize = settings.beginReadArray(arrayName);
    for (int i = 0; i < arraySize; ++i) {
        settings.setArrayIndex(i);
        //if it is already there we have nothing todo
        if (settings.value(key).toString() == value)
            return true;
        oldArrayValues.append(settings.value(key).toString());
    }
    settings.endArray();


    settings.beginWriteArray(arrayName);

    for (int i = 0; i < oldArrayValues.size(); ++i) {
        settings.setArrayIndex(i);
        settings.setValue(key, oldArrayValues.value(i));
    }
    settings.setArrayIndex(oldArrayValues.size()); //means next index after the last insert
    settings.setValue(key, value);
    settings.endArray();

    settings.sync(); //be save ;)
    setValue(QLatin1String("ArrayValueSet"), true);
    return true;
}
Example #12
0
QList<QColor> MapColorReader::getListColor(QString colorName, QString numOfColor)
{
    int row = model->rowCount();
    QString textColorName;
    QString textNumOfColor;

    QList<int> idColorName;
    QList<int> idNumOfColor;

    QList<int> idRGB;

    for(int i=0; i < row; i++){
        textColorName = model->item(i,0)->text();
        textNumOfColor = model->item(i,1)->text();

        if(textColorName == colorName){
            idColorName.append(i);
        }

        if(textNumOfColor == numOfColor){
            idNumOfColor.append(i);
        }
    }

    for(int i=0; i<idColorName.size(); i++){
        for(int j=0; j<idNumOfColor.size(); j++){
            if(idColorName.value(i) == idNumOfColor.value(j)){
                idRGB.append(idColorName.value(i));
            }
        }
    }

    int r,g,b;
    QList<QColor> listColor;
    for(int i=0; i<idRGB.size(); i++){
        r = model->item(idRGB.value(i),5)->text().toInt();
        g = model->item(idRGB.value(i),6)->text().toInt();
        b = model->item(idRGB.value(i),7)->text().toInt();
        listColor.append(QColor(r,g,b));
    }

    return listColor;
}
Example #13
0
	void Account::handleFileList (const QList<DBoxItem>& items)
	{
		QList<StorageItem> result;

		for (const auto& item : items)
			result << CreateItem (item);

		emit gotListing (result);
		emit listingUpdated (result.value (0).ParentID_);
	}
Example #14
0
void ConfigTreeObject_Report::slotReportChannelTypeChange()
{
    QVariant value = ConfigTreeObject::getConfigObject(Config_Report_Delegate_ReportChannnel_Type)->getData();

    switch (value.toInt()) {
    case Channel_Type_Comm:
        ConfigTreeObject::getConfigObject(Config_Report_Delegate_ReportChannnel_ChannelNo)->changeData(CfgChannel::instance()->getExistChannelComm().first(), false);
        break;
    case Channel_Type_Math:
        ConfigTreeObject::getConfigObject(Config_Report_Delegate_ReportChannnel_ChannelNo)->changeData(CfgChannel::instance()->getExistChannelMath().first(), false);
        break;
    case Channel_Type_AI:
    case Channel_Type_DI:
    case Channel_Type_DO:
    {
        int tempModule, moduleMin;
        int code;
        tempModule = 0;
        QList<DevBoard *> boardList = CfgChannel::instance()->getList_BoardIO();

        moduleMin = boardList.value(0)->getBoardModule();
        for (int i = 0; i < boardList.size(); ++i) {
            if (boardList.value(i)->getBoardModule() < moduleMin) {
                tempModule = i;
                moduleMin = boardList.value(i)->getBoardModule();
            }
        }

        switch (boardList.value(tempModule)->getBoardType()) {
        case STATUS_BOARD_TYPE_AI:
            code = CHANNEL_AI_CODER(boardList.value(tempModule)->getBoardUnit(), moduleMin, 1);
            break;
        case STATUS_BOARD_TYPE_DI:
            code = CHANNEL_DI_CODER(boardList.value(tempModule)->getBoardUnit(), moduleMin, 1);
            break;
        case STATUS_BOARD_TYPE_DO:
            code = CHANNEL_DO_CODER(boardList.value(tempModule)->getBoardUnit(), moduleMin, 1);
            break;
        default:
            break;
        }
        ConfigTreeObject::getConfigObject(Config_Report_Delegate_ReportChannnel_ChannelNo)->changeData(code, false);
        break;
    }
    default:
        break;
    }


    QFile file(XML_Config_Report_ReportChannnel_Type);
     if(!file.open(QFile::ReadOnly | QFile::Text)){
        qWarning()<< "Can't open the file:Range:Type!";
     }else{
        XmlConfigParser::parseValueChangeXml(file, value);
        file.close();
     }
}
Example #15
0
void qtDLGDisassembler::OnDisAsReturnPressed()
{
	QList<QTableWidgetItem *> currentSelectedItems = tblDisAs->selectedItems();
	if(coreDebugger->GetCurrentProcessHandle() == NULL || currentSelectedItems.count() <= 0) return;

	quint64 dwSelectedVA = NULL;
	QString tempSelectedString = currentSelectedItems.value(2)->text();

	if(tempSelectedString.contains("ptr") || tempSelectedString.contains("ptr"))
		dwSelectedVA = tempSelectedString.split(" ")[3].replace("h","").replace("[","").replace("]","").toULongLong(0,16);
	else
		dwSelectedVA = tempSelectedString.split(" ")[1].replace("h","").toULongLong(0,16);

	if(dwSelectedVA != 0)
	{
		_OffsetWalkHistory.append(currentSelectedItems.value(0)->text().toULongLong(0,16));
		coreDisAs->InsertNewDisassembly(coreDebugger->GetCurrentProcessHandle(),dwSelectedVA);
	}
	return;
}
Example #16
0
void CDoodMemberManager::clearMemberList()
{
    qDebug() << Q_FUNC_INFO;
    QList<CDoodMemberItem*>  itemList = memberListMap.values();
    qDebug() << Q_FUNC_INFO<<itemList.size();
    for(int i= 0;i< itemList.size();i++){
        removeItem(itemList.value(i));
        delete itemList.value(i);
    }
    memberListMap.clear();

    itemList = groupLeaderListMap.values();
    qDebug() << Q_FUNC_INFO<<itemList.size();
    for(int i= 0;i< itemList.size();i++){
        removeItem(itemList.value(i));
        delete itemList.value(i);
    }
    groupLeaderListMap.clear();

    itemList = groupAdminListMap.values();
    qDebug() << Q_FUNC_INFO<<itemList.size();
    for(int i= 0;i< itemList.size();i++){
        removeItem(itemList.value(i));
        delete itemList.value(i);
    }
    groupAdminListMap.clear();
    reset();
    setMy_Type("1");
    setMemberSize("");
    mGroupid="";
}
Example #17
0
void KIPIPage::currentSelectionChanged()
{

    QList<QListWidgetItem*> items = listWidget->selectedItems();
    if (items.isEmpty()) {
        setPlugin(0);
        return;
    }

    KAction *plugin = m_interface->exportPlugins().at(items.value(0)->data(Qt::UserRole+1).toInt());
    setPlugin(plugin);

}
Example #18
0
QVariant TableModel::data(const QModelIndex &index, int role) const
{
    if (!index.isValid())
        return QVariant();

    if (index.row() >= listOfPairs.size() || index.row() < 0)
        return QVariant();

    if (role == Qt::DisplayRole) {
        QList<QString> pair = listOfPairs.at(index.row());

        return pair.value(index.column());
    }
    return QVariant();
}
Example #19
0
void QgsBrowserDockWidget::showEvent( QShowEvent * e )
{
  // delayed initialization of the model
  if ( !mModel )
  {
    mModel = new QgsBrowserModel( mBrowserView );

    connect( QgisApp::instance(), SIGNAL( newProject() ), mModel, SLOT( updateProjectHome() ) );

    mProxyModel = new QgsBrowserTreeFilterProxyModel( this );
    mProxyModel->setBrowserModel( mModel );
    mBrowserView->setSettingsSection( objectName().toLower() ); // to distinguish 2 instances ow browser
    mBrowserView->setModel( mProxyModel );
    // provide a horizontal scroll bar instead of using ellipse (...) for longer items
    mBrowserView->setTextElideMode( Qt::ElideNone );
    mBrowserView->header()->setResizeMode( 0, QHeaderView::ResizeToContents );
    mBrowserView->header()->setStretchLastSection( false );

    // selectionModel is created when model is set on tree
    connect( mBrowserView->selectionModel(), SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection & ) ),
             this, SLOT( selectionChanged( const QItemSelection &, const QItemSelection & ) ) );

    // objectName used by settingsSection() is not yet set in constructor
    QSettings settings;
    mPropertiesWidgetEnabled = settings.value( settingsSection() + "/propertiesWidgetEnabled", false ).toBool();
    mActionPropertiesWidget->setChecked( mPropertiesWidgetEnabled );
    mPropertiesWidget->setVisible( false ); // false until item is selected

    mPropertiesWidgetHeight = settings.value( settingsSection() + "/propertiesWidgetHeight" ).toFloat();
    QList<int> sizes = mSplitter->sizes();
    int total = sizes.value( 0 ) + sizes.value( 1 );
    int height = ( int )total * mPropertiesWidgetHeight;
    sizes.clear();
    sizes << total - height << height;
    mSplitter->setSizes( sizes );
  }
void KoPageNavigator::onPageNumberEntered()
{
    const int pageNumber = d->pageNumberEdit->text().toInt();

    KoPADocument *const kopaDocument = d->view->kopaDocument();
    KoPAPageBase *const activePage = d->view->activePage();

    const bool isMasterPage = (dynamic_cast<KoPAPage*>(activePage) == 0);

    const QList<KoPAPageBase*> pages = kopaDocument->pages(isMasterPage);

    KoPAPageBase* newPage = pages.value(pageNumber-1);
    if (newPage) {
        d->view->proxyObject->updateActivePage(newPage);
    }
}
Example #21
0
void qtDLGPEEditor::OnCustomContextMenu(QPoint qPoint)
{
	QMenu menu;

	m_selectedRow = treePE->indexAt(qPoint).row();
	QList<QTreeWidgetItem *> selectedItems = treePE->selectedItems();

	if(m_selectedRow < 0 || selectedItems.count() < 0) return;
	
	m_selectedOffset = selectedItems.value(0)->text(1).toULongLong(0,16);

	menu.addAction(new QAction("Show Offset in disassembler",this));
	connect(&menu,SIGNAL(triggered(QAction*)),this,SLOT(MenuCallback(QAction*)));

	menu.exec(QCursor::pos());
}
bool AddQtCreatorArrayValueOperation::undoOperation()
{
    if (value(QLatin1String("ArrayValueSet")).isNull())
        return true;
    const QStringList args = arguments();

    PackageManagerCore *const core = qVariantValue<PackageManagerCore*>(value(QLatin1String("installer")));
    if (!core) {
        setError(UserDefinedError);
        setErrorString(tr("Needed installer object in \"%1\" operation is empty.").arg(name()));
        return false;
    }
    const QString &rootInstallPath = core->value(scTargetDir);

    QSettings settings(rootInstallPath + QLatin1String(QtCreatorSettingsSuffixPath),
                       QSettings::IniFormat);

    const QString &group = groupName(args.at(0));
    const QString &arrayName = args.at(1);
    const QString &key = args.at(2);
    const QString &value = args.at(3);

    if (!group.isEmpty())
        settings.beginGroup(group);

    QList<QString> oldArrayValues;
    int arraySize = settings.beginReadArray(arrayName);
    for (int i = 0; i < arraySize; ++i) {
        settings.setArrayIndex(i);
        if (settings.value(key).toString() != value)
            oldArrayValues.append(settings.value(key).toString());
    }
    settings.endArray();


    settings.beginWriteArray(arrayName);

    for (int i = 0; i < oldArrayValues.size(); ++i) {
        settings.setArrayIndex(i);
        settings.setValue(key, oldArrayValues.value(i));
    }
    settings.endArray();

    settings.sync(); //be save ;)
    return true;
}
Example #23
0
void ActionsManager::setupWindowActions(QObject *window)
{
	if (!m_windowActions.contains(window))
	{
		return;
	}

	const QHash<QString, QAction*> actions = m_windowActions[window];
	QHash<QString, QAction*>::const_iterator windowActionsIterator;
	QWidget *widget = qobject_cast<QWidget*>(window);

	for (windowActionsIterator = actions.constBegin(); windowActionsIterator != actions.constEnd(); ++windowActionsIterator)
	{
		if (m_profileShortcuts.contains(windowActionsIterator.key()))
		{
			const QList<QKeySequence> keySequences = m_profileShortcuts[windowActionsIterator.key()];
			QList<QShortcut*> shortcuts;

			windowActionsIterator.value()->setShortcut(keySequences.value(0));

			for (int i = 1; i < keySequences.count(); ++i)
			{
				QShortcut *shortcut = new QShortcut(keySequences.at(i), widget);

				connect(shortcut, SIGNAL(activated()), windowActionsIterator.value(), SLOT(trigger()));

				shortcuts.append(shortcut);
			}

			if (!shortcuts.isEmpty())
			{
				m_actionShortcuts[windowActionsIterator.value()] = shortcuts;
			}
		}
		else
		{
			windowActionsIterator.value()->setShortcut(QKeySequence());
		}
	}

	widget->addActions(m_applicationActions.values());
}
Example #24
0
// --------------------------------------------------------------------------
voDataModelItem* voDataModel::addDataObjectAsChild(
    voDataObject * newDataObject, QStandardItem * parent)
{
  QList<QStandardItem*> items;
  for (int i= 0; i < this->columnCount(); ++i)
    {
    voDataModelItem* newDataModelItem = new voDataModelItem(newDataObject, i);
    items.append(newDataModelItem);
    }
  if (parent)
    {
    parent->appendRow(items);
    }
  else
    {
    this->appendRow(items);
    }

  return dynamic_cast<voDataModelItem*>(items.value(0));
}
Example #25
0
void
DynamicControlList::setControls( const geninterface_ptr& generator, const QList< dyncontrol_ptr >& controls )
{
    if( m_controls.size() == controls.size() && controls.size() > 0 ) { // check if we're setting the same controls we already have, and exit if we are
        bool different = false;
        for( int i = 0; i < m_controls.size(); i++ ) {
            if( m_controls.value( i )->control().data() != controls.value( i ).data() ) {
                different = true;
                break;
            }
        }
        if( !different ) { // no work to do
            return;
        }
    }

    if( !m_controls.isEmpty() ) {
        qDeleteAll( m_controls );
        m_controls.clear();
    }

    m_layout->removeItem( m_collapseLayout );

    m_generator = generator;
    if( controls.isEmpty() ) {
        qDebug() << "CREATING DEFAULT CONTROL";
        DynamicControlWrapper* ctrlW = new DynamicControlWrapper( generator->createControl(), m_layout, m_controls.size(), this );
        connect( ctrlW, SIGNAL( removeControl() ), this, SLOT( removeControl() ) );
        connect( ctrlW, SIGNAL( changed() ), this, SLOT( controlChanged() ) );
        m_controls << ctrlW;
    } else
    {
        foreach( const dyncontrol_ptr& control, controls ) {
            DynamicControlWrapper* ctrlW = new DynamicControlWrapper( control, m_layout, m_controls.size(), this );
            connect( ctrlW, SIGNAL( removeControl() ), this, SLOT( removeControl() ) );
            connect( ctrlW, SIGNAL( changed() ), this, SLOT( controlChanged() ) );

            m_controls << ctrlW;
        }
    }
Example #26
0
void EquipCard::use(Room *room, ServerPlayer *source, const QList<ServerPlayer *> &targets) const{
    const EquipCard *equipped = NULL;
    ServerPlayer *target = targets.value(0, source);
    
    switch(location()){
    case WeaponLocation: equipped = target->getWeapon(); break;
    case ArmorLocation: equipped = target->getArmor(); break;
    case DefensiveHorseLocation: equipped = target->getDefensiveHorse(); break;
    case OffensiveHorseLocation: equipped = target->getOffensiveHorse(); break;
    }

    if(equipped)
        room->throwCard(equipped, source);

    LogMessage log;
    log.from = target;
    log.type = "$Install";
    log.card_str = QString::number(getEffectiveId());
    room->sendLog(log);

    room->moveCardTo(this, target, Player::Equip, true);
}
Example #27
0
void TitleBar::onCommentsButtonClicked()
{
#ifdef USEWEBENGINE
    QWebEngineView* comments = noteView()->commentView();
#else
    CWizLocalProgressWebView* commentWidget = noteView()->commentWidget();
#endif
    if (commentWidget->isVisible()) {
        commentWidget->hide();

        WizGetAnalyzer().LogAction("hideComments");

        return;
    }

    WizGetAnalyzer().LogAction("showComments");

    if (isNetworkAccessible()) {
        if (!m_commentsUrl.isEmpty()) {
            commentWidget->showLocalProgress();
            commentWidget->web()->load(m_commentsUrl);
            QSplitter* splitter = qobject_cast<QSplitter*>(commentWidget->parentWidget());
            Q_ASSERT(splitter);
            QList<int> li = splitter->sizes();
            Q_ASSERT(li.size() == 2);
            QList<int> lin;
            lin.push_back(li.value(0) - COMMENT_FRAME_WIDTH);
            lin.push_back(li.value(1) + COMMENT_FRAME_WIDTH);
            splitter->setSizes(lin);
            commentWidget->show();
        } else {
            loadErrorPage();
            commentWidget->show();
        }

    } else {
        m_commentsBtn->setEnabled(false);
    }
}
Example #28
0
void qtDLGPEEditor::InsertExports()
{
	QList<APIData> exports = m_pEManager->getExports(m_currentFile);
	if(exports.size() <= 0) return;

	QTreeWidgetItem *topElement,
					*exportElement;
	PTCHAR currentFileBase = clsHelperClass::reverseStrip((PTCHAR)m_currentFile.c_str(),'\\');
	DWORD64 moduleBase = clsHelperClass::CalcOffsetForModule(currentFileBase,NULL,m_processID);

	topElement = new QTreeWidgetItem();
	topElement->setText(0,"Exports");
	treePE->addTopLevelItem(topElement);	

	for(int exportsCount = 0; exportsCount < exports.size(); exportsCount++)
	{		
		exportElement = new QTreeWidgetItem(topElement);
		exportElement->setText(0,exports.at(exportsCount).APIName);
		exportElement->setText(1,QString("%1").arg(exports.value(exportsCount).APIOffset + moduleBase,16,16,QChar('0')));  
	}

	clsMemManager::CFree(currentFileBase);
}
	void LocalBloggingPlatform::RegisterAccount (const QString& name,
			const QList<QWidget*>& widgets)
	{
		auto w = qobject_cast<AccountConfigurationWidget*> (widgets.value (0));
		if (!w)
		{
			qWarning () << Q_FUNC_INFO
					<< "got invalid widgets"
					<< widgets;
			return;
		}

		LocalBlogAccount *account = new LocalBlogAccount (name, this);
		account->FillSettings (w);

		const QString& path = w->GetAccountBasePath ();
		if (!path.isEmpty ())
		{
			Accounts_ << account;
			saveAccounts ();
			emit accountAdded (account);
			account->Init ();
		}
	}
Example #30
0
void CookieJar::saveCookies() {
    QFile cookieFile(QDir::homePath()+"/.ybdb/cookies");
	cookieFile.open(QFile::WriteOnly);

	qDebug() << "Saving all cookies: " << saveAll;
	//Save cookies, if there are in the allowesCookieDomains-list
	QList<QNetworkCookie> cookies = allCookies();

	for (int i = 0; i < cookies.size(); i++) {
		bool allowed = false;

		//Check if cookies may not be saved
		if (cookies.value(i).isSessionCookie()) continue;
		if (cookies.value(i).expirationDate() < QDateTime::currentDateTime()) continue;

		//Only save non session cookies and is not expirated
		foreach (QString d, allowedCookieDomains) {
			if (saveAll || cookies.value(i).domain().endsWith(d)) {
				allowed = true;
				break;
			}
		}

		if (allowed) {
			cookieFile.write(cookies.value(i).toRawForm()+"\n");
			qDebug() << "Saved cookie from: " << cookies.value(i).domain();
		} else {
			qDebug() << "Discarded cookie from: " << cookies.value(i).domain();
		}
	}
	cookieFile.flush();
	cookieFile.close();

	//Save the save all settings
	Settings::set("saveallcookies", QVariant(saveAll));
}