Esempio n. 1
0
iisTaskHeader::iisTaskHeader(const QIcon &icon, const QString &title, bool expandable, QWidget *parent)
  : QFrame(parent),
  myExpandable(expandable),
  m_over(false),
  m_buttonOver(false),
  m_fold(true),
  m_opacity(0.1),
  myButton(0)
{
  myTitle = new iisIconLabel(icon, title, this);
  myTitle->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);

  connect(myTitle, SIGNAL(activated()), this, SLOT(fold()));

  QHBoxLayout *hbl = new QHBoxLayout();
  hbl->setMargin(2);
  setLayout(hbl);

  hbl->addWidget(myTitle);

  setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);

  setScheme(iisTaskPanelScheme::defaultScheme());
  myTitle->setSchemePointer(&myLabelScheme);


  if (myExpandable) {
    myButton = new QLabel(this);
    hbl->addWidget(myButton);
    myButton->installEventFilter(this);
    myButton->setFixedWidth(myScheme->headerButtonSize.width());
    changeIcons();
  }
}
Esempio n. 2
0
void URI::parse(const std::string& uri)
{
	std::string::const_iterator it  = uri.begin();
	std::string::const_iterator end = uri.end();
	if (it == end) return;
	if (*it != '/' && *it != '.' && *it != '?' && *it != '#')
	{
		std::string scheme;
		while (it != end && *it != ':' && *it != '?' && *it != '#' && *it != '/') scheme += *it++;
		if (it != end && *it == ':')
		{
			++it;
			if (it == end) throw SyntaxException("URI scheme must be followed by authority or path", uri);
			setScheme(scheme);
			if (*it == '/')
			{
				++it;
				if (it != end && *it == '/')
				{
					++it;
					parseAuthority(it, end);
				}
				else --it;
			}
			parsePathEtc(it, end);
		}
		else 
		{
			it = uri.begin();
			parsePathEtc(it, end);
		}
	}
	else parsePathEtc(it, end);
}
Esempio n. 3
0
TaskHeader::TaskHeader(const QIcon &icon, const QString &title, bool expandable, QWidget *parent)
  : BaseClass(parent),
  myExpandable(expandable),
  m_over(false),
  m_buttonOver(false),
  m_fold(true),
  m_opacity(0.1),
  myButton(0)
{
    setProperty("class", "header");

    myTitle = new ActionLabel(this);
    myTitle->setProperty("class", "header");
    myTitle->setText(title);
    myTitle->setIcon(icon);
    myTitle->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);

    connect(myTitle, SIGNAL(clicked()), this, SLOT(fold()));

    QHBoxLayout *hbl = new QHBoxLayout();
    hbl->setMargin(2);
    setLayout(hbl);

    hbl->addWidget(myTitle);

    setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);

    setScheme(ActionPanelScheme::defaultScheme());
    //myTitle->setSchemePointer(&myLabelScheme);

    setExpandable(myExpandable);
}
Esempio n. 4
0
void
MainWindow::visitMkvmergeDocumentation() {
  auto appDirPath     = App::applicationDirPath();
  auto potentialPaths = QStringList{};

  try {
    auto localeStr = locale_string_c{to_utf8(Util::Settings::get().localeToUse())};

    potentialPaths << Q("%1/doc/%2").arg(appDirPath).arg(Q(localeStr.str(locale_string_c::full)));
    potentialPaths << Q("%1/doc/%2").arg(appDirPath).arg(Q(localeStr.str(static_cast<locale_string_c::eval_type_e>(locale_string_c::language | locale_string_c::territory))));
    potentialPaths << Q("%1/doc/%2").arg(appDirPath).arg(Q(localeStr.str(locale_string_c::language)));

  } catch (mtx::locale_string_format_x const &) {
  }

  potentialPaths << Q("%1/doc/en").arg(appDirPath);

  auto url = QUrl{};

  for (auto const &path : potentialPaths) {
    auto fileName = Q("%1/mkvmerge.html").arg(path);

    if (QFileInfo{fileName}.exists()) {
      url.setScheme(Q("file"));
      url.setPath(fileName);
      break;
    }
  }

  if (url.isEmpty())
    url = m_helpURLs[ui->actionHelpMkvmergeDocumentation];

  QDesktopServices::openUrl(url);
}
Esempio n. 5
0
int sign(TPMI_DH_OBJECT keyHandle, TPMI_ALG_HASH halg, BYTE *msg, UINT16 length, TPMT_TK_HASHCHECK *validation, const char *outFilePath)
{
    UINT32 rval;
    TPM2B_DIGEST digest;
    TPMT_SIG_SCHEME inScheme;
    TPMT_SIGNATURE signature;

    TSS2_SYS_CMD_AUTHS sessionsData;
    TPMS_AUTH_RESPONSE sessionDataOut;
    TSS2_SYS_RSP_AUTHS sessionsDataOut;
    TPMS_AUTH_COMMAND *sessionDataArray[1];
    TPMS_AUTH_RESPONSE *sessionDataOutArray[1];

    sessionDataArray[0] = &sessionData;
    sessionsData.cmdAuths = &sessionDataArray[0];
    sessionDataOutArray[0] = &sessionDataOut;
    sessionsDataOut.rspAuths = &sessionDataOutArray[0];
    sessionsDataOut.rspAuthsCount = 1;
    sessionsData.cmdAuthsCount = 1;

    sessionData.sessionHandle = TPM_RS_PW;
    sessionData.nonce.t.size = 0;
    *((UINT8 *)((void *)&sessionData.sessionAttributes)) = 0;

    if(computeDataHash(msg, length, halg, &digest))
    {
        printf("Compute message hash failed !\n");
        return -1;
    }

    printf("\ndigest(hex type):\n ");
    for(UINT16 i = 0; i < digest.t.size; i++)
         printf("%02x ", digest.t.buffer[i]);
    printf("\n");

    if(setScheme(keyHandle, halg, &inScheme))
    {
        printf("No suitable signing scheme!\n");
        return -2;
    }

    rval = Tss2_Sys_Sign(sysContext, keyHandle, &sessionsData, &digest, &inScheme, validation, &signature, &sessionsDataOut);
    if(rval != TPM_RC_SUCCESS)
    {
        printf("tpm2_sign failed, error code: 0x%x\n", rval);
        return -3;
    }
    printf("\ntpm2_sign succ.\n");

    if(saveDataToFile(outFilePath, (UINT8 *)&signature, sizeof(signature)))
    {
        printf("failed to save signature into %s\n", outFilePath);
        return -4;
    }

    return 0;
}
Esempio n. 6
0
QURequestUrl::QURequestUrl(const QString &host, const QStringList &properties, QUSongInterface *song): QUrl() {	
	_song = song;
	_properties = properties;

	// setup this URL instance
	setScheme("http");
	setHost(host);
	setQueryDelimiters('=', '&');
}
Esempio n. 7
0
void SpecialConfigRequest::performDnsRequest() {
	auto dnsUrl = QUrl();
	dnsUrl.setScheme(qsl("https"));
	dnsUrl.setHost(qsl("google.com"));
	dnsUrl.setPath(qsl("/resolve"));
	dnsUrl.setQuery(qsl("name=%1.stel.com&type=16").arg(cTestMode() ? qsl("tap") : qsl("ap")));
	auto dnsRequest = QNetworkRequest(QUrl(dnsUrl));
	dnsRequest.setRawHeader("Host", "dns.google.com");
	_dnsReply.reset(_manager.get(dnsRequest));
	connect(_dnsReply.get(), &QNetworkReply::finished, this, [this] { dnsFinished(); });
}
Esempio n. 8
0
AddFacError::AddFacError() :
    ui(new Ui::AddFacError)
{
    ui->setupUi(this);

    connect(ui->okBtn, SIGNAL(pressed()), this, SLOT(okBtn_clicked()));

    QImage warning("warning.jpg");
    setScheme();

}
Esempio n. 9
0
void amqp::Address::setAddress(std::string const &host,
	std::string const &user,
	std::string const &password,
	std::string const &path,
	int port,
	std::string const &scheme)
{
	setHost(host);
	setUser(user);
	setPassword(password);
	setPath(path);
	setPort(port);
	setScheme(scheme);
}
Esempio n. 10
0
//-------------------------------------------------------------------------------------------------
inline void_t
Uri::setUri(
    std::ctstring_t &a_scheme,
    std::ctstring_t &a_authority,
    std::ctstring_t &a_path,
    std::ctstring_t &a_query,
    std::ctstring_t &a_fragment
)
{
    setScheme   (a_scheme);
    setAuthority(a_authority);
    setPath     (a_path);
    setQuery    (a_query);
    setFragment (a_fragment);
}
Esempio n. 11
0
dtkColorGrid::dtkColorGrid(QWidget *parent) : QWidget(parent), d(new dtkColorGridPrivate)
{
    d->cellSize = 12;
    d->widthInCells = 32;
    d->autoSize = false;
    d->row = -1;
    d->col = -1;
    d->idx = -1;
    d->pickDrag = true;
    d->clickMode = CM_PRESS;
    d->colors = 0;
    
    setScheme(defaultColors());
    setFixedSize(minimumSizeHint());
    setMouseTracking(true);
}
Esempio n. 12
0
TaskGroup::TaskGroup(QWidget *parent, bool hasHeader)
  : BaseClass(parent),
  myHasHeader(hasHeader)
{
    setProperty("class", "content");
    setProperty("header", hasHeader ? "true" : "false");

    setScheme(ActionPanelScheme::defaultScheme());

    QVBoxLayout *vbl = new QVBoxLayout();
    vbl->setMargin(4);
    vbl->setSpacing(0);
    setLayout(vbl);

    setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
}
Esempio n. 13
0
AuthScope::AuthScope(const Poco::URI& uri):
    _hasScheme(false),
    _scheme(""),
    _hasHost(false),
    _host(""),
    _hasPort(false),
    _port(0),
    _hasRealm(false),
    _realm(""),
    _hasAuthType(false),
    _authType(BASIC)
{
    if (!uri.getScheme().empty()) setScheme(uri.getScheme());
    if (!uri.getHost().empty())   setHost(uri.getHost());
    if (uri.getPort() > 0)        setPort(uri.getPort());

    // realm and auth type cannot be determined from a URI
}
Esempio n. 14
0
FacilityWindow::FacilityWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::FacilityWindow)
{
    ui->setupUi(this);

    this->setPalette(Qt::white);

    connect(ui->patientAddBtn, SIGNAL(pressed()), this, SLOT(addPatientBtn_clicked()));
    connect(ui->bedAddBtn, SIGNAL(pressed()), this, SLOT(addBedBtn_clicked()));
    connect(ui->waitingBtn, SIGNAL(pressed()), this, SLOT(waitingBtn_clicked()));
    connect(ui->cancelBtn, SIGNAL(pressed()), this, SLOT(cancelBtn_clicked()));

    connect(ui->acuteRaio, SIGNAL(toggled(bool)), this, SLOT(AcuteSelected()));
    connect(ui->complexRadio, SIGNAL(toggled(bool)), this, SLOT(ComplexSelected()));
    connect(ui->longRadio, SIGNAL(toggled(bool)), this, SLOT(LTCSelected()));

    setScheme();
}
Esempio n. 15
0
main (int argc, char *argv[])
{
    int socketFD;
    int connectionFD;
    char buffer[80];
    int ret;
    int port;
    int schem;
    if (argc < 3)
    {
        strcpy (buffer, "Usage: ServerSocket PortNumber ServerScheme [MaxClients]\n");
        write (2, buffer, strlen (buffer));
        exit (1);
    }
    port = atoi(argv[1]);
    schem = atoi(argv[2]);

#ifdef DEBUG
    printf("port: %s\n", argv[1]);
    printf("schem: %s\n",argv[2]);
#endif

    MAX_CLIENTS = 100;
    if(argc == 4)
        MAX_CLIENTS = atoi(argv[3]);
    NUM_CONECTIONS = 0;

    socketFD = createServerSocket (port);
    if (socketFD < 0)
    {
        perror ("Error creating socket\n");
        exit (1);
    }
    setScheme(schem);
    signal(SIGCHLD,func_sigchild);  // reprogramacio del signal sigchld, quan un fill acaba descompta el nombre de conexions totals
    while (1) {
#ifdef DEBUG
        printf("Conexions: [%d/%d]\n",NUM_CONECTIONS, MAX_CLIENTS);
#endif
        ServerLoop(socketFD);
    }
}
Esempio n. 16
0
Highlighter::Highlighter(QTextDocument *parent, int x)
    : QSyntaxHighlighter(parent)
{
    HighlightingRule rule;
    setScheme(x);
    preprocessorFormat.setForeground(preprocessorColor);
    preprocessorFormat.setFontWeight(QFont::Bold);
    rule.pattern = QRegExp("#[^\n]*");
    rule.format = preprocessorFormat;
    highlightingRules.append(rule);

    quotationFormat.setForeground(quotationColor);
    QStringList quotationPatterns;
    quotationPatterns << "\'.*\'" << "\".*\"" << "<[A-Za-z0-9]+>";
    foreach(const QString &pattern, quotationPatterns)
    {
        rule.pattern = QRegExp(pattern);
        rule.format = quotationFormat;
        highlightingRules.append(rule);
    }
Esempio n. 17
0
/***********************************************************************
 * Factory routine -- connect to server and create remote device
 **********************************************************************/
static SoapySDR::Device *makeRemote(const SoapySDR::Kwargs &args)
{
    if (args.count(SOAPY_REMOTE_KWARG_STOP) != 0) //probably wont happen
    {
        throw std::runtime_error("SoapyRemoteDevice() -- factory loop");
    }

    if (args.count("remote") == 0)
    {
        throw std::runtime_error("SoapyRemoteDevice() -- missing URL");
    }

    auto url = SoapyURL(args.at("remote"));

    //default url parameters when not specified
    if (url.getScheme().empty()) url.setScheme("tcp");
    if (url.getService().empty()) url.setService(SOAPY_REMOTE_DEFAULT_SERVICE);

    return new SoapyRemoteDevice(url.toString(), translateArgs(args));
}
 NonuniformConstantTermWeighting()
 {
     setScheme(NonuniformConstant);
 };
Esempio n. 19
0
//Parse a URL, roughly following standard RFC 1808
void Url::setFull(const char* u) {
	port=0;
	int len;
	char buf[sizeof(path)];
	char fragment[sizeof(path)];
	char restbuf[sizeof(path)];
	char* rest = restbuf;
	
	if(strlen(u)>sizeof(restbuf)) {
		//Url too long, f**k it
		strcpy(scheme, "");
		strcpy(host, "");
		strcpy(path, "");
	}
	else
		strcpy(rest, u);
	char* sep;
	//Find fragment
	sep=strchr(rest, '#');
	if(sep) {
		//Keep the frament for later (when we set the path)
		strcpy(fragment, sep);
		*sep=0; //Remove fragment
	}
	else {
		//No fragment
		fragment[0]=0;
	}
	//Look for scheme
	//NB: As opposed to RFC 1808, we don't consider numbers, '+',
	//    '-' or '.' to be legal in scheme names. It just wouldn't
	//    feel right (if everybody followed standards, life would
	//    be boring anyway)
	sep=strstr(rest, "://");
	if(sep) {
		bool legalscheme=true;
		char* p;
		for(p=rest; p<sep; p++) {
			if(!isalpha(*p)) {
				legalscheme=false;
				break;
			}
		}
		if(legalscheme) {
			len=sep-rest;
			memcpy(buf, rest, len);
			buf[len]=0;
			setScheme(buf);
			rest = sep+3;
		}
		else
			setScheme("");
	}
	else
		setScheme("");
	//The next slash is supposed to be our path separator
	sep=strchr(rest, '/');
	if(sep) {
		len=sep-rest;
		memcpy(buf, rest, len);
		buf[len]=0;
		//setHost will parse the port if present
		setHost(buf);
		//We keep the '/' in path
		rest = sep;
	}
	else {
		//We have no path at all
		setHost(rest);
		rest[0]=0;
	}
	//Add (possibly empty) fragment
	strcat(rest, fragment);
	setPath(rest);
}
Esempio n. 20
0
/***********************************************************************
 * Discovery routine -- connect to server when key specified
 **********************************************************************/
static std::vector<SoapySDR::Kwargs> findRemote(const SoapySDR::Kwargs &args)
{
    std::vector<SoapySDR::Kwargs> result;

    if (args.count(SOAPY_REMOTE_KWARG_STOP) != 0) return result;

    //no remote specified, use the discovery protocol
    if (args.count("remote") == 0)
    {
        //On non-windows platforms the endpoint instance can last the
        //duration of the process because it can be cleaned up safely.
        //Windows has issues cleaning up threads and sockets on exit.
        #ifndef _MSC_VER
        static
        #endif //_MSC_VER
        auto ssdpEndpoint = SoapySSDPEndpoint::getInstance();

        //enable forces new search queries
        ssdpEndpoint->enablePeriodicSearch(true);

        //wait maximum timeout for replies
        std::this_thread::sleep_for(std::chrono::microseconds(SOAPY_REMOTE_SOCKET_TIMEOUT_US));

        for (const auto &url : SoapySSDPEndpoint::getInstance()->getServerURLs())
        {
            auto argsWithURL = args;
            argsWithURL["remote"] = url;
            const auto subResult = findRemote(argsWithURL);
            result.insert(result.end(), subResult.begin(), subResult.end());
        }

        return result;
    }

    //otherwise connect to a specific url and enumerate
    auto url = SoapyURL(args.at("remote"));

    //default url parameters when not specified
    if (url.getScheme().empty()) url.setScheme("tcp");
    if (url.getService().empty()) url.setService(SOAPY_REMOTE_DEFAULT_SERVICE);

    //try to connect to the remote server
    SoapySocketSession sess;
    SoapyRPCSocket s;
    int ret = s.connect(url.toString());
    if (ret != 0)
    {
        SoapySDR::logf(SOAPY_SDR_ERROR, "SoapyRemote::find() -- connect(%s) FAIL: %s", url.toString().c_str(), s.lastErrorMsg());
        return result;
    }

    //find transaction
    try
    {
        SoapyLogAcceptor logAcceptor(url.toString(), s);

        SoapyRPCPacker packer(s);
        packer & SOAPY_REMOTE_FIND;
        packer & translateArgs(args);
        packer();
        SoapyRPCUnpacker unpacker(s);
        unpacker & result;

        //graceful disconnect
        SoapyRPCPacker packerHangup(s);
        packerHangup & SOAPY_REMOTE_HANGUP;
        packerHangup();
        SoapyRPCUnpacker unpackerHangup(s);
    }
    catch (const std::exception &ex)
    {
        SoapySDR::logf(SOAPY_SDR_ERROR, "SoapyRemote::find() -- transact FAIL: %s", ex.what());
    }

    //remove instances of the stop key from the result
    for (auto &resultArgs : result)
    {
        resultArgs.erase(SOAPY_REMOTE_KWARG_STOP);
        if (resultArgs.count("driver") != 0)
        {
            resultArgs["remote:driver"] = resultArgs.at("driver");
            resultArgs.erase("driver");
        }
        if (resultArgs.count("type") != 0)
        {
            resultArgs["remote:type"] = resultArgs.at("type");
            resultArgs.erase("type");
        }
        resultArgs["remote"] = url.toString();
    }

    return result;
}