Example #1
1
void DatabaseInfo::acceptWidget(DomWidget *node)
{
    QHash<QString, DomProperty*> properties = propertyMap(node->elementProperty());

    DomProperty *frameworkCode = properties.value(QLatin1String("frameworkCode"), 0);
    if (frameworkCode && toBool(frameworkCode->elementBool()) == false)
        return;

    DomProperty *db = properties.value(QLatin1String("database"), 0);
    if (db && db->elementStringList()) {
        QStringList info = db->elementStringList()->elementString();

        QString connection = info.size() > 0 ? info.at(0) : QString();
        if (connection.isEmpty())
            return;
        m_connections.append(connection);

        QString table = info.size() > 1 ? info.at(1) : QString();
        if (table.isEmpty())
            return;
        m_cursors[connection].append(table);

        QString field = info.size() > 2 ? info.at(2) : QString();
        if (field.isEmpty())
            return;
        m_fields[connection].append(field);
    }

    TreeWalker::acceptWidget(node);
}
Example #2
0
void _placeCounter(QImage &img, int size, int count, style::color bg, style::color color) {
	if (!count) return;

	QPainter p(&img);
	QString cnt = (count < 100) ? QString("%1").arg(count) : QString("..%1").arg(count % 100, 2, 10, QChar('0'));
	int32 cntSize = cnt.size();

	p.setBrush(bg->b);
	p.setPen(Qt::NoPen);
	p.setRenderHint(QPainter::Antialiasing);
	int32 fontSize, skip;
	if (size == 22) {
		skip = 1;
		fontSize = 8;
	} else {
		skip = 2;
		fontSize = 16;
	}
	style::font f(fontSize);
	int32 w = f->width(cnt), d, r;
	if (size == 22) {
		d = (cntSize < 2) ? 3 : 2;
		r = (cntSize < 2) ? 6 : 5;
	} else {
		d = (cntSize < 2) ? 6 : 5;
		r = (cntSize < 2) ? 9 : 11;
	}
	p.drawRoundedRect(QRect(size - w - d * 2 - skip, size - f->height - skip, w + d * 2, f->height), r, r);

	p.setCompositionMode(QPainter::CompositionMode_Source);
	p.setFont(f->f);
	p.setPen(color->p);
	p.drawText(size - w - d - skip, size - f->height + f->ascent - skip, cnt);
}
Example #3
0
void QkConnectWorker::_slotProcessFinished(int status)
{
    QString version;
    switch(_currentTask)
    {
    case taskVersion:

        while(1)
        {
            QString line = QString(_process->readLine());
            if(line.isEmpty()) break;
            if(line.contains("[i]"))
            {
                version = line.split(' ', QString::SkipEmptyParts).at(1);
                break;
            }
        }
        emit message(MESSAGE_INFO,
                     "QkConnect " + version);
        break;
    case taskListSerial:
        QStringList portNames;
        while(1)
        {
            QString line = QString(_process->readLine());
            if(line.isEmpty()) break;
            if(line.contains("[i]"))
            {
                portNames << line.split(' ', QString::SkipEmptyParts).at(1);
            }
        }
        emit availableSerialPorts(portNames);
        break;
    }
}
    // Generate expression for this UE, also filter for SRs and RACH if indicated.
    const QString filterExpression(bool showSR, bool showRACH) {
        QString filter_expr;

        if (showSR) {
            filter_expr = QString("(mac-lte.sr-req and mac-lte.ueid == %1) or (").arg(ueid_);
        }

        if (showRACH) {
            filter_expr += QString("(mac-lte.rar or (mac-lte.preamble-sent and mac-lte.ueid == %1)) or (").arg(ueid_);
        }

        // Main expression matching this UE
        filter_expr += QString("mac-lte.ueid==%1 && mac-lte.rnti==%2").arg(ueid_).arg(rnti_);

        // Close () if open because of SR
        if (showSR) {
            filter_expr += QString(")");
        }
        // Close () if open because of RACH
        if (showRACH) {
            filter_expr += QString(")");
        }

        return filter_expr;
    }
Example #5
0
void SceneEdgeDialog::fillComboBox()
{
    logMessage("DSceneEdge::fillComboBox()");

    // start and end nodes
    cmbNodeStart->clear();
    cmbNodeEnd->clear();
    for (int i = 0; i<Util::scene()->nodes.count(); i++)
    {
        cmbNodeStart->addItem(QString("%1 - [%2; %3]").
                              arg(i).
                              arg(Util::scene()->nodes[i]->point.x, 0, 'e', 2).
                              arg(Util::scene()->nodes[i]->point.y, 0, 'e', 2),
                              Util::scene()->nodes[i]->variant());
        cmbNodeEnd->addItem(QString("%1 - [%2; %3]").
                            arg(i).
                            arg(Util::scene()->nodes[i]->point.x, 0, 'e', 2).
                            arg(Util::scene()->nodes[i]->point.y, 0, 'e', 2),
                            Util::scene()->nodes[i]->variant());
    }

    // markers
    cmbBoundary->clear();
    for (int i = 0; i<Util::scene()->boundaries.count(); i++)
    {
        cmbBoundary->addItem(Util::scene()->boundaries[i]->name, Util::scene()->boundaries[i]->variant());
    }
}
/*!
    Returns the type of bearer used by this network configuration as a string.

    The string is not translated and therefore can not be shown to the user. The subsequent table
    shows the fixed mappings between BearerType and the bearer type name for known types.  If the
    BearerType is unknown this function may return additional information if it is available;
    otherwise an empty string will be returned.

    \table
        \header
            \o BearerType
            \o Value
        \row
            \o BearerUnknown
            \o
            \o The session is based on an unknown or unspecified bearer type. The value of the
               string returned describes the bearer type.
        \row
            \o BearerEthernet
            \o Ethernet
        \row
            \o BearerWLAN
            \o WLAN
        \row
            \o Bearer2G
            \o 2G
        \row
            \o BearerCDMA2000
            \o CDMA2000
        \row
            \o BearerWCDMA
            \o WCDMA
        \row
            \o BearerHSPA
            \o HSPA
        \row
            \o BearerBluetooth
            \o Bluetooth
        \row
            \o BearerWiMAX
            \o WiMAX
    \endtable

    This function returns an empty string if this is an invalid configuration, a network
    configuration of type \l QNetworkConfiguration::ServiceNetwork or
    \l QNetworkConfiguration::UserChoice.

    \sa bearerType()
*/
QString QNetworkConfiguration::bearerTypeName() const
{
    if (!isValid())
        return QString();

    QMutexLocker locker(&d->mutex);

    if (d->type == QNetworkConfiguration::ServiceNetwork ||
            d->type == QNetworkConfiguration::UserChoice)
        return QString();

    switch (d->bearerType) {
    case BearerUnknown:
        return d->bearerTypeName();
    case BearerEthernet:
        return QLatin1String("Ethernet");
    case BearerWLAN:
        return QLatin1String("WLAN");
    case Bearer2G:
        return QLatin1String("2G");
    case BearerCDMA2000:
        return QLatin1String("CDMA2000");
    case BearerWCDMA:
        return QLatin1String("WCDMA");
    case BearerHSPA:
        return QLatin1String("HSPA");
    case BearerBluetooth:
        return QLatin1String("Bluetooth");
    case BearerWiMAX:
        return QLatin1String("WiMAX");
    }

    return QLatin1String("Unknown");
}
Example #7
0
/*
void MainWindow::get_amp_hid()
{
	int g;
	g = amp_ops->poll_amp_hid();
	if (g < 0)
		return;
	//amp->update_gain(g);
}
*/
void MainWindow::stop_amp()
{
    int x;

    save->delete_items();
    load->delete_items();
    quickpres->delete_items();

    x = amp_ops->stop_amp();
    if(x == 0)    // if request succeded
    {
        // deactivate buttons
        amp->enable_set_button(false);
        effect1->enable_set_button(false);
        effect2->enable_set_button(false);
        effect3->enable_set_button(false);
        effect4->enable_set_button(false);
        ui->actionConnect->setDisabled(false);
        ui->actionDisconnect->setDisabled(true);
        ui->actionSave_to_amplifier->setDisabled(true);
        ui->action_Load_from_amplifier->setDisabled(true);
        ui->actionSave_effects->setDisabled(true);
        ui->action_Library_view->setDisabled(true);
        setWindowTitle(QString(tr("RePlug")));
        setAccessibleName(QString(tr("Main window: None")));
        ui->statusBar->showMessage(tr("Disconnected"), 5000);    // show message on the status bar

        connected = false;
    }
    else    // if request failed
        ui->statusBar->showMessage(QString(tr("Error: %1")).arg(x), 5000);
}
Example #8
0
int main(int argc, char** argv)
{
   QGL::setPreferredPaintEngine(QPaintEngine::OpenGL);

   // The QApplication will strip its args from argc/argv, so we want to do 
   // this before putting the command-line args into our ArgumentList, or we
   // will try to open the Qt args as data files.
   QApplication app(argc, argv);
   SystemServicesImp::instance()->WriteLogInfo(QString("%1 Startup").arg(APP_NAME).toStdString());

   // Register the command line options
   ArgumentList* pArgumentList = ArgumentList::instance();
   if (pArgumentList == NULL)
   {
      SystemServicesImp::instance()->WriteLogInfo(QString("%1 Shutdown").arg(APP_NAME).toStdString());
      return -1;
   }

   pArgumentList->registerOption("input");
   pArgumentList->registerOption("deployment");
   pArgumentList->registerOption("debugDeployment");
   pArgumentList->registerOption("exitAfterWizards");
   pArgumentList->registerOption("generate");
   pArgumentList->registerOption("processors");
   pArgumentList->registerOption("");
   pArgumentList->set(argc, argv);

   // Run the application
   InteractiveApplication interactiveApp(app);
   int success = interactiveApp.run(argc, argv);

   SystemServicesImp::instance()->WriteLogInfo(QString("%1 Shutdown").arg(APP_NAME).toStdString());
   return success;
}
Example #9
0
void GreetModule::onMessageReceived(IrcMessage* message) {
	if (message->type() == IrcMessage::Join) {
			IrcJoinMessage* msg = static_cast<IrcJoinMessage*>(message);
			QString name = msg->sender().name();
			if (name != bot->nickName()) {
				QString greet = QString("Hi %1! Welcome in %2.").arg(name).arg(msg->channel());
				bot->sendCommand(IrcCommand::createMessage(msg->channel(), greet));
				out << "Greeted " << name << "." << endl;
			} else {
				QString enter = QString("enters %1 and fades to the background, immediatly available when somebody needs his services.").arg(msg->channel());
				bot->sendCommand(IrcCommand::createCtcpAction(msg->channel(), enter));
				out << "Joined " << msg->channel() << "." << endl;
			}
	} else if (message->type() == IrcMessage::Part) {
			IrcPartMessage* msg = static_cast<IrcPartMessage*>(message);
			QString name = msg->sender().name();
			QString bye = QString(" is shocked that %1 left %2 in favour of another channel.")
			.arg(name).arg(msg->channel());
			bot->sendCommand(IrcCommand::createCtcpAction(msg->channel(), bye));
			out << "Said good-bye to " << name << "." << endl;
			/*
	} else if (message->type() == IrcMessage::Quit) {
			IrcQuitMessage* msg = static_cast<IrcQuitMessage*>(message);
			QString name = msg->sender().name();
			QString bye = QString(" is a little sad that %1 left.").arg(name);
			bot->sendCommand(IrcCommand::createCtcpAction(bot->channel(), bye));
			out << "Said good-bye to " << name << "." << endl;
			*/
	}
}
Example #10
0
QString BitcoinUnits::format(int unit, const CAmount& nIn, bool fPlus, SeparatorStyle separators)
{
    // Note: not using straight sprintf here because we do NOT want
    // localized number formatting.
    if(!valid(unit))
        return QString(); // Refuse to format invalid unit
    qint64 n = (qint64)nIn;
    qint64 coin = factor(unit);
    int num_decimals = decimals(unit);
    qint64 n_abs = (n > 0 ? n : -n);
    qint64 quotient = n_abs / coin;
    qint64 remainder = n_abs % coin;
    QString quotient_str = QString::number(quotient);
    QString remainder_str = QString::number(remainder).rightJustified(num_decimals, '0');

    // Use SI-style thin space separators as these are locale independent and can't be
    // confused with the decimal marker.
    QChar thin_sp(THIN_SP_CP);
    int q_size = quotient_str.size();
    if (separators == separatorAlways || (separators == separatorStandard && q_size > 4))
        for (int i = 3; i < q_size; i += 3)
            quotient_str.insert(q_size - i, thin_sp);

    if (n < 0)
        quotient_str.insert(0, '-');
    else if (fPlus && n > 0)
        quotient_str.insert(0, '+');
    return quotient_str + QString(".") + remainder_str;
}
Example #11
0
QString getDownloadFilename(QString title, QString url)
{
    QString fileprefix = GetConfDir();

    QDir dir(fileprefix);
    if (!dir.exists())
        dir.mkdir(fileprefix);

    fileprefix += "/cache/metadata-thumbcache";

    dir = QDir(fileprefix);
    if (!dir.exists())
        dir.mkdir(fileprefix);

    QByteArray titlearr(title.toLatin1());
    quint16 titleChecksum = qChecksum(titlearr.data(), titlearr.length());
    QByteArray urlarr(url.toLatin1());
    quint16 urlChecksum = qChecksum(urlarr.data(), urlarr.length());
    QUrl qurl(url);
    QString ext = QFileInfo(qurl.path()).suffix();
    QString basefilename = QString("thumbnail_%1_%2.%3")
                           .arg(QString::number(urlChecksum))
                           .arg(QString::number(titleChecksum)).arg(ext);

    QString outputfile = QString("%1/%2").arg(fileprefix).arg(basefilename);

    return outputfile;
}
void FlickrWindow::writeSettings()
{
    KConfig config("kipirc");
    KConfigGroup grp = config.group(QString("%1Export Settings").arg(m_serviceName));
    grp.writeEntry("token", m_token);
    grp.writeEntry("Export Host Tags",                  m_exportHostTagsCheckBox->isChecked());
    grp.writeEntry("Show Extended Tag Options",         m_extendedTagsButton->isChecked());
    grp.writeEntry("Add Extra Tags",                    m_addExtraTagsCheckBox->isChecked());
    grp.writeEntry("Strip Space From Tags",             m_stripSpaceTagsCheckBox->isChecked());
    grp.writeEntry("Public Sharing",                    m_publicCheckBox->isChecked());
    grp.writeEntry("Family Sharing",                    m_familyCheckBox->isChecked());
    grp.writeEntry("Friends Sharing",                   m_friendsCheckBox->isChecked());
    grp.writeEntry("Show Extended Publication Options", m_extendedPublicationButton->isChecked());
    int safetyLevel = m_safetyLevelComboBox->itemData(m_safetyLevelComboBox->currentIndex()).toInt();
    grp.writeEntry("Safety Level",                      safetyLevel);
    int contentType = m_contentTypeComboBox->itemData(m_contentTypeComboBox->currentIndex()).toInt();
    grp.writeEntry("Content Type",                      contentType);
    grp.writeEntry("Resize",                            m_resizeCheckBox->isChecked());
    grp.writeEntry("Send original",                     m_sendOriginalCheckBox->isChecked());
    grp.writeEntry("Maximum Width",                     m_dimensionSpinBox->value());
    grp.writeEntry("Image Quality",                     m_imageQualitySpinBox->value());
    KConfigGroup dialogGroup = config.group(QString("%1Export Dialog").arg(m_serviceName));
    saveDialogSize(dialogGroup);
    config.sync();
}
void FlickrWindow::readSettings()
{
    KConfig config("kipirc");
    KConfigGroup grp = config.group(QString("%1Export Settings").arg(m_serviceName));
    m_token          = grp.readEntry("token");

    m_exportHostTagsCheckBox->setChecked(grp.readEntry("Export Host Tags",      false));
    m_extendedTagsButton->setChecked(grp.readEntry("Show Extended Tag Options", false));
    m_addExtraTagsCheckBox->setChecked(grp.readEntry("Add Extra Tags",          false));
    m_stripSpaceTagsCheckBox->setChecked(grp.readEntry("Strip Space From Tags", false));
    m_stripSpaceTagsCheckBox->setEnabled(m_exportHostTagsCheckBox->isChecked());

    if (!m_interface->hasFeature(KIPI::HostSupportsTags))
    {
        m_exportHostTagsCheckBox->setEnabled(false);
        m_stripSpaceTagsCheckBox->setEnabled(false);
    }

    m_publicCheckBox->setChecked(grp.readEntry("Public Sharing",                               false));
    m_familyCheckBox->setChecked(grp.readEntry("Family Sharing",                               false));
    m_friendsCheckBox->setChecked(grp.readEntry("Friends Sharing",                             false));
    m_extendedPublicationButton->setChecked(grp.readEntry("Show Extended Publication Options", false));

    int safetyLevel = m_safetyLevelComboBox->findData(QVariant(grp.readEntry("Safety Level", 0)));

    if (safetyLevel == -1)
    {
        safetyLevel = 0;
    }

    m_safetyLevelComboBox->setCurrentIndex(safetyLevel);

    int contentType = m_contentTypeComboBox->findData(QVariant(grp.readEntry("Content Type", 0)));

    if (contentType == -1)
    {
        contentType = 0;
    }

    m_contentTypeComboBox->setCurrentIndex(contentType);

    if (grp.readEntry("Resize", false))
    {
        m_resizeCheckBox->setChecked(true);
        m_dimensionSpinBox->setEnabled(true);
    }
    else
    {
        m_resizeCheckBox->setChecked(false);
        m_dimensionSpinBox->setEnabled(false);
    }

    m_sendOriginalCheckBox->setChecked(grp.readEntry("Send original", false));

    m_dimensionSpinBox->setValue(grp.readEntry("Maximum Width", 1600));
    m_imageQualitySpinBox->setValue(grp.readEntry("Image Quality", 85));

    KConfigGroup dialogGroup = config.group(QString("%1Export Dialog").arg(m_serviceName));
    restoreDialogSize(dialogGroup);
}
Example #14
0
	void PendingManager::EnablePackageInto (int id, PendingManager::Action action)
	{
		DepTreeBuilder builder (id);
		if (!builder.IsFulfilled ())
		{
			QStringList unful = builder.GetUnfulfilled ();
			qWarning () << Q_FUNC_INFO
					<< id
					<< "isn't fulfilled, aborting:"
					<< unful;
			QString list = QString ("<ul><li>%1</li></ul>")
					.arg (unful.join ("</li><li>"));
			throw std::runtime_error (tr ("Package dependencies "
					"could not be fulfilled: %1").arg (list)
					.toUtf8 ().constData ());
		}

		const auto& deps = builder.GetPackagesToInstall ();
		Deps_ [id] = deps;

		ScheduledForAction_ [action] << id;

		ListPackageInfo info = Core::Instance ().GetListPackageInfo (id);
		QStandardItem *packageItem = new QStandardItem (QString ("%1 (%2)")
				.arg (info.Name_)
				.arg (info.ShortDescription_));
		packageItem->setIcon (Core::Instance ().GetIconForLPI (info));
		Q_FOREACH (int dep, deps)
		{
			info = Core::Instance ().GetListPackageInfo (dep);
			QStandardItem *item = new QStandardItem (QString ("%1 (%2)")
					.arg (info.Name_)
					.arg (info.ShortDescription_));
			packageItem->appendRow (item);
		}
Example #15
0
void PsMainWindow::psUpdateCounter() {
	int32 counter = App::histories().unreadFull - (cIncludeMuted() ? 0 : App::histories().unreadMuted);

    setWindowTitle((counter > 0) ? qsl("Telegram (%1)").arg(counter) : qsl("Telegram"));
	setWindowIcon(wndIcon);

    QString cnt = (counter < 1000) ? QString("%1").arg(counter) : QString("..%1").arg(counter % 100, 2, 10, QChar('0'));
    _private.setWindowBadge(counter ? cnt : QString());

	if (trayIcon) {
		bool muted = cIncludeMuted() ? (App::histories().unreadMuted >= counter) : false;
		bool dm = objc_darkMode();

		style::color bg = muted ? st::counterMuteBG : st::counterBG;
		QIcon icon;
		QImage img(psTrayIcon(dm)), imgsel(psTrayIcon(true));
		img.detach();
		imgsel.detach();
		int32 size = cRetina() ? 44 : 22;
		_placeCounter(img, size, counter, bg, (dm && muted) ? st::counterMacInvColor : st::counterColor);
		_placeCounter(imgsel, size, counter, st::white, st::counterMacInvColor);
		icon.addPixmap(QPixmap::fromImage(img, Qt::ColorOnly));
		icon.addPixmap(QPixmap::fromImage(imgsel, Qt::ColorOnly), QIcon::Selected);
		trayIcon->setIcon(icon);
	}
}
Example #16
0
DistName::DistName(QWidget* parent)
    : QWidget(parent)
{
	DistNameLayout = new QGridLayout();
	DistNameLayout->setAlignment(Qt::AlignTop);
	DistNameLayout->setSpacing(6);
	DistNameLayout->setMargin(11);

	QGridLayout *g = new QGridLayout();
	g->setAlignment(Qt::AlignTop);
	g->setSpacing(6);
	g->setMargin(11);

	QVBoxLayout *v = new QVBoxLayout(this);
	v->setSpacing(6);
	v->setMargin(11);
	v->addLayout(DistNameLayout);
	v->addStretch();
	v->addLayout(g);

	rfc2253 = new QLineEdit(this);
	rfc2253->setReadOnly(true);
	g->addWidget(new QLabel(QString("RFC 2253:"), this), 0, 0);
	g->addWidget(rfc2253, 0, 1);

	namehash = new QLineEdit(this);
	namehash->setReadOnly(true);
	g->addWidget(new QLabel(QString("Hash:"), this), 1, 0);
	g->addWidget(namehash, 1, 1);
}
Example #17
0
/**
 * Handles command line arguments that might not require a GUI.
 *
 * @return list of files to load on startup.
 */
QStringList handleArgs(int argc, char** argv) {
        RS_DEBUG->print("main: handling args..");
        QStringList ret;

        bool doexit = false;
        QString machine;
        QString input;
        QString output;

        for (int i=1; i<argc; i++) {
                if (QString(argv[i]).startsWith("-")==false) {
                        QString fname = QDir::toNativeSeparators(
                                QFileInfo(QFile::decodeName(argv[i])).absoluteFilePath() );
                        ret.append(fname);
                }
                else if (QString(argv[i])=="--exit") {
                        doexit = true;
                }
        }

        if (doexit) {
                exit(0);
        }

        RS_DEBUG->print("main: handling args: OK");
        return ret;
}
//-----------------------------------------------------------------------------
int ctkVTKScalarsToColorsUtilsTest1(int argc, char * argv [] )
{
  QApplication app(argc, argv);

  vtkSmartPointer<vtkColorTransferFunction> ctf =
    vtkSmartPointer<vtkColorTransferFunction>::New();
  ctf->AddRGBPoint(-0.5, 194./255,  78./255,  68./255);
  ctf->AddRGBPoint(2.2, 194./255, 141./255,  68./255);
  ctf->AddRGBPoint(3.3,  68./255, 194./255,  78./255);
  ctf->AddRGBPoint(4.8,  68./255, 194./255, 141./255);
  ctf->AddRGBPoint(5.9,  78./255,  68./255, 194./255);
  ctf->AddRGBPoint(7.0, 141./255,  68./255, 194./255);
  
  QImage image = ctk::scalarsToColorsImage(ctf);

  QLabel label;
  label.setPixmap( QPixmap::fromImage(image));
  label.show();

  QLabel label2;
  label2.setText( QString("<img src=\"%1\">: text")
    .arg(ctk::base64HTMLImageTagSrc(image)));
  label2.show();
  
  if (argc < 2 || QString(argv[1]) != "-I")
    {
    QTimer::singleShot(200, &app, SLOT(quit()));
    }
  return app.exec();
}
Example #19
0
void Config::processArgs(const QStringList &args)
{
    connect(m_cmdLine, SIGNAL(switchFound(const QString &)), this, SLOT(handleSwitch(const QString &)));
    connect(m_cmdLine, SIGNAL(optionFound(const QString &, const QVariant &)), this, SLOT(handleOption(const QString &, const QVariant &)));
    connect(m_cmdLine, SIGNAL(paramFound(const QString &, const QVariant &)), this, SLOT(handleParam(const QString &, const QVariant &)));
    connect(m_cmdLine, SIGNAL(parseError(const QString &)), this, SLOT(handleError(const QString &)));

    m_cmdLine->setArguments(args);
    m_cmdLine->setConfig(flags);
    m_cmdLine->parse();

    // Inject command line parameters to be picked up by GhostDriver
    if (isWebdriverMode()) {
        QStringList argsForGhostDriver;

        m_scriptFile = "main.js";                                           //< launch script

        argsForGhostDriver << QString("--ip=%1").arg(m_webdriverIp);        //< "--ip=IP"
        argsForGhostDriver << QString("--port=%1").arg(m_webdriverPort);    //< "--port=PORT"

        if (!m_webdriverSeleniumGridHub.isEmpty()) {
            argsForGhostDriver << QString("--hub=%1").arg(m_webdriverSeleniumGridHub);  //< "--hub=SELENIUM_GRID_HUB_URL"
        }

        if (!m_webdriverLogFile.isEmpty()) {
            argsForGhostDriver << QString("--logFile=%1").arg(m_webdriverLogFile);          //< "--logFile=LOG_FILE"
            argsForGhostDriver << "--logColor=false";                                   //< Force no-color-output in Log File
        }

        argsForGhostDriver << QString("--logLevel=%1").arg(m_webdriverLogLevel);    //< "--logLevel=LOG_LEVEL"

        // Clear current args and override with those
        setScriptArgs(argsForGhostDriver);
    }
}
QString Kleo::gpg4winInstallPath() {
#ifndef _WIN32_WCE
    return gpgConfListDir( "bindir" );
#else
    HKEY hKey;
    TCHAR *lszValue;
    DWORD dwType=REG_SZ;
    DWORD dwSize;

    if ( ERROR_SUCCESS!=RegOpenKeyExW ( HKEY_LOCAL_MACHINE, L"Software\\GNU\\GnuPG", 0, KEY_READ, &hKey ) ){
      return QString();
    }

    if ( ERROR_SUCCESS!=RegQueryValueExW ( hKey, L"Install Directory", NULL, NULL, NULL, &dwSize ) ){
      return QString();
    }

    lszValue = new TCHAR[dwSize];

    if ( ERROR_SUCCESS!=RegQueryValueExW ( hKey,L"Install Directory", NULL, &dwType, ( LPBYTE ) lszValue, &dwSize ) ) {
        delete [] lszValue;
        return QString();
    }
    RegCloseKey ( hKey );

    QString res = QString::fromUtf16 ( ( const ushort* ) lszValue );
    delete [] lszValue;

    return res;
#endif
}
Example #21
0
int MainWindow::save_on_amp(char *name, int slot)
{
    int ret;

    if(!connected)
        return -1;

    ret = amp_ops->save_on_amp(name, slot);

    if(name[0] == 0x00)
    {
        setWindowTitle(QString(tr("RePlug: NONE")));
        setAccessibleName(QString(tr("Main window: NONE")));
    }
    else
    {
        setWindowTitle(QString(tr("RePlug: %1")).arg(name));
        setAccessibleName(QString(tr("Main window: %1")).arg(name));
    }

    current_name=name;
    memcpy(names[slot], name, 32);

    return ret;
}
QString Kleo::gpgConfListDir( const char * which ) {
    if ( !which || !*which )
        return QString();
    const QString gpgConfPath = Kleo::gpgConfPath();
    if ( gpgConfPath.isEmpty() )
        return QString();
    QProcess gpgConf;
    kDebug() << "gpgConfListDir: starting " << qPrintable( gpgConfPath ) << " --list-dirs";
    gpgConf.start( gpgConfPath, QStringList() << QLatin1String( "--list-dirs" ) );
    if ( !gpgConf.waitForFinished() ) {
        kDebug() << "gpgConfListDir(): failed to execute gpgconf: " << qPrintable( gpgConf.errorString() );
        kDebug() << "output was:" << endl << gpgConf.readAllStandardError().constData();
        return QString();
    }
    const QList<QByteArray> lines = gpgConf.readAllStandardOutput().split( '\n' );
    Q_FOREACH( const QByteArray & line, lines )
        if ( line.startsWith( which ) && line[qstrlen(which)] == ':' ) {
            const int begin = qstrlen(which) + 1;
            int end = line.size();
            while ( end && ( line[end-1] == '\n' || line[end-1] == '\r' ) )
                --end;
            const QString result = QDir::fromNativeSeparators( QFile::decodeName( hexdecode( line.mid( begin, end - begin ) ) ) );
            kDebug() << "gpgConfListDir: found " << qPrintable( result )
                     << " for '" << which << "'entry";
            return result;
        }
    kDebug() << "gpgConfListDir(): didn't find '" << which << "'"
             << "entry in output:" << endl << gpgConf.readAllStandardError().constData();
    return QString();
}
Example #23
0
File: Util.cpp Project: Emdek/WMIT
inline QString getWZMTextureName(const QString& filePath)
{
	QFile f(filePath);
	if (!f.open(QFile::ReadOnly))
	{
		return QString();
	}
	QTextStream in(&f);
	QString qstr;
	unsigned uint;

	if (in.status() != QTextStream::Ok || qstr.compare("WZM") != 0)
	{
		return  QString();
	}

	in >> uint;
	if (in.status() != QTextStream::Ok)
	{
		return  QString();
	}

	in >> qstr;
	if (qstr.compare("TEXTURE") != 0)
	{
		return  QString();
	}
	in >> qstr;
	if (in.status() != QTextStream::Ok)
	{
		return  QString();
	}
	return qstr;
}
Example #24
0
QString BitcoinUnits::format(int unit, qint64 n, bool fPlus)
{
    // Note: not using straight sprintf here because we do NOT want
    // localized number formatting.
    if(!valid(unit))
        return QString(); // Refuse to format invalid unit
    qint64 coin = factor(unit);
    int num_decimals = decimals(unit);
    qint64 n_abs = (n > 0 ? n : -n);
    qint64 quotient = n_abs / coin;
    qint64 remainder = n_abs % coin;
    QString quotient_str = QString::number(quotient);
    QString remainder_str = QString::number(remainder).rightJustified(num_decimals, '0');

    // Right-trim excess zeros after the decimal point
    int nTrim = 0;
    for (int i = remainder_str.size()-1; i>=2 && (remainder_str.at(i) == '0'); --i)
        ++nTrim;
    remainder_str.chop(nTrim);

    if (n < 0)
        quotient_str.insert(0, '-');
    else if (fPlus && n > 0)
        quotient_str.insert(0, '+');
    return quotient_str + QString(".") + remainder_str;
}
    // Generate expression for this UE and direction, also filter for SRs and RACH if indicated.
    const QString filterExpression(bool showSR, bool showRACH) {
        int direction = (type() == mac_dlsch_packet_count_row_type) ||
                        (type() == mac_dlsch_byte_count_row_type);

        QString filter_expr;

        if (showSR) {
            filter_expr = QString("(mac-lte.sr-req and mac-lte.ueid == %1) or (").arg(ueid_);
        }

        if (showRACH) {
            filter_expr += QString("(mac-lte.rar or (mac-lte.preamble-sent and mac-lte.ueid == %1)) or (").arg(ueid_);
        }

        // Main expression matching this UE and direction
        filter_expr += QString("mac-lte.ueid==%1 && mac-lte.rnti==%2 && mac-lte.direction==%3").
                              arg(ueid_).arg(rnti_).arg(direction);

        // Close () if open because of SR
        if (showSR) {
            filter_expr += QString(")");
        }
        // Close () if open because of RACH
        if (showRACH) {
            filter_expr += QString(")");
        }

        return filter_expr;
    }
Example #26
0
GsRenderEngine::GsRenderEngine(QObject *parent) :
    QObject(parent)
{
    QString path=getConfigFile();
    QSettings FicheroIni(path,QSettings::IniFormat,0);
    FicheroIni.beginGroup(QString("RENDER"));
    m_strExecutable=FicheroIni.value(QString("Application"),DEFAULT_EXECUTABLE).toString();
    if (m_strExecutable.length()){
        if (m_strExecutable.at(0)=='.'){ //Suponemos directorio local
            QString foo=m_strExecutable;
            foo.remove(0,1);
            m_strExecutable=QString("%1%2").arg(QApplication::applicationDirPath()).arg(foo);
        }
    }
    m_strDevice=FicheroIni.value(QString("Device"),DEFAULT_DEVICE).toString();
    m_strResolution=FicheroIni.value(QString("Resolution"),DEFAULT_RESOLUTION).toString();
    m_strExtraOptions=FicheroIni.value(QString("Options"),DEFAULT_OPTIONS).toString();
    m_strICCFile=FicheroIni.value(QString("ICC"),DEFAULT_ICC).toString();
    QString foo=FicheroIni.value(QString("Installer"),DEFAULT_INSTALLER).toString();
    if (!foo.isEmpty()) {
        if (foo.at(0)=='.') m_strInstaller=QString("%1%2").arg(QApplication::applicationDirPath()).arg(foo.mid(1,foo.count()-1));
        else m_strInstaller=QString("%1\\Installers\\%2").arg(QApplication::applicationDirPath()).arg(foo);
    }
    m_command="";
    m_doubleRes=false;
    FicheroIni.endGroup();
}
Example #27
0
MainCursesWindow::MainCursesWindow( CursesControl* aParent ) : 
	CursesWindow( aParent )
{
    iVUMeter = new CursesVUMeter(this);
    iTargetLevel = new CursesSetBar(this, QString("test"), 10);
    iExtraLevel = new CursesSetBar(this, QString("test2"), 10);
    iTest = new CursesBar(this, QString("test2"), 10);

    iAudioSource = new CursesAudioSource( this );

    connect( iTargetLevel, SIGNAL( valueChanged(int) ),
             iTest, SLOT( setValue(int) ) );
    iVUMeter->setRect(0, 0, 80, 3);
    iTargetLevel->setRect(0, 4, 80, 1);
    iTest->setRect(0, 5, 80, 1);
    iExtraLevel->setRect(0, 7, 80, 1);
    iAudioSource->setRect(0, 10, 80, 1);

    connect( &lametus, SIGNAL( audioSourceCreated( AudioSource* ) ),
        this, SLOT( audioSourceCreated( AudioSource* ) ) );
    connect( &lametus, SIGNAL( audioSourceUpdated( AudioSource* ) ),
        this, SLOT( audioSourceUpdated( AudioSource* ) ) );
    connect( &lametus, SIGNAL( encoderCreated( Encoder* ) ),
        this, SLOT( encoderCreated( Encoder* ) ) );
    connect( &lametus, SIGNAL( errorMessage( QString ) ),
        this, SLOT( errorMessage( QString ) ) );
    connect( &lametus, SIGNAL( peakMonitorCreated( PeakMonitor* ) ),
        this, SLOT( peakMonitorCreated( PeakMonitor* ) ) );

    lametus.initialize();
}
Example #28
0
/*
  put the current file name in the title bar
*/
void MainWindow::updateTitle() {
    if (fileOpen)
        this->setWindowTitle(QString("%1 - %2").arg(INFO_TITLE)
                             .arg(QString(fileName)));
    else
        this->setWindowTitle(INFO_TITLE);
}
Example #29
0
void MainWindow::on_OpenFile_triggered()
{
    //Check if data configs are valid
    if( configs.check() )
    {
        LogCritical(QString("Error! *.INI configs not loaded"));
        QMessageBox::warning(this, tr("Configuration is loaded with errors"),
                             tr("Editor cannot open files:\nConfiguration package is loaded with errors.").arg(ConfStatus::configPath));
        //Show configuration status window
        on_actionCurConfig_triggered();
        return;
    }

     QString fileName_DATA = QFileDialog::getOpenFileName(this,
        trUtf8("Open file"),GlobalSettings::openPath,
        QString("All supported formats (*.lvlx *.wldx *.lvl *.wld npc-*.txt *.sav);;"
        "All SMBX files (*.lvl *.wld npc-*.txt);;"
        "All PGE files (*.lvlx *.wldx npc-*.txt);;"
        "SMBX Level (*.lvl);;"
        "PGE Level (*.lvlx);;"
        "SMBX World (*.wld);;"
        "PGE World (*.wldx);;"
        "SMBX NPC Config (npc-*.txt);;"
        "SMBX Game Save file (*.sav);;"
        "All Files (*.*)"),0);

        if(fileName_DATA==NULL) return;

        OpenFile(fileName_DATA);
}
void AELoadedResourcesTreeView::LoadModelAnimations(Anima::AnimaModel* model, QStandardItem* parentItem)
{
	QStandardItem *animationItem1 = new QStandardItem(QString("Animations"));
	animationItem1->setEditable(false);

	QStandardItem *animationItem2 = new QStandardItem(QString(""));
	animationItem2->setEditable(false);

	QList<QStandardItem*> newItem;
	newItem.append(animationItem1);
	newItem.append(animationItem2);

	parentItem->appendRow(newItem);

	int count = model->GetAnimationsCount();
	for (int i = 0; i < count; i++)
	{
		Anima::AnimaAnimation* animation = model->GetAnimation(i);

		QStandardItem *animationItem3 = new QStandardItem(QString("%0").arg(animation->GetName()));
		animationItem3->setData(QVariant::fromValue(animation), MeshRole);
		animationItem3->setEditable(false);

		QStandardItem *animationItem4 = new QStandardItem(QString(""));
		animationItem4->setData(QVariant::fromValue(animation), MeshRole);
		animationItem4->setEditable(false);

		newItem.clear();
		newItem.append(animationItem3);
		newItem.append(animationItem4);

		animationItem1->appendRow(newItem);
	}
}