Example #1
0
void
MainWindow::openSubIssue(void)
{
  QDesktopServices::openUrl(
    QUrl("https://github.com/rtxi/rtxi/issues", QUrl::TolerantMode));
}
Example #2
0
void LoginDialog::setLoginUrl(const QString& url)
{
    //ui->webView->setUrl(QUrl(""));
    ui->webView->setUrl(QUrl(url));
}
QUrl PasswordsContentsWidget::getUrl() const
{
	return QUrl(QLatin1String("about:passwords"));
}
Example #4
0
void QucsHelp::displaySelectedChapter(const QItemSelection & is)
{
  const QModelIndex index = is.indexes()[0];
  if(index.isValid())
    textBrowser->setSource(QUrl(QucsHelpDir.filePath(links[index.row()])));
}
Example #5
0
 inline QUrl resolveUrl(const QString &url) const
 { return resolveUrl(QUrl(url)); }
void DialogPreferences::on_pushButtonOk_clicked()
{
    bool changed = false;
    bool urlChanged = false;
    quint8 number;
    QString string;

    string = _ui->lineEditHostlistUrl->text();

    if(!QUrl(string).isValid())
    {
        QMessageBox::critical(NULL, trUtf8("Error"), trUtf8("You have entered an invalid URL."));

        return;
    }

    number = _ui->comboBoxTestMode->currentIndex();

    switch(number)
    {
        case 0:
            number = TestMode::Info;
            break;
        case 1:
            number = TestMode::Ping;
            break;
        case 2:
            number = TestMode::Download;
            break;
        case 3:
            number = TestMode::All;
            break;
        default:
            number = TestMode::All;
    }

    if(number != TESTMODE)
    {
        changed = true;
        TESTMODE = (TestMode::Mode) number;
    }

    number = _ui->spinBoxPingsPerHost->value();

    if(number != PINGSPERHOST)
    {
        changed = true;
        PINGSPERHOST = number;
    }

    number = _ui->spinBoxPingThreads->value();

    if(number != PINGTHREADS)
    {
        changed = true;
        PINGTHREADS = number;
    }

    number = _ui->spinBoxPingTimeout->value();

    if(number != PINGTIMEOUTSECS)
    {
        changed = true;
        PINGTIMEOUTSECS = number;
    }

    number = _ui->spinBoxDownloadTestSecs->value();

    if(number != DOWNLOADTESTSECS)
    {
        changed = true;
        DOWNLOADTESTSECS = number;
    }

    if(string != HOSTLISTURL)
    {
        changed = true;
        urlChanged = true;
        HOSTLISTURL = string;
    }

    if(changed)
    {
        emit savePreferences();
    }

    if(urlChanged)
    {
        emit hostlistUrlChanged();
    }

    close();
}
//загрузка файла
void guBookUploader::uploadEbookData(ebook uploadEbook)
{
    QString uploadedMd5 = uploadEbook.MD5;
    //test
    serviceUrl = "http://localhost/lgws/service.php";
    QNetworkRequest *uploadEbookRequest;
    //TODO: вести лог
    uploadEbookRequest = new QNetworkRequest(QUrl(serviceUrl));
    QByteArray fileToSend; // byte array to be sent in POST
    if(!uploadEbook.inLib)
    {
        QFile uploadFile(uploadEbook.filePath);
        if (!uploadFile.open(QIODevice::ReadOnly))
        {
            //TODO: дать сигнал о том, что закачка провалилась так как не удалось открыть файл
            return;
        }

        fileToSend = uploadFile.readAll();
        uploadFile.close(); //расскомментировать
    }

    ////////////////////начало кода, взятого из "formpost"
    QString encodingS;
    encodingS = "utf-8";
    QString userAgentS;
    QString refererS;
    QStringList fieldNames;
    QStringList fieldValues;
    QStringList fileFieldNames;
    QStringList fileNames;
    QStringList fileMimes;
    QList<QByteArray> files;

    fieldNames << "xml";
    fieldValues << sendEbookInfoXML(uploadEbook);


    if(!uploadEbook.inLib)
    {
        fieldNames << "MAX_FILE_SIZE";
        fieldValues << QString::number(maxUploadFileSize);

        fileFieldNames << "uploadedfile";
        fileNames << uploadEbook.fileName +"."+ uploadEbook.fileExtension;

        fileMimes << "application/octet-stream";
        files << fileToSend;
    }
    QString crlf="\r\n";
    qsrand(QDateTime::currentDateTime().toTime_t());
    QString b=QVariant(qrand()).toString()+QVariant(qrand()).toString()+QVariant(qrand()).toString();
    QString boundary="---------------------------"+b;
    QString endBoundary=crlf+"--"+boundary+"--"+crlf;
    QString contentType="multipart/form-data; boundary="+boundary;
    boundary="--"+boundary+crlf;
    QByteArray bond=boundary.toAscii();
    QByteArray send;
    bool first=true;
    for (int i=0; i<fieldNames.size(); i++) {
        send.append(bond);
        if (first) {
            boundary=crlf+boundary;
            bond=boundary.toAscii();
            first=false;
        }
        send.append(QString("Content-Disposition: form-data; name=\""+fieldNames.at(i)+"\""+crlf).toAscii());
        if (encodingS=="utf-8") send.append(QString("Content-Transfer-Encoding: 8bit"+crlf).toAscii());
        send.append(crlf.toAscii());
        send.append(strToEnc(fieldValues.at(i),encodingS));
    }
    for (int i=0; i<files.size(); i++) {
        send.append(bond);
        send.append(QString("Content-Disposition: form-data; name=\""+fileFieldNames.at(i)+"\"; filename=\""+fileNames.at(i)+"\""+crlf).toAscii());
        send.append(QString("Content-Type: "+fileMimes.at(i)+crlf+crlf).toAscii());
        send.append(files.at(i));
    }

    send.append(endBoundary.toAscii());
    uploadEbookRequest->setHeader(QNetworkRequest::ContentLengthHeader, QVariant(send.size()).toString());
    uploadEbookRequest->setHeader(QNetworkRequest::ContentTypeHeader, contentType.toAscii());
    uploadEbookRequest->setRawHeader("Accept","text/html,text/xml,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
    uploadEbookRequest->setRawHeader("Accept-Charset","windows-1251,utf-8;q=0.7,*;q=0.7");
    uploadEbookRequest->setRawHeader("Accept-Encoding", "gzip,deflate");//,qcompress
    uploadEbookRequest->setRawHeader("Authorization", "Basic " + QByteArray(QString("%1:%2").arg("genesis").arg("upload").toAscii()).toBase64());

    uploadEbookRequest->setRawHeader("Connection","keep-alive");
    uploadEbookRequest->setRawHeader("Keep-Alive","115");
    uploadEbookRequest->setRawHeader("User-Agent","Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6");
    QString host("free-books.dontexist.org");
    uploadEbookRequest->setRawHeader("Host",host.toAscii());
    uploadEbookRequest->setRawHeader("Referer","http://free-books.dontexist.com/librarian/");

    uploadEbookReply  *uplEbookReplyManager;
    QNetworkReply  *uplEbookReply;

    //    QFile file("out.txt");
    //        if (!file.open(QIODevice::WriteOnly))
    //            return;
    //        file.write(send);
    //        file.close();
    uplEbookReply = httpUploadFilesManager->post(*uploadEbookRequest, send);
    //send.clear();
    uplEbookReplyManager = new uploadEbookReply(uplEbookReply , uploadedMd5, this);
    connect(uplEbookReplyManager, SIGNAL(onUploadEbookProcess(QString,int)), this, SLOT(onUploadProgress(QString,int)));
    //log(uploadEbookRequest->rawHeaderList());
    uplEbookReply->setProperty("MD5",uploadedMd5);
    qDebug() << "MD5 setted";
    if(uploadEbook.inLib)
    {
         uplEbookReply->setProperty("type", "edit");
    }
    else
    {
         uplEbookReply->setProperty("type", "upload");
    }

    // // connections
    //connect(reply,SIGNAL(uploadProgress(qint64,qint64)),SLOT(mySetValue(qint64,qint64)));
    //connect(reply,SIGNAL(finished()),SLOT(replyFinished())); // reply finished - close file
    //fillBibliographyReply->setProperty("dataSource",dataSource);
    //numOfFillBibliographyConnections++;
}
void WebPage::setUserStylesheet() {
  QString data = QString("*, :before, :after { font-family: 'Arial' ! important; }").toUtf8().toBase64();
  QUrl url = QUrl(QString("data:text/css;charset=utf-8;base64,") + data);
  settings()->setUserStyleSheetUrl(url);
}
Example #9
0
inline void KNMusicLyricsDownloader::networkProcess(int type,
                                                    const QString &url,
                                                    QByteArray &responseData,
                                                    const QByteArray &parameter,
                                                    const QVariant &cookie,
                                                    const QString &referer)
{
    //Stop the timer.
    m_timeout->stop();
    //Clear the data first.
    responseData.clear();
    m_networkManager->clearAccessCache();
    //Generate the request.
    QNetworkRequest currentRequest;
    //Set the data to request.
    currentRequest.setUrl(QUrl(url));
    if(!cookie.isNull())
    {
        currentRequest.setHeader(QNetworkRequest::CookieHeader,
                                 cookie);
    }
    if(!referer.isEmpty())
    {
        currentRequest.setRawHeader("Referer", referer.toStdString().data());
        currentRequest.setRawHeader("Origin", referer.toStdString().data());
    }
    //Generate the reply and quit handler.
    QNetworkReply *currentReply=nullptr;
    KNConnectionHandler quiterHandle;
    //Wait for response, using the event loop, generate the loop.
    QEventLoop stuckWaitingLoop;
    //Link the finished and timeout counter to quit loop.
    quiterHandle+=connect(m_networkManager, SIGNAL(finished(QNetworkReply*)),
                          &stuckWaitingLoop, SLOT(quit()));
    quiterHandle+=connect(m_timeout, SIGNAL(timeout()),
                          &stuckWaitingLoop, SLOT(quit()));
    //Do GET.
    switch(type)
    {
    case Post:
    {
        currentRequest.setHeader(QNetworkRequest::ContentTypeHeader,
                                 "application/x-www-form-urlencoded");
        currentRequest.setHeader(QNetworkRequest::ContentLengthHeader,
                                 parameter.size());
        currentReply=m_networkManager->post(currentRequest, parameter);
        break;
    }
    case Get:
    {
        currentReply=m_networkManager->get(currentRequest);
        break;
    }
    }
    //Start counting.
    m_timeout->start();
    //Start loop.
    stuckWaitingLoop.exec();
    //Disconnect all the links.
    quiterHandle.disconnectAll();
    //Check if there's reply.
    if(currentReply==nullptr)
    {
        return;
    }
    //Get the data.
    responseData=currentReply->readAll();
    //Clear the reply.
    delete currentReply;
}
Example #10
0
QUrl toURL(const std::string& s) {
  return QUrl(toQString(s));
}
Example #11
0
void TopologyDialog::refreshMap()
{
    ui->webView->load(QUrl("qrc:/final.html"));
    ui->webView->show();
}
Example #12
0
void Check_for_updates::replyFinished()
{
  long long int n;

  char buf[128];

  int this_version,
      latest_version;

  QNetworkReply *reply = qobject_cast<QNetworkReply *>(sender());

  if(reply->error() != QNetworkReply::NoError)
  {
    reply->deleteLater();

    return;
  }

  if(reply->bytesAvailable() < 31)
  {
    reply->deleteLater();

    return;
  }

  n = reply->read(buf, 100);

  if(n < 31)
  {
    reply->deleteLater();

    return;
  }

  reply->deleteLater();

  buf[30] = 0;

  if(strncmp(buf, "EDFbrowser latest version: ", 27))
  {
    return;
  }

  if(is_integer_number(buf + 27))
  {
    return;
  }

  latest_version = atoi(buf + 27);

  if((latest_version < 1) || (latest_version > 1000000))
  {
    return;
  }

  sprintf(buf, PROGRAM_VERSION);

  buf[1] = buf[0];

  this_version = atoi(buf + 1);

  if(this_version >= latest_version)
  {
    return;
  }

  QMessageBox messagewindow(QMessageBox::Information,
                            "New version available",
                            "A newer version of EDFbrowser is available.\n"
                            "Do you want to download the new version now?",
                            QMessageBox::Yes | QMessageBox::No);

  if(messagewindow.exec() != QMessageBox::Yes)
  {
    return;
  }

  QDesktopServices::openUrl(QUrl("http://www.teuniz.net/edfbrowser/"));
}
Example #13
0
/** @brief detects current system proxy
 *  @return QUrl with proxy or empty
 */
QUrl System::systemProxy(void)
{
#if defined(Q_OS_LINUX)
    return QUrl(getenv("http_proxy"));
#elif defined(Q_OS_WIN32)
    HKEY hk;
    wchar_t proxyval[80];
    DWORD buflen = 80;
    long ret;
    DWORD enable;
    DWORD enalen = sizeof(DWORD);

    ret = RegOpenKeyEx(HKEY_CURRENT_USER,
        _TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"),
        0, KEY_QUERY_VALUE, &hk);
    if(ret != ERROR_SUCCESS) return QUrl("");

    ret = RegQueryValueEx(hk, _TEXT("ProxyServer"), NULL, NULL, (LPBYTE)proxyval, &buflen);
    if(ret != ERROR_SUCCESS) return QUrl("");

    ret = RegQueryValueEx(hk, _TEXT("ProxyEnable"), NULL, NULL, (LPBYTE)&enable, &enalen);
    if(ret != ERROR_SUCCESS) return QUrl("");

    RegCloseKey(hk);

    //qDebug() << QString::fromWCharArray(proxyval) << QString("%1").arg(enable);
    if(enable != 0)
        return QUrl("http://" + QString::fromWCharArray(proxyval));
    else
        return QUrl("");
#elif defined(Q_OS_MACX)

    CFDictionaryRef dictref;
    CFStringRef stringref;
    CFNumberRef numberref;
    int enable = 0;
    int port = 0;
    unsigned int bufsize = 0;
    char *buf;
    QUrl proxy;

    dictref = SCDynamicStoreCopyProxies(NULL);
    if(dictref == NULL)
        return proxy;
    numberref = (CFNumberRef)CFDictionaryGetValue(dictref, kSCPropNetProxiesHTTPEnable);
    if(numberref != NULL)
        CFNumberGetValue(numberref, kCFNumberIntType, &enable);
    if(enable == 1) {
        // get proxy string
        stringref = (CFStringRef)CFDictionaryGetValue(dictref, kSCPropNetProxiesHTTPProxy);
        if(stringref != NULL) {
            // get number of characters. CFStringGetLength uses UTF-16 code pairs
            bufsize = CFStringGetLength(stringref) * 2 + 1;
            buf = (char*)malloc(sizeof(char) * bufsize);
            if(buf == NULL) {
                qDebug() << "[System] can't allocate memory for proxy string!";
                CFRelease(dictref);
                return QUrl("");
            }
            CFStringGetCString(stringref, buf, bufsize, kCFStringEncodingUTF16);
            numberref = (CFNumberRef)CFDictionaryGetValue(dictref, kSCPropNetProxiesHTTPPort);
            if(numberref != NULL)
                CFNumberGetValue(numberref, kCFNumberIntType, &port);
            proxy.setScheme("http");
            proxy.setHost(QString::fromUtf16((unsigned short*)buf));
            proxy.setPort(port);

            free(buf);
            }
    }
    CFRelease(dictref);

    return proxy;
#else
    return QUrl("");
#endif
}
Example #14
0
PageRunner::PageRunner(const QStringList& args)
    : QWebPage(0),
      out(stdout),
      err(stderr),
      view(new QWidget()) {

    QMap<QString, QString> settings = parseArguments(args);
    QStringList arguments = args.mid(settings.size() * 2);
    exportpdf = settings.value("export-pdf");
    exportpng = settings.value("export-png");
    url = QUrl(arguments[0]);
    nativeio = new NativeIO(this, QFileInfo(arguments[0]).dir(),
                            QDir::current());
    if (url.scheme() == "file" || url.isRelative()) {
        QFileInfo info(arguments[0]);
        url = QUrl::fromLocalFile(info.absoluteFilePath());
        if (!info.isReadable() || !info.isFile()) {
            QTextStream err(stderr);
            err << "Cannot read file '" + url.toString() + "'.\n";
            qApp->exit(1);
        }
    }
    nam = new NAM(this, QUrl(url).host(), QUrl(url).port());

    setNetworkAccessManager(nam);
    connect(this, SIGNAL(loadFinished(bool)), this, SLOT(finished(bool)));
    connect(mainFrame(), SIGNAL(javaScriptWindowObjectCleared()),
            this, SLOT(slotInitWindowObjects()));
    sawJSError = false;

    setView(view);
    scriptMode = arguments[0].endsWith(".js");
    if (scriptMode) {
        QByteArray html = "'" + arguments[0].toUtf8().replace('\'', "\\'")
                + "'";
        for (int i = 1; i < arguments.length(); ++i) {
            html += ",'" + arguments[i].toUtf8().replace('\'', "\\'") + "'";
        }
        html = "<html>"
                "<head><title></title>"
                "<script>var arguments=[" + html + "];</script>"
                "<script src=\"" + arguments[0].toUtf8() + "\"></script>";
        // add runtime modification
        html += "<script>//<![CDATA[\n" + getRuntimeBindings() +
             "if (typeof(runtime) !== 'undefined' && typeof(nativeio) !== 'undefined') {\n"
             "    runtime.libraryPaths = function () {"
             "        /* convert to javascript array */"
             "        var p = nativeio.libraryPaths(),"
             "            a = [], i;"
             "        for (i in p) { a[i] = p[i]; }"
             "        return a;"
             "    };}//]]></script>";
        html += "</head><body></body></html>\n";
        QTemporaryFile tmp("XXXXXX.html");
        tmp.setAutoRemove(true);
        tmp.open();
        tmp.write(html);
        tmp.close();
        QFileInfo info(tmp.fileName());
        mainFrame()->load(QUrl::fromLocalFile(info.absoluteFilePath()));
    } else {
        // Make the url absolute. If it is not done here, QWebFrame will do
        // it, and it will lose the query and fragment part.
        QUrl absurl;
        if (url.isRelative()) {
            absurl = QUrl::fromLocalFile(QFileInfo(url.toLocalFile()).absoluteFilePath());
            absurl.setQueryItems(url.queryItems());
            absurl.setFragment(url.fragment());
        } else {
            absurl = url;
        }
        mainFrame()->load(absurl);
    }
}
Example #15
0
bool WebPage::loadURL(const QString link){
    // No need for network test, will be done in urlChanged
    b->loadurl(QUrl(link));
    return true;
}
Example #16
0
// Convert simple DOM types
QVariant domPropertyToVariant(const DomProperty *p)
{
    // requires non-const virtual nameToIcon, etc.
    switch(p->kind()) {
    case DomProperty::Bool:
        return QVariant(p->elementBool() == QFormBuilderStrings::instance().trueValue);

    case DomProperty::Cstring:
        return QVariant(p->elementCstring().toUtf8());

    case DomProperty::Point: {
        const DomPoint *point = p->elementPoint();
        return QVariant(QPoint(point->elementX(), point->elementY()));
    }

    case DomProperty::PointF: {
        const DomPointF *pointf = p->elementPointF();
        return QVariant(QPointF(pointf->elementX(), pointf->elementY()));
    }

    case DomProperty::Size: {
        const DomSize *size = p->elementSize();
        return QVariant(QSize(size->elementWidth(), size->elementHeight()));
    }

    case DomProperty::SizeF: {
        const DomSizeF *sizef = p->elementSizeF();
        return QVariant(QSizeF(sizef->elementWidth(), sizef->elementHeight()));
    }

    case DomProperty::Rect: {
        const DomRect *rc = p->elementRect();
        const QRect g(rc->elementX(), rc->elementY(), rc->elementWidth(), rc->elementHeight());
        return QVariant(g);
    }

    case DomProperty::RectF: {
        const DomRectF *rcf = p->elementRectF();
        const QRectF g(rcf->elementX(), rcf->elementY(), rcf->elementWidth(), rcf->elementHeight());
        return QVariant(g);
    }

    case DomProperty::String:
        return QVariant(p->elementString()->text());

    case DomProperty::Number:
        return QVariant(p->elementNumber());

    case DomProperty::UInt:
        return QVariant(p->elementUInt());

    case DomProperty::LongLong:
        return QVariant(p->elementLongLong());

    case DomProperty::ULongLong:
        return QVariant(p->elementULongLong());

    case DomProperty::Double:
        return QVariant(p->elementDouble());

    case DomProperty::Char: {
        const DomChar *character = p->elementChar();
        const QChar c(character->elementUnicode());
        return qVariantFromValue(c);
    }

    case DomProperty::Color: {
        const DomColor *color = p->elementColor();
        QColor c(color->elementRed(), color->elementGreen(), color->elementBlue());
        if (color->hasAttributeAlpha())
            c.setAlpha(color->attributeAlpha());
        return qVariantFromValue(c);
    }

    case DomProperty::Font: {
        const DomFont *font = p->elementFont();

        QFont f;
        if (font->hasElementFamily() && !font->elementFamily().isEmpty())
            f.setFamily(font->elementFamily());
        if (font->hasElementPointSize() && font->elementPointSize() > 0)
            f.setPointSize(font->elementPointSize());
        if (font->hasElementWeight() && font->elementWeight() > 0)
            f.setWeight(font->elementWeight());
        if (font->hasElementItalic())
            f.setItalic(font->elementItalic());
        if (font->hasElementBold())
            f.setBold(font->elementBold());
        if (font->hasElementUnderline())
            f.setUnderline(font->elementUnderline());
        if (font->hasElementStrikeOut())
            f.setStrikeOut(font->elementStrikeOut());
        if (font->hasElementKerning())
            f.setKerning(font->elementKerning());
        if (font->hasElementAntialiasing())
            f.setStyleStrategy(font->elementAntialiasing() ? QFont::PreferDefault : QFont::NoAntialias);
        if (font->hasElementStyleStrategy()) {
            f.setStyleStrategy(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QFont::StyleStrategy>("styleStrategy", font->elementStyleStrategy().toLatin1()));
        }
        return qVariantFromValue(f);
    }

    case DomProperty::Date: {
        const DomDate *date = p->elementDate();
        return QVariant(QDate(date->elementYear(), date->elementMonth(), date->elementDay()));
    }

    case DomProperty::Time: {
        const DomTime *t = p->elementTime();
        return QVariant(QTime(t->elementHour(), t->elementMinute(), t->elementSecond()));
    }

    case DomProperty::DateTime: {
        const DomDateTime *dateTime = p->elementDateTime();
        const QDate d(dateTime->elementYear(), dateTime->elementMonth(), dateTime->elementDay());
        const QTime tm(dateTime->elementHour(), dateTime->elementMinute(), dateTime->elementSecond());
        return QVariant(QDateTime(d, tm));
    }

    case DomProperty::Url: {
        const DomUrl *url = p->elementUrl();
        return QVariant(QUrl(url->elementString()->text()));
    }

#ifndef QT_NO_CURSOR
    case DomProperty::Cursor:
        return qVariantFromValue(QCursor(static_cast<Qt::CursorShape>(p->elementCursor())));

    case DomProperty::CursorShape:
        return qVariantFromValue(QCursor(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, Qt::CursorShape>("cursorShape", p->elementCursorShape().toLatin1())));
#endif

    case DomProperty::Locale: {
        const DomLocale *locale = p->elementLocale();
        return qVariantFromValue(QLocale(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Language>("language", locale->attributeLanguage().toLatin1()),
                    enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Country>("country", locale->attributeCountry().toLatin1())));
    }
    case DomProperty::SizePolicy: {
        const DomSizePolicy *sizep = p->elementSizePolicy();

        QSizePolicy sizePolicy;
        sizePolicy.setHorizontalStretch(sizep->elementHorStretch());
        sizePolicy.setVerticalStretch(sizep->elementVerStretch());

        const QMetaEnum sizeType_enum = metaEnum<QAbstractFormBuilderGadget>("sizeType");

        if (sizep->hasElementHSizeType()) {
            sizePolicy.setHorizontalPolicy((QSizePolicy::Policy) sizep->elementHSizeType());
        } else if (sizep->hasAttributeHSizeType()) {
            const QSizePolicy::Policy sp = enumKeyToValue<QSizePolicy::Policy>(sizeType_enum, sizep->attributeHSizeType().toLatin1());
            sizePolicy.setHorizontalPolicy(sp);
        }

        if (sizep->hasElementVSizeType()) {
            sizePolicy.setVerticalPolicy((QSizePolicy::Policy) sizep->elementVSizeType());
        } else if (sizep->hasAttributeVSizeType()) {
            const  QSizePolicy::Policy sp = enumKeyToValue<QSizePolicy::Policy>(sizeType_enum, sizep->attributeVSizeType().toLatin1());
            sizePolicy.setVerticalPolicy(sp);
        }

        return qVariantFromValue(sizePolicy);
    }

    case DomProperty::StringList:
        return QVariant(p->elementStringList()->elementString());

    default:
        uiLibWarning(QCoreApplication::translate("QFormBuilder", "Reading properties of the type %1 is not supported yet.").arg(p->kind()));
        break;
    }

    return QVariant();
}
Example #17
0
void HTMLPreview::displayURL()
{
	QUrl url = QUrl(ui->url->text());
	ui->webView->load(url);
}
Example #18
0
void docAttach::sSave()
{  
  XSqlQuery newDocass;
  QString title;
  QUrl url;

  //set the purpose
  if (_docAttachPurpose->currentIndex() == 0)
    _purpose = "S";
  else if (_docAttachPurpose->currentIndex() == 1)
    _purpose = "A";
  else if (_docAttachPurpose->currentIndex() == 2)
    _purpose = "C";
  else if (_docAttachPurpose->currentIndex() == 3)
    _purpose = "D";

  //if then series, type derived from the stack index. e.g.
  if (_docType->currentIndex() == 1)
  {
    _targettype = "T";
    _targetid = _cntct->id();
  }
  else if (_docType->currentIndex() == 2)
  {
    _targettype = "CRMA";
    _targetid = _crmacct->id();
  }
  else if (_docType->currentIndex() == 3)
  {
    _targettype = "C";
    _targetid = _cust->id();
  }
  else if (_docType->currentIndex() == 4)
  {
    _targettype = "EMP";
    _targetid = _emp->id();
  }
  else if (_docType->currentIndex() == 5)
  {
    if(_file->text().trimmed().isEmpty())
    {
      QMessageBox::warning( this, tr("Must Specify file"),
                            tr("You must specify a file before you may save.") );
      return;
    }

     _targettype = "URL";
     title = _filetitle->text();
     url = QUrl(_file->text());
     if (url.scheme().isEmpty())
       url.setScheme("file");
  }
  else if (_docType->currentIndex() == 6)
  {
     _targettype = "IMG";
     _targetid = _img->id();
  }
  else if (_docType->currentIndex() == 7)
  {
    _targettype = "INCDT";
    _targetid = _incdt->id();
  }
  else if (_docType->currentIndex() == 8)
  {
    _targettype = "I";
    _targetid = _item->id();
  }
  else if (_docType->currentIndex() == 9)
  {
    _targettype = "OPP";
    _targetid = _opp->id();
  }
  else if (_docType->currentIndex() == 10)
  {
    _targettype = "J";
    _targetid = _proj->id();
  }
  else if (_docType->currentIndex() == 11)
  {
    _targettype = "P";
    _targetid = _po->id();
  }
  else if (_docType->currentIndex() == 12)
  {
    _targettype = "S";
    _targetid = _so->id();
  }
  else if (_docType->currentIndex() == 13)
  {
    _targettype = "V";
    _targetid = _vend->id();
  }
  else if (_docType->currentIndex() == 14)
  {
    if(_url->text().trimmed().isEmpty())
    {
      QMessageBox::warning( this, tr("Must Specify file"),
                            tr("You must specify a file before you may save.") );
      return;
    }

    _targettype = "URL";
    title = _urltitle->text();
    url = QUrl(_url->text());
    if (url.scheme().isEmpty())
      url.setScheme("http");
  }
  else if (_docType->currentIndex() == 15)
  {
    _targettype = "W";
    _targetid = _wo->id();
  }

  if (_targettype == "IMG")
  {
     // For now images are handled differently because of legacy structures...
    newDocass.prepare( "INSERT INTO imageass "
                       "( imageass_source, imageass_source_id, imageass_image_id, imageass_purpose ) "
                       "VALUES "
                       "( :docass_source_type, :docass_source_id, :docass_target_id, :docass_purpose );" );
  }
  else if (_targettype == "URL")
  {
    if(!url.isValid())
    {
      QMessageBox::warning( this, tr("Must Specify valid path"),
                            tr("You must specify a path before you may save.") );
      return;
    }

    QByteArray  bytarr;
    QFileInfo fi(url.toLocalFile());

    if(_saveDbCheck->isChecked() &&
       (url.scheme()=="file") &&
       (_mode == "new"))
    {
      if (!fi.exists())
      {
        QMessageBox::warning( this, tr("File Error"),tr("File " + url.toLocalFile() + " Was Not Found And Will Not Be Saved.") );
        return;
      }
      QFile sourceFile(url.toLocalFile());
      if (!sourceFile.open(QIODevice::ReadOnly))
      {
        QMessageBox::warning( this, tr("File Open Error"),tr("Could Not Open Source File " + url.toLocalFile() + "File For Read.") );
        return;
      }
      bytarr = sourceFile.readAll();
      url.setPath(fi.fileName().remove(" "));
      url.setScheme("");
    }

    // For now urls are handled differently because of legacy structures...
    if (_mode == "new")
      newDocass.prepare( "INSERT INTO url "
                         "( url_source, url_source_id, url_title, url_url, url_stream ) "
                         "VALUES "
                         "( :docass_source_type, :docass_source_id, :title, :url, :stream );" );
    else
      newDocass.prepare( "UPDATE url SET "
                         "  url_title = :title, "
                         "  url_url = :url "
                         "WHERE (url_id=:url_id);" );
    newDocass.bindValue(":url_id", _urlid);
    newDocass.bindValue(":title", title);
    newDocass.bindValue(":url", url.toString());
    newDocass.bindValue(":stream", bytarr);
  }
  else
  {
    newDocass.prepare( "INSERT INTO docass "
                       "( docass_source_type, docass_source_id, docass_target_type, docass_target_id, docass_purpose ) "
                       "VALUES "
                       "( :docass_source_type, :docass_source_id, :docass_target_type, :docass_target_id, :docass_purpose );" );
    newDocass.bindValue(":docass_target_type", _targettype);
  }

  if (_targettype == Documents::_documentMap[_source].ident &&
      _targetid == _sourceid)
  {
    QMessageBox::critical(this,tr("Invalid Selection"),
                          tr("You may not attach a document to itself."));
    return;
  }

  newDocass.bindValue(":docass_source_type", Documents::_documentMap[_source].ident);
  newDocass.bindValue(":docass_source_id", _sourceid);
  newDocass.bindValue(":docass_target_id", _targetid);
  newDocass.bindValue(":docass_purpose", _purpose);

  newDocass.exec();

  accept();
}
Example #19
0
void RunningScriptsWidget::setRunningScripts(const QStringList& list) {
    setUpdatesEnabled(false);
    QLayoutItem* widget;
    while ((widget = ui->scriptListWidget->layout()->takeAt(0)) != NULL) {
        delete widget->widget();
        delete widget;
    }
    QHash<QString, int> hash;
    const int CLOSE_ICON_HEIGHT = 12;
    for (int i = 0; i < list.size(); i++) {
        if (!hash.contains(list.at(i))) {
            hash.insert(list.at(i), 1);
        }
        QWidget* row = new QWidget(ui->scriptListWidget);
        row->setLayout(new QHBoxLayout(row));

        QUrl url = QUrl(list.at(i));
        QLabel* name = new QLabel(url.fileName(), row);
        if (hash.find(list.at(i)).value() != 1) {
            name->setText(name->text() + "(" + QString::number(hash.find(list.at(i)).value()) + ")");
        }
        ++hash[list.at(i)];
        QPushButton* closeButton = new QPushButton(row);
        closeButton->setFlat(true);
        closeButton->setIcon(
            QIcon(QPixmap(Application::resourcesPath() + "images/kill-script.svg").scaledToHeight(CLOSE_ICON_HEIGHT)));
        closeButton->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred));
        closeButton->setStyleSheet("border: 0;");
        closeButton->setCursor(Qt::PointingHandCursor);

        connect(closeButton, SIGNAL(clicked()), &_signalMapper, SLOT(map()));
        _signalMapper.setMapping(closeButton, url.toString());

        row->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));

        row->layout()->setContentsMargins(4, 4, 4, 4);
        row->layout()->setSpacing(0);

        row->layout()->addWidget(name);
        row->layout()->addWidget(closeButton);

        row->setToolTip(url.toString());

        QFrame* line = new QFrame(row);
        line->setFrameShape(QFrame::HLine);
        line->setStyleSheet("color: #E1E1E1; margin-left: 6px; margin-right: 6px;");

        ui->scriptListWidget->layout()->addWidget(row);
        ui->scriptListWidget->layout()->addWidget(line);
    }


    ui->noRunningScriptsLabel->setVisible(list.isEmpty());
    ui->reloadAllButton->setVisible(!list.isEmpty());
    ui->stopAllButton->setVisible(!list.isEmpty());

    ui->scriptListWidget->updateGeometry();
    setUpdatesEnabled(true);
    Application::processEvents();
    repaint();
}
Example #20
0
QUrl GameStorage::getFileDirectory() const {
	QUrl dir = QUrl(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
	qDebug() << dir;
	return dir;
}
Example #21
0
void TelegramGui::openFile(const QString &file)
{
    QDesktopServices::openUrl( QUrl(file) );
}
Example #22
0
// SPDX-License-Identifier: GPL-2.0
#include <QQmlContext>
#include <QDebug>
#include <QQuickItem>
#include <QModelIndex>

#include "mapwidget.h"
#include "core/divesite.h"
#include "map-widget/qmlmapwidgethelper.h"
#include "qt-models/maplocationmodel.h"
#include "qt-models/divelocationmodel.h"
#include "mainwindow.h"
#include "divelistview.h"
#include "command.h"

static const QUrl urlMapWidget = QUrl(QStringLiteral("qrc:/qml/MapWidget.qml"));
static const QUrl urlMapWidgetError = QUrl(QStringLiteral("qrc:/qml/MapWidgetError.qml"));
static bool isReady = false;

#define CHECK_IS_READY_RETURN_VOID() \
	if (!isReady) return

MapWidget *MapWidget::m_instance = NULL;

MapWidget::MapWidget(QWidget *parent) : QQuickWidget(parent)
{
	m_rootItem = nullptr;
	m_mapHelper = nullptr;
	setResizeMode(QQuickWidget::SizeRootObjectToView);
	connect(this, &QQuickWidget::statusChanged, this, &MapWidget::doneLoading);
	connect(&diveListNotifier, &DiveListNotifier::divesChanged, this, &MapWidget::divesChanged);
Example #23
0
void QucsHelp::previousLink()
{
  if(currentIndex > 0)
    --currentIndex;
  textBrowser->setSource(QUrl(QucsHelpDir.filePath(links[currentIndex])));
}
Example #24
0
                     &DelayGrabElement::updateDelaymap);
    QObject::connect(this,
                     &DelayGrabElement::frameSizeChanged,
                     this,
                     &DelayGrabElement::updateDelaymap);
}

QObject *DelayGrabElement::controlInterface(QQmlEngine *engine, const QString &controlId) const
{
    Q_UNUSED(controlId)

    if (!engine)
        return NULL;

    // Load the UI from the plugin.
    QQmlComponent component(engine, QUrl(QStringLiteral("qrc:/DelayGrab/share/qml/main.qml")));

    if (component.isError()) {
        qDebug() << "Error in plugin "
                 << this->metaObject()->className()
                 << ":"
                 << component.errorString();

        return NULL;
    }

    // Create a context for the plugin.
    QQmlContext *context = new QQmlContext(engine->rootContext());
    context->setContextProperty("DelayGrab", const_cast<QObject *>(qobject_cast<const QObject *>(this)));
    context->setContextProperty("controlId", this->objectName());
Example #25
0
MainWindow::MainWindow()
{
    setupUi(this);

    new XmlSyntaxHighlighter(wholeTreeOutput->document());

    /* Setup the font. */
    {
        QFont font("Courier");
        font.setFixedPitch(true);

        wholeTree->setFont(font);
        wholeTreeOutput->setFont(font);
        htmlQueryEdit->setFont(font);
    }

    QXmlNamePool namePool;
    QObjectXmlModel qObjectModel(this, namePool);
    QXmlQuery query(namePool);

    /* The QObject tree as XML view. */
    {
        query.bindVariable("root", qObjectModel.root());
        query.setQuery(QUrl("qrc:/queries/wholeTree.xq"));

        Q_ASSERT(query.isValid());
        QByteArray output;
        QBuffer buffer(&output);
        buffer.open(QIODevice::WriteOnly);

        /* Let's the use the formatter, so it's a bit easier to read. */
        QXmlFormatter serializer(query, &buffer);

        query.evaluateTo(&serializer);
        buffer.close();

        {
            QFile queryFile(":/queries/wholeTree.xq");
            queryFile.open(QIODevice::ReadOnly);
            wholeTree->setPlainText(QString::fromUtf8(queryFile.readAll()));
            wholeTreeOutput->setPlainText(QString::fromUtf8(output.constData()));
        }
    }

    /* The QObject occurrence statistics as HTML view. */
    {
        query.setQuery(QUrl("qrc:/queries/statisticsInHTML.xq"));
        Q_ASSERT(query.isValid());

        QByteArray output;
        QBuffer buffer(&output);
        buffer.open(QIODevice::WriteOnly);

        /* Let's the use the serializer, so we gain a bit of speed. */
        QXmlSerializer serializer(query, &buffer);

        query.evaluateTo(&serializer);
        buffer.close();

        {
            QFile queryFile(":/queries/statisticsInHTML.xq");
            queryFile.open(QIODevice::ReadOnly);
            htmlQueryEdit->setPlainText(QString::fromUtf8(queryFile.readAll()));
            htmlOutput->setHtml(QString(output));
        }
    }
}
void ServicesDialog::on_linkButton_clicked()
{
    QDesktopServices::openUrl(QUrl(m_ui->linkButton->toolTip(), QUrl::TolerantMode));
}
Example #27
0
QByteArray QWget::get(QString url)
{
    return get(QUrl(url));
}
Example #28
0
CollapsibleEffect::CollapsibleEffect(const QDomElement &effect, const QDomElement &original_effect, const ItemInfo &info, EffectMetaInfo *metaInfo, bool canMoveUp, bool lastEffect, QWidget * parent) :
    AbstractCollapsibleWidget(parent),
    m_paramWidget(NULL),
    m_effect(effect),
    m_itemInfo(info),
    m_original_effect(original_effect),
    m_isMovable(true),
    m_animation(NULL),
    m_regionEffect(false)
{
    if (m_effect.attribute(QStringLiteral("tag")) == QLatin1String("region")) {
        m_regionEffect = true;
        decoframe->setObjectName(QStringLiteral("decoframegroup"));
    }
    filterWheelEvent = true;
    m_info.fromString(effect.attribute(QStringLiteral("kdenlive_info")));
    //setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
    buttonUp->setIcon(KoIconUtils::themedIcon(QStringLiteral("kdenlive-up")));
    QSize iconSize = buttonUp->iconSize();
    buttonUp->setMaximumSize(iconSize);
    buttonDown->setMaximumSize(iconSize);
    menuButton->setMaximumSize(iconSize);
    enabledButton->setMaximumSize(iconSize);
    buttonDel->setMaximumSize(iconSize);
    buttonUp->setToolTip(i18n("Move effect up"));
    buttonDown->setIcon(KoIconUtils::themedIcon(QStringLiteral("kdenlive-down")));
    buttonDown->setToolTip(i18n("Move effect down"));
    buttonDel->setIcon(KoIconUtils::themedIcon(QStringLiteral("kdenlive-deleffect")));
    buttonDel->setToolTip(i18n("Delete effect"));
    buttonUp->setEnabled(canMoveUp);
    buttonDown->setEnabled(!lastEffect);

    if (m_effect.attribute(QStringLiteral("id")) == QLatin1String("speed")) {
        // Speed effect is a "pseudo" effect, cannot be moved
        buttonUp->setVisible(false);
        buttonDown->setVisible(false);
        m_isMovable = false;
        setAcceptDrops(false);
    } else {
        setAcceptDrops(true);
    }

    /*buttonReset->setIcon(KoIconUtils::themedIcon("view-refresh"));
    buttonReset->setToolTip(i18n("Reset effect"));*/
    //checkAll->setToolTip(i18n("Enable/Disable all effects"));
    //buttonShowComments->setIcon(KoIconUtils::themedIcon("help-about"));
    //buttonShowComments->setToolTip(i18n("Show additional information for the parameters"));
    m_menu = new QMenu(this);
    m_menu->addAction(KoIconUtils::themedIcon(QStringLiteral("view-refresh")), i18n("Reset Effect"), this, SLOT(slotResetEffect()));
    m_menu->addAction(KoIconUtils::themedIcon(QStringLiteral("document-save")), i18n("Save Effect"), this, SLOT(slotSaveEffect()));

    QHBoxLayout *l = static_cast <QHBoxLayout *>(frame->layout());
    m_colorIcon = new QLabel(this);
    l->insertWidget(0, m_colorIcon);
    m_colorIcon->setMinimumSize(iconSize);
    title = new QLabel(this);
    l->insertWidget(2, title);

    m_enabledButton = new KDualAction(i18n("Disable Effect"), i18n("Enable Effect"), this);
    m_enabledButton->setActiveIcon(KoIconUtils::themedIcon(QStringLiteral("hint")));
    m_enabledButton->setInactiveIcon(KoIconUtils::themedIcon(QStringLiteral("visibility")));
    enabledButton->setDefaultAction(m_enabledButton);

    m_groupAction = new QAction(KoIconUtils::themedIcon(QStringLiteral("folder-new")), i18n("Create Group"), this);
    connect(m_groupAction, SIGNAL(triggered(bool)), this, SLOT(slotCreateGroup()));

    QDomElement namenode = m_effect.firstChildElement(QStringLiteral("name"));
    if (namenode.isNull()) {
        // Warning, broken effect?
        //qDebug()<<"// Could not create effect";
        return;
    }
    QString effectname = i18n(namenode.text().toUtf8().data());
    if (m_regionEffect) effectname.append(':' + QUrl(EffectsList::parameter(m_effect, QStringLiteral("resource"))).fileName());

    // Create color thumb
    QPixmap pix(iconSize);
    QColor col(m_effect.attribute(QStringLiteral("effectcolor")));
    QFont ft = font();
    ft.setBold(true);
    bool isAudio = m_effect.attribute(QStringLiteral("type")) == QLatin1String("audio");
    if (isAudio) {
        pix.fill(Qt::transparent);
    }
    else {
        pix.fill(col);
    }
    QPainter p(&pix);
    if (isAudio) {
        p.setPen(Qt::NoPen);
        p.setBrush(col);
        p.drawEllipse(pix.rect());
        p.setPen(QPen());
    }
    p.setFont(ft);
    p.drawText(pix.rect(), Qt::AlignCenter, effectname.at(0));
    p.end();
    m_iconPix = pix;
    m_colorIcon->setPixmap(pix);
    title->setText(effectname);

    if (!m_regionEffect) {
        if (m_info.groupIndex == -1) m_menu->addAction(m_groupAction);
        m_menu->addAction(KoIconUtils::themedIcon(QStringLiteral("folder-new")), i18n("Create Region"), this, SLOT(slotCreateRegion()));
    }
    setupWidget(info, metaInfo);
    menuButton->setIcon(KoIconUtils::themedIcon(QStringLiteral("kdenlive-menu")));
    menuButton->setMenu(m_menu);

    if (m_effect.attribute(QStringLiteral("disable")) == QLatin1String("1")) {
        title->setEnabled(false);
        m_enabledButton->setActive(true);
    }
    else {
        m_enabledButton->setActive(false);
    }

    connect(collapseButton, SIGNAL(clicked()), this, SLOT(slotSwitch()));
    connect(m_enabledButton, SIGNAL(activeChangedByUser(bool)), this, SLOT(slotDisable(bool)));
    connect(buttonUp, SIGNAL(clicked()), this, SLOT(slotEffectUp()));
    connect(buttonDown, SIGNAL(clicked()), this, SLOT(slotEffectDown()));
    connect(buttonDel, SIGNAL(clicked()), this, SLOT(slotDeleteEffect()));

    Q_FOREACH( QSpinBox * sp, findChildren<QSpinBox*>() ) {
        sp->installEventFilter( this );
        sp->setFocusPolicy( Qt::StrongFocus );
    }
Example #29
0
GameScene::GameScene(GameView *parent) :
    QGraphicsScene(parent),
    m_level(1),
    m_highestLevel(1),
    m_gameState(GameRunning),
    m_dt(0),
    firstStep(true),
    m_selectedType(ParticlePositive),
    m_isSlowMotionEnabled(false),
    currentTime(0),
    lastFrameTime(0),
    frameNumber(0),
    dtSum(0)
{
    qRegisterMetaType<GameScene::GameMode>("GameMode");
    qRegisterMetaType<GameScene::GameState>("GameState");
#ifdef OS_IS_ANDROID
    qDebug() << "Force syncing settings";
    settings.sync();
#endif
    if(isDemo()) {
        qDebug() << "This is the demo version";
    } else {
        qDebug() << "This is the full version";
    }

    setSelectedType(ParticlePositive);

    // load images
    selectionImage = QImage(":/images/selection-overlay.png");
    positiveImage = QImage(":/images/particle-positive.png");
    negativeImage = QImage(":/images/particle-negative.png");
    neutralImage = QImage(":/images/particle-neutral.png");
    playerImage = QImage(":/images/particle-player.png");
    playerOverchargedImage = QImage(":/images/particle-player-overcharged.png");
    glowingImage = QImage(":/images/particle-glowing.png");
    enemyImage = QImage(":/images/particle-enemy.png");
    slowMotionImage = QImage(":/images/particle-slow-motion.png");
    repellentImage = QImage(":/images/particle-repellent.png");
    transferImage = QImage(":/images/particle-transfer.png");

    setSceneRect(0, 0, 854, 480); // TODO: just for init, should be chosen by the platform
    setItemIndexMethod(QGraphicsScene::NoIndex);

    // Background image
    QPixmap backgroundPixmap(":/images/background.png");
    backgroundImage = this->addPixmap(backgroundPixmap);

    // Main menu
    QDeclarativeEngine *engine = new QDeclarativeEngine;
//#ifdef OS_IS_ANDROID
//    QDeclarativeComponent mainMenuComponent(engine, QUrl(adjustPath("assets:/qml/MainMenu.qml")));
//#else
    QDeclarativeComponent mainMenuComponent(engine, QUrl("qrc:/qml/MainMenu.qml"));
//#endif
    engine->rootContext()->setContextProperty("contextGameScene", this);
    mainMenu = qobject_cast<QGraphicsObject *>(mainMenuComponent.create());
    qDebug() << "Component errors:\n" << mainMenuComponent.errors();
    qDebug() << "End component errors";
    // Connect the QML back to this class
    addItem(mainMenu);
    mainMenu->setZValue(1000);
    m_specialParticles = new QList<int>;

#ifdef OS_IS_HARMATTAN
    mainMenu->setProperty("exit.visible", false);
#endif


#ifdef OS_IS_SYMBIAN
    qreal screenWidth = QApplication::desktop()->screenGeometry().width();
    qreal screenHeight = QApplication::desktop()->screenGeometry().height();
    if(screenWidth  > screenHeight) { // Symbian hack
        mainMenu->setProperty("width", screenWidth);
        mainMenu->setProperty("height", screenHeight);
    } else {
        mainMenu->setProperty("width", screenHeight);
        mainMenu->setProperty("height", screenWidth);
    }
#endif

    // set up timer
    levelTimer = new QTimer(this);
    levelTimer->setInterval(1000);
    connect(levelTimer, SIGNAL(timeout()), SLOT(updateLevelTime()));

    // Set up animations
    timeFactorAnimation = new QPropertyAnimation(this, "timeFactor");
    qDebug() << "Highest level is" << m_level;

    setGameState(GameStarted);

    // just init all in the resize() function
    resized();

    // Start level and start timers
    //    startLevel(level());

    connect(&advanceTimer, SIGNAL(timeout()), SLOT(advance()));
    advanceTimer.start(10);
    time.start();
    qDebug() << "Timers started!";

    // dashboard button
#if (defined(OS_IS_DESKTOP_LINUX) || defined(Q_OS_WIN32) || defined(Q_OS_MAC) || defined(Q_WS_MAEMO_5))
    qDebug() << "Show dashboard button";
    mainMenu->setProperty("dashboardButtonVisible", true);
#else
    qDebug() << "Don't show dashboard button";
    mainMenu->setProperty("dashboardButtonVisible", false);
#endif

    // load settings
    setGameMode((GameMode)settings.value("gameMode", ModeClassic).toInt());
}
Example #30
0
void
MainWindow::openDocs(void)
{
  QDesktopServices::openUrl(QUrl("http://rtxi.org/docs/", QUrl::TolerantMode));
}