コード例 #1
0
ファイル: about_dialog.cpp プロジェクト: louislevin12/qipmsg
InfoTab::InfoTab(QWidget *parent)
    : QWidget(parent)
{
    QTextBrowser *info = new QTextBrowser;
    info->setOpenExternalLinks(true);
    info->setFrameShape(QFrame::NoFrame);
    info->setFrameShadow(QFrame::Plain);

    info->setText(
        "<b>QIpMsg</b> &copy; 2007-2010 Yichi Zhang &lt;[email protected]&gt;<br><br>"
        "<b>" + tr("Version: %1").arg(VERSION) + "</b>" +
        "<br>" +
        tr("Compiled with Qt %1").arg(QT_VERSION_STR) + "<br><br>" +
        tr("Visit our web for updates:") + "<br>" +
        link("http://code.google.com/p/qipmsg") +
        "<br><br>" +
        tr("Join qipmsg group to report a bug or request new features:")
        + "<br>" +
        link("http://groups.google.com/group/qipmsg") +
        "<br><br>"
    );

    QPalette p = info->palette();
    p.setColor(QPalette::Base, palette().color(QPalette::Window));
    info->setPalette(p);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(info);

    setLayout(mainLayout);
}
コード例 #2
0
ファイル: fileviewer.cpp プロジェクト: caleb92/RhinoApp2
void FileViewer::on_grabfile_clicked()
{

     //uses name input as arguments for path
    QString location = QString("C:/Users/Mike/Documents/Patients/%1_%2")
                   .arg(first->text())
                   .arg(last->text());

    //FILES//

    //filtering for txt files//
    QStringList textFilter;
    textFilter << "*.txt";

    //opens directory at location, with filter//
    QDir dir(location);

    QFileInfoList textlist = dir.entryInfoList(textFilter, QDir::Files);

    //--actions for each txt file--//
    foreach(QFileInfo f, textlist){

        QString g = f.filePath();    //gets filename
        QFile thisfile(g);           //sets file for filename
        if(!thisfile.open(QIODevice::ReadOnly))
            QMessageBox::information(0,"info",thisfile.errorString()); //creates error message if can't open file
        QTextStream in(&thisfile);                                     //grabs text from file

        QTextBrowser *browser = new QTextBrowser;  //creates textbrowser for file text to display
        browser->setText(in.readAll());            //sets text of textbrowser to file text

        tabWidget->addTab(browser,tr("Doc"));      //adds tab with browser inside, displaying text
    }
コード例 #3
0
ファイル: about_dialog.cpp プロジェクト: louislevin12/qipmsg
LicenseTab::LicenseTab(QWidget *parent)
    : QWidget(parent)
{
    QTextBrowser *license = new QTextBrowser;
    license->setOpenExternalLinks(true);
    license->setFrameShape(QFrame::NoFrame);
    license->setFrameShadow(QFrame::Plain);

    QString gpl = QString(tr(
                              "QIpMsg is free software: you can redistribute it and/or modify"
                              "it under the terms of the GNU General Public License as published by"
                              "the Free Software Foundation, either version 3 of the License, or"
                              "(at your option) any later version."
                              "\n\n"
                              "QIpMsg is distributed in the hope that it will be useful,"
                              "but WITHOUT ANY WARRANTY; without even the implied warranty of"
                              "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the"
                              "GNU General Public License for more details."
                              "\n\n"
                              "QIpMsg is distributed in the hope that it will be useful,"
                              "You should have received a copy of the GNU General Public License"
                              "along with QIpMsg.  If not, see <http://www.gnu.org/licenses>."
                          ));

    license->setText(gpl);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(license);

    setLayout(mainLayout);
}
コード例 #4
0
  virtual int setup() {
    QTextBrowser *qw;
    uint32_t flags;
    GWEN_WIDGET *wParent;
    QSizePolicy::Policy hpolicy=QSizePolicy::Minimum;
    QSizePolicy::Policy vpolicy=QSizePolicy::Minimum;
    const char *s;
    QString text;

    flags=GWEN_Widget_GetFlags(_widget);
    wParent=GWEN_Widget_Tree_GetParent(_widget);
    s=GWEN_Widget_GetText(_widget, 0);
    if (s)
      text=QString::fromUtf8(s);

    qw=new QTextBrowser();
    qw->setText(text);

    /* handle flags */
    if (flags & GWEN_WIDGET_FLAGS_FILLX)
      hpolicy=QSizePolicy::Expanding;
    if (flags & GWEN_WIDGET_FLAGS_FILLY)
      vpolicy=QSizePolicy::Expanding;
    qw->setSizePolicy(hpolicy, vpolicy);

    GWEN_Widget_SetImplData(_widget, QT4_DIALOG_WIDGET_REAL, (void*) qw);

    if (wParent)
      GWEN_Widget_AddChildGuiWidget(wParent, _widget);
    return 0;
  }
コード例 #5
0
ファイル: addressbook.cpp プロジェクト: Tuxkowo/swithom
// Traitement des liens internes. (Google Maps, impression etc.)
void AddressBook::inContextLink(QUrl ClickedUrl) {
  // On récupère le lien interne qui a été cliqué dans un QString
  QString url = ClickedUrl.toString();

  // Si le lien renvoit à une carte
  if(url == QString("#map-home") || url == QString("#map-pro")) {
      // On crée une nouvelle variable qui contiendra le code HTML qui sera chargé.
      QString htmlToLoad;
      // On crée un nouveau panneau latéral pour afficher la carte.
      dockMaps = new QDockWidget(tr(""), this);
      // On définie sa zone d'affichage : en bas.
      addDockWidget(Qt::BottomDockWidgetArea, dockMaps);
      // On crée un nouveau cadre affichant des données de navigateur
      mapsWidget = new QWebView(this);

    // On affecte au panneau latéral le cadre navigateur
    dockMaps->setWidget(mapsWidget);



    // Clé d'API Google Maps pour http://gui.llau.me/qt-carnet-d-adresses/
    // Cette clé est indispensable à l'affichage des cartes
    QString mapsAPIKey = "ABQIAAAAF3hdW0iCuciJyOHyZmTetBRWCoxDrcoBpj3A2QC_s_fnpaw3-BTKouwd2AauKKv8EeFkiPGnTWemIA";

    // Si le lien cliqué demmande l'affichage de la carte du domicile du contact
    if(url == QString("#map-home")) {
        // On ajoute le script javascript nécéssaire à l'affichage de la carte à htmlToLoad
        htmlToLoad = QString("<script src=\"http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=" + mapsAPIKey + "\" type=\"text/javascript\"></script>"
                             "<div id=\"map_canvas\" style=\"width: 100%; height: 100%\"></div>"
                             "<script type=\"text/javascript\">var map = new GMap2(document.getElementById(\"map_canvas\")); map.setCenter(new GLatLng(48.9, 2.3), 7); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl());geocoder = new GClientGeocoder();" //;
                             "function afficherAdresse(address) { if (geocoder) { geocoder.getLatLng( address, function(point) { if (!point) { alert(address + ' introuvable');} else {map.setCenter(point, 13);var marker = new GMarker(point);map.addOverlay(marker);marker.openInfoWindowHtml(address);}});}}"
                             "afficherAdresse('" + oldhomeaddress + " " + oldhomezip + " " + oldhomecity + "')</script>");
        // On défini le titre du cadre
        dockMaps->setWindowTitle(tr("Adresse personnelle de ") + oldlastname + " " + oldname);
    }
    // Si le lien cliqué demmande l'affichage de la carte du bureau du contact
    else if(url == QString("#map-pro")) {
        // On ajoute le script javascript nécéssaire à l'affichage de la carte à htmlToLoad
        htmlToLoad = QString("<script src=\"http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=" + mapsAPIKey + "\" type=\"text/javascript\"></script>"
                             "<div id=\"map_canvas\" style=\"width: 100%; height: 100%\"></div>"
                             "<script type=\"text/javascript\">var map = new GMap2(document.getElementById(\"map_canvas\")); map.setCenter(new GLatLng(48.9, 2.3), 7); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl());geocoder = new GClientGeocoder();" //;
                             "function afficherAdresse(address) { if (geocoder) { geocoder.getLatLng( address, function(point) { if (!point) { alert(address + ' introuvable');} else {map.setCenter(point, 13);var marker = new GMarker(point);map.addOverlay(marker);marker.openInfoWindowHtml(address);}});}}"
                             "afficherAdresse('" + oldproaddress + " " + oldprozip + " " + oldprocity + "')</script>");
        // On défini le titre du cadre
        dockMaps->setWindowTitle(tr("Adresse professionnelle de ") + oldlastname + " " + oldname);
    }

    mapsWidget->setHtml(htmlToLoad);
}

  // Si on a choisi d'imprimer la fiche du contact
  if(url == QString("#print-contact")) {
      QPrinter *printer = new QPrinter;
      QTextBrowser *printdata = new QTextBrowser;
      printdata->setText("<h1>" + oldlastname.toUpper() + " " + oldname + "</h1>" + FormatedDataTel + FormatedDataHome + FormatedDataPro + FormatedDataWeb + FormatedDataMisc);
      printdata->print(printer);
  }
}
コード例 #6
0
void UIVMDesktopPrivate::setError(const QString &strError)
{
    /* Prepare error pane if necessary: */
    prepareErrorPane();

    /* Assign corresponding text: */
    m_pErrText->setText(strError);

    /* Raise corresponding widget: */
    setCurrentIndex(indexOf(m_pErrBox));
}
コード例 #7
0
ファイル: exptranwindow.cpp プロジェクト: dem42/exp_tran
void ExpTranWindow::displayException(const std::exception &e)
{
    QDialog d;
    QVBoxLayout *layout = new QVBoxLayout();
    QTextBrowser *browser = new QTextBrowser;
    QString str = e.what();
    browser->setText(str);
    layout->addWidget(browser);
    d.setLayout(layout);

    d.setWindowTitle("Error");
    d.exec();
}
コード例 #8
0
  int setCharProperty(GWEN_DIALOG_PROPERTY prop,
                      int index,
                      const char *value,
                      int doSignal) {
    QTextBrowser *qw;
    QString text;

    qw=(QTextBrowser*) GWEN_Widget_GetImplData(_widget, QT4_DIALOG_WIDGET_REAL);
    assert(qw);

    if (value)
      text=QT4_Gui::extractHtml(value);

    switch(prop) {
    case GWEN_DialogProperty_Value:
      qw->setText("");
      qw->append(text);
      return 0;

    case GWEN_DialogProperty_AddValue:
      qw->append(text);
      return 0;

    case GWEN_DialogProperty_ClearValues:
      qw->setText("");
      return 0;

    default:
      break;
    }

    DBG_WARN(GWEN_LOGDOMAIN,
             "Function is not appropriate for this type of widget (%s)",
             GWEN_Widget_Type_toString(GWEN_Widget_GetType(_widget)));
    return GWEN_ERROR_INVALID;
  };
コード例 #9
0
ファイル: textdialog.cpp プロジェクト: ids1024/genchemlab
TextDialog::TextDialog(QString t1, QWidget *parent, QString name):
        QDialog(parent)
{
  setObjectName(name);
  setModal(true);
  setWindowTitle( tr("Output") );
  QTextBrowser *te = new QTextBrowser(this);
  te->setObjectName("good label");
  te->setText(t1);
  te->setGeometry(10,10,230,200);
  QPushButton *ok;
  ok = new QPushButton(tr("OK"), this);
  ok->setGeometry(85,250,80,30);
  ok->setPalette(QPalette(Qt::lightGray));
  connect(ok, SIGNAL(clicked()), SLOT(accept()) );
}
コード例 #10
0
ファイル: openglqtmenu.cpp プロジェクト: sarbi127/inviwo
void OpenGLQtMenu::shaderMenuCallback(QObject* obj) {
    QSize id = qobject_cast<QAction*>(obj)->data().toSize();
    int shaderId = id.width();
    int type = id.height();

    const std::vector<Shader*> shaders{ShaderManager::getPtr()->getShaders()};
    auto it = std::find_if(shaders.begin(), shaders.end(), [shaderId](Shader* shader) -> bool {
        return static_cast<int>(shader->getID()) == shaderId;
    });

    if (it != shaders.end()) {
        ShaderObject* shaderObj;
        switch (type) {
            case 1:
                shaderObj = (*it)->getVertexShaderObject();
                break;
            case 2:
                shaderObj = (*it)->getGeometryShaderObject();
                break;
            case 3:
                shaderObj = (*it)->getFragmentShaderObject();
                break;
            default:
                return;
        }

        QMainWindow* win =
            static_cast<InviwoApplicationQt*>(InviwoApplication::getPtr())->getMainWindow();
        
        QTextBrowser* shadercode = new QTextBrowser(nullptr);
        shadercode->setText(shaderObj->print(true).c_str());
        shadercode->setStyleSheet("font: 12pt \"Courier\";");

        QDialog* dialog = new QDialog(win);
        QGridLayout* layout = new QGridLayout(dialog);
        layout->setContentsMargins(0, 0, 0, 0);
        layout->setSpacing(0);
        layout->addWidget(shadercode);
        dialog->setLayout(layout);
        dialog->resize(600, 800);
        dialog->exec();

        delete dialog;
    }
}
コード例 #11
0
RulesWindow::RulesWindow(QWidget *parent)
	: QDialog(parent)
{
	setWindowTitle("Zasady i pomoc");

	QVBoxLayout *mainLayout = new QVBoxLayout(this);
	QTabWidget *tabWidget = new QTabWidget();

	QLabel *reminderLabel = new QLabel(QString::fromUtf8("Możesz wyświetlić zasady w dowolnym momencie naciskając F1"));
	QPushButton *confirmButton = new QPushButton("Ok");
	connect(confirmButton, SIGNAL(clicked()), this, SLOT(close()));
	QHBoxLayout *bottomLayout = new QHBoxLayout();
	bottomLayout->addWidget(reminderLabel);
	bottomLayout->addStretch();
	bottomLayout->addWidget(confirmButton);

	mainLayout->addWidget(tabWidget);
	mainLayout->addLayout(bottomLayout);

	QTextBrowser *generalHelp = new QTextBrowser();
	tabWidget->addTab(generalHelp, QString::fromUtf8("Ogólne"));

	generalHelp->setText(QString::fromUtf8("Jest to gra typu RPG, gdzie każdy gracz posiada własną postać z określonymi statystykami i ekwipunkiem, którą rozwija przez całą rozgrywkę.\nGracz wybiera rasę i klasę dla swojej postaci, które mają wpływ na statystykę oraz ekwipunek.\nGracze kolejno w swoich turach poruszają się po planszy pomiędzy czterema królestwami, walczą z przeciwnikami lub wykonują zlecone zadania. Co turę postać gracza regeneruje się (ilość regenerowanych punktów zdrowia jest podana w nawiasach obok paska zdrowia)."));

	QTextBrowser *equipmentHelp = new QTextBrowser();
	tabWidget->addTab(equipmentHelp, QString("Ekwipunek"));
	equipmentHelp->setText(QString::fromUtf8("Każdy gracz dysponuje własnym ekwipunkiem, którym może zarządzać poza walką, a także handlować na bazarze w miastach.\nGracz może posiadać założony jednocześnie hełm, zbroję, broń jedno- albo dwuręczną, tarczę oraz artefakty. Tarcza nie może być używana równocześnie z bronią dwuręczną. Nie można jednocześnie nosić wiecej niż ") + QString::number(Item::ArtifactLimit) + QString::fromUtf8(" artefaktów.\nPrzedmioty posiadają ograniczenia ze względu na klasę postaci, która miałaby go używać. Dodatkowo wiele przedmiotów jest na tyle mocnych, że gracz może ich użyć dopiero od ") + QString::number(Player::MaxLevel) + QString::fromUtf8(" poziomu. Warto zwrócić na to uwagę przed ewentualnym zakupem!\nGracz może tylko raz na turę zajrzeć na bazar.\nbonus Małej Mikstury Zdrowia: ") + QString::number(DZIALANIE_MALYCH_POTOW) + QString::fromUtf8(",\nbonus Dużej Mikstury Zdrowia: ") + QString::number(DZIALANIE_DUZYCH_POTOW));

	QTextBrowser *movementHelp = new QTextBrowser();
	tabWidget->addTab(movementHelp, QString("Poruszanie"));
	movementHelp->setText(QString::fromUtf8("Gracz może raz na turę, przed skorzystaniem z opcji pola na którym stoi przesunąć swój pionek na planszy. Osiągalne pola są automatycznie podświetlane.\nKażde pole ma przypisany współczynnik poruszania się po nim. Suma współczynników przekraczanych pól nie może być większa od punktów ruchu gracza, którymi w dany momencie dysponuje.\nWspółczynniki pól:\nmiasto: 0\ndroga: 1\nrównina: 2\nlas: 2\nwoda: 3\ngóry: 3\nbagno: 4"));

	QTextBrowser *questsHelp = new QTextBrowser();
	tabWidget->addTab(questsHelp, QString("Zadania"));
	questsHelp->setText(QString::fromUtf8("Gracz może będąc w tawernie podjąc się wykonania zadań, ale w tym samym czasie może wykonywać ich nie więcej niż ") + QString::number(MaximumNumberOfQuestsTaken) + QString::fromUtf8(".\nZadania są jedynym źródłem reputacji. Gracz może tylko raz na turę zajrzeć do tawerny.\n W nawiasach obok zadania podany jest orientacyjny poziom przeciwnika, z  którym przyjdzie się mierzyć lub (*) jeśli wykonanie zadania nie wymaga walki"));

	QTextBrowser *fightHelp = new QTextBrowser();
	tabWidget->addTab(fightHelp, QString("Walka"));
	fightHelp->setText(QString::fromUtf8("Na planszy znajdują się wyszczególnione pola z planszą, gdzie gracz może walczyć ze słabszym albo mocniejszym przeciwnikiem. Niemożliwe jest jednak skorzystanie z tego samego pola dwukrotnie w kolejnych turach. \n\nWalka to ciąg naprzemiennych ataków gracza i przeciwnika. Walka trwa, dopóki jeden z walczących nie zginie, lub gdy gracz zdecyduje się uciec.\nObrażenia zadane przez gracza to:  bazowa wartość wybranego ataku + losowa wartość z przedziału [1; ") + QString::number(PlayerDice) + QString::fromUtf8("] -  wartość obrony przeciwnika (obrażenia nie mogą być ujemne).\nObrażenia zadane przez przeciwnika to: losowa wartość z przedziału przypisanego do przeciwnika - wartość obrony gracza (obrażenia nie mogą być ujemne).\nPo walce następuje automatyczny koniec tury."));

	QTextBrowser *levelUpHelp = new QTextBrowser();
	tabWidget->addTab(levelUpHelp, QString("Awans"));
	QString attributesString;
	for (int i = 0; i < LICZBA_ATRYBOTOW_DO_AWANSU; ++i)
		attributesString += MOZLIWE_AWANSE[i] + QString(", ");
	levelUpHelp->setText(QString::fromUtf8("Po zebraniu odpowiedniej ilości doświadczenia gracz awansuje na wyższy poziom. Może przy tej okazji rozdzielić ") + QString::number(AttributePointsPerLevel) + QString::fromUtf8(" punkty atrybutów, które może przeznaczyć na zwiększenie o 1 jednego z następujących atrybutów: ") + attributesString + QString::fromUtf8(".Dodatkowo przy każdym awansie liczba maksymalnych punktów zdrowia zwiększa się o ") + QString::number(HealthIncreasePerLevel) + QString("."));

	QTextBrowser *endHelp = new QTextBrowser();
	tabWidget->addTab(endHelp, QString("Koniec"));
	endHelp ->setText(QString::fromUtf8("Gra kończy się, gdy w grze pozostanie tylko 1 gracz, lub gdy jeden z graczy osiągnie maksymalny ") + QString::number(MaximumLevel) + QString::fromUtf8(" poziom oraz będzie posiadał ") + QString::number(MaximumReputation) + QString::fromUtf8(" punktów reputacji w co najmniej ") + QString::number(MaximumReputationsToWin) + QString::fromUtf8(" królestwach."));
}
コード例 #12
0
ファイル: about_dialog.cpp プロジェクト: louislevin12/qipmsg
ContributorTab::ContributorTab(QWidget *parent)
    : QWidget(parent)
{
    QTextBrowser *contributors = new QTextBrowser;
    contributors->setOpenExternalLinks(true);
    contributors->setFrameShape(QFrame::NoFrame);
    contributors->setFrameShadow(QFrame::Plain);

    contributors->setText(getContributor());

    QPalette p = contributors->palette();
    p.setColor(QPalette::Base, palette().color(QPalette::Window));
    contributors->setPalette(p);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(contributors);

    setLayout(mainLayout);
}
コード例 #13
0
ファイル: commandhelpbutton.cpp プロジェクト: DINKIN/CopyQ
void CommandHelpButton::showHelp()
{
    if (!m_help) {
        m_help = new QDialog(this);
        m_help->setObjectName("commandHelpDialog");
        WindowGeometryGuard::create(m_help);

        QTextBrowser *browser = new QTextBrowser(this);
        QVBoxLayout *layout = createLayout(m_help);
        layout->addWidget(browser);

        QDialogButtonBox *buttonBox = new QDialogButtonBox(
                    QDialogButtonBox::Close, Qt::Horizontal, m_help);
        layout->addWidget(buttonBox);
        QObject::connect(buttonBox, SIGNAL(rejected()), m_help, SLOT(hide()));

        browser->setText(help());
    }

    m_help->show();
}
コード例 #14
0
ファイル: commandexec.cpp プロジェクト: KDE/kdesvn
int CommandExec::exec(const QCommandLineParser *parser)
{
    m_pCPart->parser = const_cast<QCommandLineParser*>(parser);
    m_pCPart->args = parser->positionalArguments();
    if (m_pCPart->args.isEmpty()) {
        return -1;
    }
    m_lastMessages.clear();
    m_lastMessagesLines = 0;
    m_pCPart->m_SvnWrapper->reInitClient();
    bool dont_check_second = false;
    bool dont_check_all = false;
    bool path_only = false;
    bool no_revision = false;
    bool check_force = false;

    if (m_pCPart->args.count() >= 2) {
        m_pCPart->cmd = m_pCPart->args.at(1);
        m_pCPart->cmd = m_pCPart->cmd.toLower();
    }
    QByteArray slotCmd;
    if (!QString::compare(m_pCPart->cmd, "log")) {
        slotCmd = SLOT(slotCmd_log());
    } else if (!QString::compare(m_pCPart->cmd, "cat")) {
        slotCmd = SLOT(slotCmd_cat());
        m_pCPart->single_revision = true;
    } else if (!QString::compare(m_pCPart->cmd, "get")) {
        slotCmd = SLOT(slotCmd_get());
        m_pCPart->single_revision = true;
    } else if (!QString::compare(m_pCPart->cmd, "help")) {
        slotCmd = SLOT(slotCmd_help());
    } else if (!QString::compare(m_pCPart->cmd, "blame") ||
               !QString::compare(m_pCPart->cmd, "annotate")) {
        slotCmd = SLOT(slotCmd_blame());
    } else if (!QString::compare(m_pCPart->cmd, "update")) {
        slotCmd = SLOT(slotCmd_update());
        m_pCPart->single_revision = true;
    } else if (!QString::compare(m_pCPart->cmd, "diff")) {
        m_pCPart->start = svn::Revision::WORKING;
        slotCmd = SLOT(slotCmd_diff());
    } else if (!QString::compare(m_pCPart->cmd, "info")) {
        slotCmd = SLOT(slotCmd_info());
        m_pCPart->single_revision = true;
    } else if (!QString::compare(m_pCPart->cmd, "commit") ||
               !QString::compare(m_pCPart->cmd, "ci")) {
        slotCmd = SLOT(slotCmd_commit());
    } else if (!QString::compare(m_pCPart->cmd, "list") ||
               !QString::compare(m_pCPart->cmd, "ls")) {
        slotCmd = SLOT(slotCmd_list());
    } else if (!QString::compare(m_pCPart->cmd, "copy") ||
               !QString::compare(m_pCPart->cmd, "cp")) {
        slotCmd = SLOT(slotCmd_copy());
        dont_check_second = true;
    } else if (!QString::compare(m_pCPart->cmd, "move") ||
               !QString::compare(m_pCPart->cmd, "rename") ||
               !QString::compare(m_pCPart->cmd, "mv")) {
        slotCmd = SLOT(slotCmd_move());
        dont_check_second = true;
    } else if (!QString::compare(m_pCPart->cmd, "checkout") ||
               !QString::compare(m_pCPart->cmd, "co")) {
        slotCmd = SLOT(slotCmd_checkout());
        dont_check_second = true;
    } else if (!QString::compare(m_pCPart->cmd, "checkoutto") ||
               !QString::compare(m_pCPart->cmd, "coto")) {
        slotCmd = SLOT(slotCmd_checkoutto());
        dont_check_second = true;
    } else if (!QString::compare(m_pCPart->cmd, "export")) {
        slotCmd = SLOT(slotCmd_export());
        dont_check_second = true;
    } else if (!QString::compare(m_pCPart->cmd, "exportto")) {
        slotCmd = SLOT(slotCmd_exportto());
        dont_check_second = true;
    } else if (!QString::compare(m_pCPart->cmd, "delete") ||
               !QString::compare(m_pCPart->cmd, "del") ||
               !QString::compare(m_pCPart->cmd, "rm") ||
               !QString::compare(m_pCPart->cmd, "remove")) {
        slotCmd = SLOT(slotCmd_delete());
    } else if (!QString::compare(m_pCPart->cmd, "add")) {
        slotCmd = SLOT(slotCmd_add());
        dont_check_all = true;
        path_only = true;
    } else if (!QString::compare(m_pCPart->cmd, "undo") ||
               !QString::compare(m_pCPart->cmd, "revert")) {
        slotCmd = SLOT(slotCmd_revert());
    } else if (!QString::compare(m_pCPart->cmd, "checknew") ||
               !QString::compare(m_pCPart->cmd, "addnew")) {
        slotCmd = SLOT(slotCmd_addnew());
    } else if (!QString::compare(m_pCPart->cmd, "switch")) {
        slotCmd = SLOT(slotCmd_switch());
    } else if (!QString::compare(m_pCPart->cmd, "tree")) {
        slotCmd = SLOT(slotCmd_tree());
    } else if (!QString::compare(m_pCPart->cmd, "lock")) {
        slotCmd = SLOT(slotCmd_lock());
        no_revision = true;
        check_force = true;
    } else if (!QString::compare(m_pCPart->cmd, "unlock")) {
        slotCmd = SLOT(slotCmd_unlock());
        no_revision = true;
        check_force = true;
    }

    bool found = connect(this, SIGNAL(executeMe()), this, slotCmd.constData());
    if (!found) {
        KMessageBox::sorry(0,
                           i18n("Command \"%1\" not implemented or known", m_pCPart->cmd),
                           i18n("SVN Error"));
        return -1;
    }

    QString tmp;
    QString mainProto;
    for (int j = 2; j < m_pCPart->args.count(); ++j) {
        QUrl tmpurl = QUrl::fromUserInput(m_pCPart->args.at(j),
                                          QDir::currentPath());
        tmpurl.setScheme(svn::Url::transformProtokoll(tmpurl.scheme()));
        if (tmpurl.scheme().indexOf(QLatin1String("ssh")) != -1) {
            SshAgent ag;
            // this class itself checks if done before
            ag.addSshIdentities();
        }
        m_pCPart->extraRevisions[j - 2] = svn::Revision::HEAD;

        if (tmpurl.isLocalFile() && (j == 2 || !dont_check_second) && !dont_check_all) {
            QUrl repoUrl;
            if (m_pCPart->m_SvnWrapper->isLocalWorkingCopy(tmpurl.path(), repoUrl)) {
                tmp = tmpurl.path();
                m_pCPart->repoUrls[j - 2] = repoUrl;
                m_pCPart->extraRevisions[j - 2] = svn::Revision::WORKING;
                if (j == 2) {
                    mainProto.clear();
                }
            } else {
                tmp = tmpurl.url();
                if (j == 2) {
                    mainProto = QLatin1String("file://");
                }
            }
        } else if (path_only) {
            tmp = tmpurl.path();
        } else {
            tmp = tmpurl.url();
            if (j == 2) {
                mainProto = tmpurl.scheme();
            }
        }
        if ((j > 2 && dont_check_second) || dont_check_all) {
            if (mainProto.isEmpty()) {
                tmp = tmpurl.path();
            }
        }
        const QStringList l = tmp.split(QLatin1Char('?'), QString::SkipEmptyParts);
        if (!l.isEmpty()) {
            tmp = l[0];
        }
        while (tmp.endsWith(QLatin1Char('/'))) {
            tmp.chop(1);
        }
        m_pCPart->urls.append(tmp);
        if ((j > 2 && dont_check_second) || dont_check_all) {
            continue;
        }
        const QList<QPair<QString, QString> > q = QUrlQuery(tmpurl).queryItems();
        for(int i = 0; i < q.size(); ++i) {
            if (q.at(i).first == QLatin1String("rev")) {
                svn::Revision re = q.at(i).second;
                if (re) {
                    m_pCPart->extraRevisions[j - 2] = re;
                }
            }
        }
    }
    if (m_pCPart->urls.isEmpty()) {
        m_pCPart->urls.append(QLatin1String("."));
    }

    if (!no_revision) {
        if (m_pCPart->parser->isSet("R")) {
            m_pCPart->ask_revision = true;
            if (!askRevision()) {
                return 0;
            }
        } else if (m_pCPart->parser->isSet("r")) {
            scanRevision();
        }
    }

    m_pCPart->force = check_force && m_pCPart->parser->isSet("f");

    if (m_pCPart->parser->isSet("o")) {
        m_pCPart->outfile_set = true;
        m_pCPart->outfile = m_pCPart->parser->value("o");
    }
    if (m_pCPart->parser->isSet("l")) {
        QString s = m_pCPart->parser->value("l");
        m_pCPart->log_limit = s.toInt();
        if (m_pCPart->log_limit < 0) {
            m_pCPart->log_limit = 0;
        }
    }

    emit executeMe();
    if (Kdesvnsettings::self()->cmdline_show_logwindow() &&
            m_lastMessagesLines >= Kdesvnsettings::self()->cmdline_log_minline()) {
        QPointer<KSvnSimpleOkDialog> dlg(new KSvnSimpleOkDialog(QStringLiteral("kdesvn_cmd_log"), QApplication::activeModalWidget()));
        QTextBrowser *ptr = new QTextBrowser(dlg);
        ptr->setText(m_lastMessages);
        ptr->setReadOnly(true);
        dlg->addWidget(ptr);
        QString cmd = qApp->arguments().join(QLatin1Char(' '));
        dlg->setWindowTitle(cmd);
        dlg->exec();
        delete dlg;
    }
    return 0;
}
コード例 #15
0
ファイル: openconnectauth.cpp プロジェクト: KDE/plasma-nm
void OpenconnectAuthWidget::validatePeerCert(const QString &fingerprint,
                                             const QString &peerCert, const QString &reason, bool *accepted)
{
    Q_D(OpenconnectAuthWidget);

    const QString host = QLatin1String(openconnect_get_hostname(d->vpninfo));
    const QString port = QString::number(openconnect_get_port(d->vpninfo));
    const QString key = QString("certificate:%1:%2").arg(host,  port);
    const QString value = d->secrets.value(key);

#if !OPENCONNECT_CHECK_VER(5,0)
#define openconnect_check_peer_cert_hash(v,d) strcmp(d, fingerprint.toUtf8().data())
#endif

    if (openconnect_check_peer_cert_hash(d->vpninfo, value.toUtf8().data())) {
        QWidget *widget = new QWidget();
        QVBoxLayout *verticalLayout;
        QHBoxLayout *horizontalLayout;
        QLabel *icon;
        QLabel *infoText;
        QTextBrowser *certificate;

        verticalLayout = new QVBoxLayout(widget);
        horizontalLayout = new QHBoxLayout(widget);
        icon = new QLabel(widget);
        QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
        sizePolicy.setHorizontalStretch(0);
        sizePolicy.setVerticalStretch(0);
        sizePolicy.setHeightForWidth(icon->sizePolicy().hasHeightForWidth());
        icon->setSizePolicy(sizePolicy);
        icon->setMinimumSize(QSize(48, 48));
        icon->setMaximumSize(QSize(48, 48));

        horizontalLayout->addWidget(icon);

        infoText = new QLabel(widget);
        infoText->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);

        horizontalLayout->addWidget(infoText);

        verticalLayout->addLayout(horizontalLayout);

        certificate = new QTextBrowser(widget);
        certificate->setTextInteractionFlags(Qt::TextSelectableByMouse);
        certificate->setOpenLinks(false);

        verticalLayout->addWidget(certificate);

        icon->setPixmap(QIcon::fromTheme("dialog-information").pixmap(KIconLoader::SizeLarge));
        infoText->setText(i18n("Check failed for certificate from VPN server \"%1\".\n"
                               "Reason: %2\nAccept it anyway?", openconnect_get_hostname(d->vpninfo),reason));
        infoText->setWordWrap(true);
        certificate->setText(peerCert);

        QPointer<QDialog> dialog = new QDialog(this);
        dialog.data()->setWindowModality(Qt::WindowModal);
        dialog->setLayout(new QVBoxLayout);
        QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel, dialog);
        connect(buttons, &QDialogButtonBox::accepted, dialog.data(), &QDialog::accept);
        connect(buttons, &QDialogButtonBox::rejected, dialog.data(), &QDialog::reject);
        dialog->layout()->addWidget(widget);
        dialog->layout()->addWidget(buttons);
        if(dialog.data()->exec() == QDialog::Accepted) {
            *accepted = true;
        } else {
            *accepted = false;
        }
        if (dialog) {
            dialog.data()->deleteLater();
        }
        widget->deleteLater();
    } else {
        *accepted = true;
    }
    if (*accepted) {
        d->secrets.insert(key, QString(fingerprint));
    }
    d->mutex.lock();
    d->workerWaiting.wakeAll();
    d->mutex.unlock();
}
コード例 #16
0
ファイル: mainwindow_help.cpp プロジェクト: ericbsd/octopkg
/*
 * Initialize the Help tab with basic information about using OctoPkg
 */
void MainWindow::initTabHelpUsage()
{
  QWidget *tabHelpUsage = new QWidget();
  QGridLayout *gridLayoutX = new QGridLayout(tabHelpUsage);
  gridLayoutX->setSpacing(0);
  gridLayoutX->setMargin(0);

  QTextBrowser *text = new QTextBrowser(tabHelpUsage);
  text->setObjectName("textBrowser");
  text->setReadOnly(true);
  text->setFrameShape(QFrame::NoFrame);
  text->setFrameShadow(QFrame::Plain);
  text->setOpenExternalLinks(true);
  gridLayoutX->addWidget(text, 0, 0, 1, 1);

  QString iconPath = "<img height=\"16\" width=\"16\" src=\":/resources/images/";

  QString strForMoreInfo = tr("For more information, visit:");
  QString html =
    QString("<h2>OctoPkg</h2>") +
    QString("<h3><p>") + tr("A Qt5-based pkgng front-end,") + " " +
    tr("licensed under the terms of") + " ";

  if ((!WMHelper::isKDERunning() && (!WMHelper::isRazorQtRunning())))
  {
    html +=
      QString("<a style=\"color:'#4BC413'\" href=\"http://www.gnu.org/licenses/gpl-2.0.html\">GPL v2</a>.</p></h3>") +
      QString("<h4><p>") + strForMoreInfo + " " +
      QString("<a style=\"color:'#4BC413'\" href=\"http://octopkg.wordpress.com\">http://octopkg.wordpress.com</a>.</p></h4><br>");
  }
  else
  {
    html +=
      QString("<a href=\"http://www.gnu.org/licenses/gpl-2.0.html\">GPL v2</a>.</p></h3>") +
      QString("<h4><p>") + strForMoreInfo + " " +
      QString("<a href=\"http://octopkg.wordpress.com\">http://octopkg.wordpress.com</a>.</p></h4><br>");
  }

  html += tr("Package classification:") +
  QString("<ul type=\"square\"><li>") + iconPath + "installed.png\"/> " +
     tr("An installed package") + QString("</li>") +
  QString("<li>") + iconPath + "unrequired.png\"/> " +
     tr("An installed package (not required by others)") +
  QString("</li>") +
  QString("</li>") +
  QString("<li>") + iconPath + "noninstalled.png\"/> " +
     tr("A non installed package") +
  QString("</li>") +
  QString("<li>") + iconPath + "outdated.png\"/> " +
     tr("An outdated package") +
  QString("</li>") +
  QString("</li></ul>") +
  /*QString("<li>") + iconPath + "newer.png\"/> " +
           tr("A newer than repository package") +
  QString("</li></ul>") +*/

     tr("Basic usage help:") +
  QString("<ul><li>") +
     tr("Position the mouse over a package to see its description") +
  QString("</li><li>") +
     tr("Double click an installed package to see its contents") +
  QString("</li><li>") +
     tr("Right click package to install/reinstall or remove it") +
  QString("</li></ul>") +

     tr("Alt+key sequences:") +
  QString("<ul><li>") +
     tr("Alt+1 to switch to 'Info' tab") +
  QString("</li><li>") +
     tr("Alt+2 to switch to 'Files' tab") +
  QString("</li><li>") +
     tr("Alt+3 to switch to 'Transaction' tab") +
  QString("</li><li>") +
     tr("Alt+4 to switch to 'Output' tab") +
  QString("</li><li>") +
     tr("Alt+5 to switch to 'News' tab") +
  QString("</li><li>") +
     tr("Alt+6 or 'F1' to show this help page") +
  QString("</li><li>") +
     tr("Alt+\"Left key\" to go to previous clicked anchor") +
  QString("</li><li>") +
     tr("Alt+\"Right key\" to go to next clicked anchor") +
  QString("</li><li>") +
     tr("Alt+\"Home key\" to go to first clicked anchor") +
  QString("</li><li>") +
     tr("Alt+\"End key\" to go to last clicked anchor") +
  QString("</li></ul>") +

     tr("Control+key sequences:") +
  QString("<ul><li>") +
     tr("Ctrl+D or 'File/Sync database' to sync the local database with latest remote changes") +
  QString("</li><li>") +
     tr("Ctrl+U or 'File/System upgrade' to make a full system upgrade") +
  QString("</li><li>") +
     tr("Ctrl+L to find a package in the package list") +
  QString("</li><li>") +
     tr("Ctrl+F to search for text inside tab Files, News and Usage") +
  //QString("</li><li>") +
  //   tr("Ctrl+N or 'View/Non installed' to show/hide non installed packages") +
  QString("</li><li>") +
     tr("Ctrl+M or 'Transaction/Commit' to start installation/removal of selected packages") +
  QString("</li><li>") +
     tr("Ctrl+E or 'Transaction/Cancel' to clear the selection of to be removed/installed packages") +
  QString("</li><li>") +
     tr("Ctrl+G or 'File/Get latest distro news' to retrieve the latest RSS based distro news") +
  QString("</li><li>") +
     tr("Ctrl+Q or 'File/Exit' to exit the application") +
  QString("</li></ul>") +

  /*   tr("Control+shift+key sequences:") +
  QString("<ul><li>") +
     tr("Ctrl+Shift+C to clean local packages cache (pacman -Sc)") +
  QString("</li><li>") +
     tr("Ctrl+Shift+G to display all package groups") +
  QString("</li><li>") +
     tr("Ctrl+Shift+R to remove Pacman's transaction lock file") +
  QString("</li><li>") +
     tr("Ctrl+Shift+Y to display %1 group").arg(StrConstants::getForeignRepositoryGroupName()) +
  QString("</li></ul>") +*/

     tr("F+key sequences:") +
  QString("<ul><li>") +
     tr("F1 to show this help page") +
  QString("</li><li>") +
     tr("F4 to open a Terminal whitin the selected directory at Files tab") +
  QString("</li><li>") +
     tr("F6 to open a File Manager whitin the selected directory at Files tab") +
  QString("</li><li>") +
     tr("F10 to maximize/demaximize package list view") +
  QString("</li><li>") +
     tr("F12 to maximize/demaximize Tab's view") +
  QString("</li></ul>");

  text->setText(html);
  int tindex = ui->twProperties->addTab(tabHelpUsage, StrConstants::getHelpUsage() );
  ui->twProperties->setTabText(ui->twProperties->indexOf(tabHelpUsage), StrConstants::getHelpUsage());

  SearchBar *searchBar = new SearchBar(this);
  connect(searchBar, SIGNAL(textChanged(QString)), this, SLOT(searchBarTextChangedInTextBrowser(QString)));
  connect(searchBar, SIGNAL(closed()), this, SLOT(searchBarClosedInTextBrowser()));
  connect(searchBar, SIGNAL(findNext()), this, SLOT(searchBarFindNextInTextBrowser()));
  connect(searchBar, SIGNAL(findPrevious()), this, SLOT(searchBarFindPreviousInTextBrowser()));
  gridLayoutX->addWidget(searchBar, 1, 0, 1, 1);

  text->show();
  ui->twProperties->setCurrentIndex(tindex);
  text->setFocus();
}
コード例 #17
0
void toAWR::execute(void)
{
	try {
		//QString sql=Statement->text();
		//toQList params=toParamGet::getParam(this,sql);
		//Result->query(sql,params);
		//Result->query(sql,toQList());

		QVariant vdbid = dbid->itemData(dbid->currentIndex());
		QString dbids( vdbid.toStringList().at(0) );
		QString insts( vdbid.toStringList().at(1) );

		QVariant vf = fsnap->itemData(fsnap->currentIndex());
		QVariant vt = tsnap->itemData(tsnap->currentIndex());
		QString fsnaps( vf.toStringList().at(2) );
		QString tsnaps( vt.toStringList().at(2) );
//		toQList params;
//		params.push_back(fsnaps);
//		params.push_back(tsnaps);
		TLOG(0,toDecorator,__HERE__)
				<< "Dbid:" << dbids.toAscii().constData() << ' '
				<< "Inst:" << insts.toAscii().constData() << ' '
				<< "fsnap:" << fsnaps.toAscii().constData() << ' '
				<< "tsnap:" << tsnaps.toAscii().constData() << std::endl;

		try {
			toQuery checkSnaps(connection(), SQLCheckSnaps, dbids, insts, fsnaps, tsnaps);

			toQuery report(connection(),
					"select NVL(output,' ') \n"
					//"from table(dbms_workload_repository.awr_report_text( \n"
					"from table(dbms_workload_repository.awr_report_html( \n"
					"               :dbid<char[40],in>, \n"
					"               :inst<char[40],in>, \n"
					"               :f<char[40],in>,    \n"
					"               :t<char[40],in>, 0))",
					dbids, insts, fsnaps, tsnaps);

			QString reports;
			while (!report.eof())
			{
				QString line = report.readValue();
				reports += line;
				reports += '\n';
			}
			std::cerr << reports.toAscii().constData() << std::endl;

			QWidget *box = new QWidget(Tabs);
			QVBoxLayout *vbox = new QVBoxLayout;
			vbox->setSpacing(0);
			vbox->setContentsMargins(0, 0, 0, 0);
			box->setLayout(vbox);

			vbox->addWidget(new QLabel(tr("AWR report"), box));
			QTextBrowser *tb = new QTextBrowser(box);
			tb->setFontFamily("monospace");
			tb->setReadOnly(true);
			tb->setText(reports);
			//tb->setFontFamily("Courier");

			vbox->addWidget(tb);
			Tabs->addTab(box, tr("AWR Report"));

		} catch (const toConnection::exception &t ) {
			TOMessageBox::information(this, t, t);
		}

	} TOCATCH
}