Ejemplo n.º 1
0
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
    }
static QImage getImage(QTextDocument *doc, const QTextImageFormat &format)
{
    QImage image;

    QString name = format.name();
    if (name.startsWith(QLatin1String(":/"))) // auto-detect resources
        name.prepend(QLatin1String("qrc"));
    QUrl url = QUrl::fromEncoded(name.toUtf8());
    const QVariant data = doc->resource(QTextDocument::ImageResource, url);
    if (data.type() == QVariant::Image) {
        image = qvariant_cast<QImage>(data);
    } else if (data.type() == QVariant::ByteArray) {
        image.loadFromData(data.toByteArray());
    }

    if (image.isNull()) {
        QString context;
#ifndef QT_NO_TEXTBROWSER
        QTextBrowser *browser = qobject_cast<QTextBrowser *>(doc->parent());
        if (browser)
            context = browser->source().toString();
#endif
        if (QTextImageHandler::externalLoader)
            image = QTextImageHandler::externalLoader(name, context);

        if (image.isNull()) { // try direct loading
            name = format.name(); // remove qrc:/ prefix again
            if (name.isEmpty() || !image.load(name))
                return QImage(QLatin1String(":/trolltech/styles/commonstyle/images/file-16.png"));
        }
        doc->addResource(QTextDocument::ImageResource, url, image);
    }

    return image;
}
Ejemplo n.º 3
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;
  }
Ejemplo n.º 4
0
QWidget* AboutBox::createContributorsPanel()
{
	QString html(tr(""
	"<h2>Contributors</h2>"
	"<p>"
	"The following people have given their time and talent to help support the GLE/QGLE effort (in alphabetical order)."
	"</p>"
	""
	"<ul>"
	"<li>A. S. Budden: programming (QGLE), packager for Arch Linux</li>"
	"<li>Andrey G. Grozin: packager for Gentoo Linux</li>"
	"<li>Axel Rohde: 3.3f-h versions (these were 32 bit DOS and OS/2 ports)</li>"
	"<li>Bryn Jeffries: programming (Linux)</li>"
	"<li>Chris Pugmire: original program creation and design</li>"
	"<li>Christoph Brendes: programming</li>"
	"<li>David Parfitt: documentation (GLE users guide)</li>"
	"<li>Edd Edmondson: packager for Mac OS/X"
	"<li>Jan Struyf: programming (and current 4.x series maintainer)</li>"
	"<li>Laurence Abbott: programming</li>"
	"<li>Michal Vyskocil: packager for openSUSE</li>"
	"<li>Stephen Blundell: documentation (GLE users guide)</li>"
	"<li>Steve Wilkinson: programming (user interface)</li>"
	"<li>Terje R&oslash;sten: packager for Fedora Core</li>"
	"<li>Vincent LaBella: resurrected 3.3h to GLE 4.0 C++ code base</li>"
	"<li>Zbigniew Kisiel: testing</li>"
	"</ul>"
	"<p>&nbsp;</p>"
	""));
	QTextBrowser* label = new QTextBrowser();
	label->setOpenLinks(false);
	label->setHtml(html);
	return label;
}
Ejemplo n.º 5
0
void ViewHelpMenu::showLicense()
{  
  QDialog b(this,Qt::Tool);
  b.setModal(true);
  QPixmap logo = ViewerIcon::getPixmap( "gnu.png");
  QLabel * llogo = new QLabel(&b);
  llogo->setGeometry(QRect(QPoint(0,0),logo.size()));
  llogo->setPixmap(logo);
  b.setMinimumSize(QSize(logo.width()*4,logo.height()));
  b.setWindowTitle("License");
  QTextBrowser * lictext = new QTextBrowser(&b);
  QFont f("Courrier", 8);
  lictext->setFont( f );
  lictext->setGeometry(QRect(logo.width(),0,logo.width()*3,logo.height()));
  // lictext->setHScrollBarMode(QScrollView::AlwaysOff);
  lictext->setLineWidth(0);
  /* QPalette pal = lictext->palette();
  QColorGroup c = pal.active();
  c.setColor(QColorGroup::Background,QColor(255,255,255));
  pal.setActive(c);
  lictext->setPalette(pal);*/
  QString copyright((TOOLS(getPlantGLDir())+"/share/plantgl/LICENSE").c_str());
  if(QFileInfo(copyright).exists() ) 
	  lictext->setSource(copyright);
  QSize s = qApp->desktop()->size();
  s = s - b.size();
  s /= 2;
  b.move(s.width(),s.height()); 
  b.exec();
}
Ejemplo n.º 6
0
QT_BEGIN_NAMESPACE

SearchWidget::SearchWidget(QHelpSearchEngine *engine, QWidget *parent)
    : QWidget(parent)
    , zoomCount(0)
    , searchEngine(engine)
{
    TRACE_OBJ
    QVBoxLayout *vLayout = new QVBoxLayout(this);

    resultWidget = searchEngine->resultWidget();
    QHelpSearchQueryWidget *queryWidget = searchEngine->queryWidget();

    vLayout->addWidget(queryWidget);
    vLayout->addWidget(resultWidget);

    setFocusProxy(queryWidget);

    connect(queryWidget, SIGNAL(search()), this, SLOT(search()));
    connect(resultWidget, SIGNAL(requestShowLink(QUrl)), this,
        SIGNAL(requestShowLink(QUrl)));

    connect(searchEngine, SIGNAL(searchingStarted()), this,
        SLOT(searchingStarted()));
    connect(searchEngine, SIGNAL(searchingFinished(int)), this,
        SLOT(searchingFinished(int)));

    QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>();
    if (browser) // Will be null if lib was configured not to use CLucene.
        browser->viewport()->installEventFilter(this);
}
Ejemplo n.º 7
0
AboutAppWnd::AboutAppWnd()
{
    QVBoxLayout* layout = new QVBoxLayout;
    layout->setSpacing(0);
    layout->setContentsMargins(0,0,0,0);

    QLabel *label = new QLabel(tr("About Google Translator"));

    QTextBrowser *text = new QTextBrowser(this);
    text->setHtml(
            "<a href=\"http://alexsnet.ru/opensource/translator/\">Google Translator</a> is a native GUI application for "
            "Google Translate Engine.<br />This application is free and open source.<br />"
            "Developers:<ul>"
            "<li>Alex Snet (<a href=\"http://alexsnet.ru\">WWW</a> | <a href=\"mailto:[email protected]\">Mail</a>)</li>"
            "</ul>"
    );
    text->setReadOnly(true);
    text->setOpenExternalLinks(true);

    QPushButton *okBtn = new QPushButton(tr("Ok"),this);
    connect( okBtn, SIGNAL(clicked()), this, SLOT(close()) );

    layout->addWidget( label );
    layout->addWidget( text );
    layout->addWidget( okBtn );
    this->setWindowTitle( tr("About Google Translator") );
    this->setLayout(layout);
}
Ejemplo n.º 8
0
void HelpSearchView::CreateQtPartControl(QWidget* parent)
{
  if (m_ResultWidget == nullptr)
  {
    m_Parent = parent;

    auto   vLayout = new QVBoxLayout(parent);

    // This will be lead to strange behavior when using multiple instances of this view
    // because the QHelpSearchResultWidget instance is shared. The new view will
    // reparent the widget.
    m_ResultWidget = m_SearchEngine->resultWidget();
    m_QueryWidget = new QHelpSearchQueryWidget();

    vLayout->addWidget(m_QueryWidget);
    vLayout->addWidget(m_ResultWidget);

    connect(m_QueryWidget, SIGNAL(search()), this, SLOT(search()));
    connect(m_ResultWidget, SIGNAL(requestShowLink(QUrl)), this,
            SLOT(requestShowLink(QUrl)));

    connect(m_SearchEngine, SIGNAL(searchingStarted()), this,
            SLOT(searchingStarted()));
    connect(m_SearchEngine, SIGNAL(searchingFinished(int)), this,
            SLOT(searchingFinished(int)));

    QTextBrowser* browser = m_ResultWidget->findChild<QTextBrowser*>();
    if (browser) // Will be null if QtHelp was configured not to use CLucene.
    {
      browser->viewport()->installEventFilter(this);
      browser->setContextMenuPolicy(Qt::CustomContextMenu);
      connect(browser, SIGNAL(customContextMenuRequested(QPoint)),
              this, SLOT(showContextMenu(QPoint)));
    }
  }
Ejemplo n.º 9
0
CWizAboutDialog::CWizAboutDialog(QWidget *parent)
    : QDialog(parent)
{
    QLabel* labelIcon = new QLabel(this);
    labelIcon->setPixmap(qApp->windowIcon().pixmap(QSize(58, 58)));

#if defined Q_OS_MAC
    QString strProduct("<span style=\"font-weight:bold;font-size:14px\">WizNote for Mac</span>");
#elif defined Q_OS_LINUX
    QString strProduct("<span style=\"font-weight:bold;font-size:14px\">WizNote for Linux</span>");
#else
    QString strProduct("<span style=\"font-weight:bold;font-size:14px\">WizNote for Windows</span>");
#endif

    QLabel* labelProduct = new QLabel(this);
    labelProduct->setText(strProduct);

    QFileInfo fi(::WizGetAppFileName());
    QDateTime t = fi.lastModified();
    QString strBuildNumber("(%1.%2.%3 %4:%5)");
    strBuildNumber = strBuildNumber.\
            arg(t.date().year()).\
            arg(t.date().month()).\
            arg(t.date().day()).\
            arg(t.time().hour()).\
            arg(t.time().minute());

    QString strInfo = QString(tr("<span style=\"font-size:11px\">Version %2 %3</span>")).arg(WIZ_CLIENT_VERSION, strBuildNumber);
    QLabel* labelBuild = new QLabel(this);
    labelBuild->setText(strInfo);

    QTextBrowser* textCredits = new QTextBrowser(this);
    textCredits->setOpenExternalLinks(true);

    QString strHtml;
    ::WizLoadUnicodeTextFromFile(":/credits.html", strHtml);
    textCredits->setHtml(strHtml);

    QLabel* labelCopyright = new QLabel(this);
    labelCopyright->setText(tr("<span style=\"font-size:10px\">Copy Right 2013 Wiz inc. All rights reserved</span>"));

    QVBoxLayout* layout = new QVBoxLayout();
    layout->setContentsMargins(0, 10, 0, 10);
    setLayout(layout);

    layout->addWidget(labelIcon);
    layout->addWidget(labelProduct);
    layout->addWidget(labelBuild);
    layout->addWidget(textCredits);
    layout->addWidget(labelCopyright);
    layout->setAlignment(labelIcon, Qt::AlignCenter);
    layout->setAlignment(labelProduct, Qt::AlignCenter);
    layout->setAlignment(labelBuild, Qt::AlignCenter);
    layout->setAlignment(textCredits, Qt::AlignCenter);
    layout->setAlignment(labelCopyright, Qt::AlignCenter);

    setWindowTitle(tr("About WizNote"));
    setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint);
    setFixedSize(sizeHint());
}
Ejemplo n.º 10
0
/*
 * At last we have to just show the retrivied news html
 */
void MainWindow::showDistroNews(QString distroRSSXML, bool searchForLatestNews)
{
  QString html;

  if (distroRSSXML.count() >= 200)
  {
    if (distroRSSXML.at(0)=='*')
    {
      /* If this is an updated RSS, we must warn the user!
       And if the main window is hidden... */
      if (isHidden())
      {
        show();
      }

      ui->twProperties->setTabText(ctn_TABINDEX_NEWS, "** " + StrConstants::getTabNewsName() + " **");
      if (m_gotoNewsTab)
      {
        ui->twProperties->setCurrentIndex(ctn_TABINDEX_NEWS);
      }
    }
    else
    {
      if(searchForLatestNews)
      {
        ui->twProperties->setTabText(ctn_TABINDEX_NEWS, StrConstants::getTabNewsName());
      }
    }

    //First, we have to parse the raw RSS XML...
    html = utils::parseDistroNews();
  }
  else
  {
    if(searchForLatestNews)
      ui->twProperties->setTabText(ctn_TABINDEX_NEWS, StrConstants::getTabNewsName());

    html = distroRSSXML;
  }

  //Now that we have the html table code, let's put it into TextBrowser's News tab
  QTextBrowser *text = ui->twProperties->widget(ctn_TABINDEX_NEWS)->findChild<QTextBrowser*>("textBrowser");
  if (text)
  {
    text->clear();
    text->setHtml(html);
  }

  if (m_gotoNewsTab)
  {
    clearTabOutput();
  }

  if (searchForLatestNews && m_gotoNewsTab)
  {
    changeTabWidgetPropertiesIndex(ctn_TABINDEX_NEWS);
  }

  ui->actionGetNews->setEnabled(true);
}
Ejemplo n.º 11
0
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);
}
Ejemplo n.º 12
0
int main(int argc, char ** argv) {
    using Q = QObject;
    QApplication app{argc, argv};
    QWidget ui;
    QVBoxLayout layout{&ui};
    QTextBrowser log;
    QProgressBar bar;
    QPushButton scan{"Scan localhost"};
    layout.addWidget(&log);
    layout.addWidget(&bar);
    layout.addWidget(&scan);
    bar.setRange(1, 65535);
    ui.show();

    Scanner scanner;
    Q::connect(&scan, &QPushButton::clicked, &scanner, [&]{
        scan.setEnabled(false);
        scanner.start();
    });
    Q::connect(&scanner, &Scanner::hasResult, &log, [&](int port, bool isOpen){
        bar.setValue(port);
        if (!isOpen) return;
        auto color = isOpen ? QStringLiteral("green") : QStringLiteral("red");
        auto state = isOpen ? QStringLiteral("open") : QStringLiteral("closed");
        log.append(QStringLiteral("<font color=\"%1\">Port %2 is %3.</font><br/>").
                   arg(color).arg(port).arg(state));
    });
    Q::connect(&scanner, &Scanner::done, &scan, [&]{
        bar.reset();
        scan.setEnabled(true);
    });
    return app.exec();
}
Ejemplo n.º 13
0
void FriendsDialog::fileHashingFinished(QList<HashedFile> hashedFiles)
{
    std::cerr << "FriendsDialog::fileHashingFinished() started." << std::endl;

    QString mesgString;

    QList<HashedFile>::iterator it;
    for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) {
        HashedFile& hashedFile = *it;
        RetroShareLink link;

        if (!link.createExtraFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash),QString::fromStdString(rsPeers->getOwnId())))
            continue;

        mesgString += link.toHtmlSize();
        if (it!= hashedFiles.end()) {
            mesgString += "<BR>";
        }
    }

#ifdef FRIENDS_DEBUG
    std::cerr << "FriendsDialog::fileHashingFinished mesgString : " << mesgString.toStdString() << std::endl;
#endif

    if (!mesgString.isEmpty()) {
        /* convert to real html document */
        QTextBrowser textBrowser;
        textBrowser.setHtml(mesgString);
        std::wstring msg = textBrowser.toHtml().toStdWString();

        rsMsgs->sendPublicChat(msg);
        setFont();
    }
}
Ejemplo n.º 14
0
void BatchJob::ShowLog()
{

    QDialog dlg(MIMainWindow::instance());
    dlg.setWindowTitle(logFile);
    dlg.setModal(true);
    dlg.setSizeGripEnabled(true);
    QVBoxLayout *mainLayout = new QVBoxLayout;
    dlg.setLayout(mainLayout);

    QTextBrowser *browse = new QTextBrowser(&dlg);
    mainLayout->addWidget(browse);

    QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Horizontal, &dlg);
    mainLayout->addWidget(bb);
    dlg.connect(bb, SIGNAL(accepted()), &dlg, SLOT(accept()));

    QFile logFileObj(logFile);
    if ( !logFileObj.open(QFile::ReadOnly | QFile::Text) )
    {
        browse->setPlainText(QObject::tr("ERROR: Log file %1 not found!")
                             .arg(logFile));
    }
    else
    {
        QTextStream logStream(&logFileObj);
        browse->setPlainText(logStream.readAll());
    }

    dlg.exec();
}
Ejemplo n.º 15
0
HelpDialog::HelpDialog( QWidget* parent)
    : QDialog( parent )
{
    QVBoxLayout* layout = new QVBoxLayout;
    setLayout( layout );

    QTextBrowser* webView = new QTextBrowser( this );
    layout->addWidget( webView );

    const QString text = tr(
        "<h3>Presentation</h3> \
        This application demonstrates some aspects of the KDAB updater component.<br/> \
        Initially you can add target items (<a href=#L4RAction>Line 4 Receiver</a> or <a href=#PSMAction>PSM</a> devices) that use some current firmware version, to the table. <br/> \
        You can see the current compatibility level and firmware version known to the application in the status bar. The source used for finding updates is available when clicking on the button <a href=#SourcesAction>Update Sources</a>.\
        <h3>Step 1: add some items</h3> \
        Add some items to the table, using the <a href=#L4RAction>Add Line 4 Receiver</a> or <a href=#PSMAction>Add PSM</a> button. \
        <h3>Step 2: update the firmware</h3> \
        Update the firmware information by clicking on the <a href=#UpdateAction>Update</a> button : a dialog appears that lets you download and install the version <b>1.1</b> for the package <b>Firmware</b>.<br/> \
        Once that is done, the status bar is updated with the new firmware version.<br/> \
        To update the devices in the table: <a href=#SelectAllAction>select them all</a> and click on the <a href=#UploadAction>Upload Firmwares</a> button. \
        <h3>Step 3: change the compatibility level</h3> \
        The current compatibility level is <b>1</b>. To change that, click on the <a href=#CompatUpdateAction>Update Compat</a> button : a dialog appears that lets you change to a new compat level <b>2</b>, if updates at that level are available.<br/>\
        Once it's done, the status bar is updated with the new compat level and you should see a new column in the table and the application's style changed.\
        <h3>Step 4: update the firmware (one more time)</h3> \
        Now that you changed the compatibility level, you can update the firmware one more time by clicking on the <a href=#UpdateAction>Update</a> button: a dialog appears that lets you install the version <b>2.0</b> for the package <b>Firmware</b><br/> \
        This update wasn't available the first time because it needs the compatibility level <b>2</b>." );

    webView->setHtml( text );
    connect( webView, SIGNAL(linkClicked(QUrl)),
             this, SLOT(clickLink(QUrl)) );

    setWindowTitle( tr("Help FirmwareDemoHttp") );
    resize( 480, 480 );
}
Ejemplo n.º 16
0
void SearchWidget::zoomIn()
{
    QTextBrowser* browser = qFindChild<QTextBrowser*>(resultWidget);
    if (browser && zoomCount != 10) {
        zoomCount++;
        browser->zoomIn();
    }
}
Ejemplo n.º 17
0
 OpenLinksFromFileSystem::OpenLinksFromFileSystem(QObject *parent) :
     QObject(parent)
 {
     QTextBrowser * TextBrowser = qobject_cast<QTextBrowser *>(parent);
     TextBrowser->setOpenExternalLinks(false);
     TextBrowser->setOpenLinks(false);
     connect(TextBrowser,SIGNAL(anchorClicked(QUrl)),this,SLOT(AnchorClicked(QUrl)));
 }
void MainWindowSampleTest::testNewGameButtonClick()
{
  MainWindowSample mainWindowSample(new Controller(new Model));
  QPushButton* newGameButton = mainWindowSample.getNewGameButton();
  QTextBrowser* textBrowser = mainWindowSample.getTextBrowser();
  QTest::mouseClick(newGameButton, Qt::LeftButton);
  QCOMPARE(textBrowser->toPlainText(), QString("New Game button clicked"));
}
Ejemplo n.º 19
0
void SearchWidget::zoomOut()
{
    QTextBrowser* browser = qFindChild<QTextBrowser*>(resultWidget);
    if (browser && zoomCount != -5) {
        zoomCount--;
        browser->zoomOut();
    }
}
Ejemplo n.º 20
0
// 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);
  }
}
Ejemplo n.º 21
0
void MainWindow::dmesgTab()
{
    QTextBrowser *browser = new QTextBrowser(this);
    int index = ui->tabWidget->addTab(browser, tr("dmesg log"));
    ui->tabWidget->setTabIcon(index, QIcon::fromTheme("text-x-script"));
    ui->tabWidget->setCurrentIndex(index);
    QByteArray data = pro.readAllStandardOutput();
    browser->append(data);
}
Ejemplo n.º 22
0
void EnterVacationDialog::createEvents()
{
    const EventList events = createEventList( m_ui->startDate->date(),
                                              m_ui->endDate->date().addDays( 1 ),
                                              m_ui->hoursSpinBox->value() * 60 + m_ui->minutesSpinBox->value(),
                                              m_selectedTaskId );

    QDialog confirmationDialog( this );
    QVBoxLayout* layout = new QVBoxLayout( &confirmationDialog );

    QLabel* label = new QLabel( tr( "The following vacation events will be created." ) );
    label->setWordWrap( true );
    layout->addWidget( label );
    QTextBrowser* textBrowser = new QTextBrowser;
    layout->addWidget( textBrowser );
    QDialogButtonBox* box = new QDialogButtonBox;
    box->setStandardButtons( QDialogButtonBox::Ok|QDialogButtonBox::Cancel );
    box->button(QDialogButtonBox::Ok)->setText(tr("Create"));
    connect( box, SIGNAL(accepted()), &confirmationDialog, SLOT(accept()) );
    connect( box, SIGNAL(rejected()), &confirmationDialog, SLOT(reject()) );
    layout->addWidget( box );


    const QString startDate = m_ui->startDate->date().toString( Qt::TextDate );
    const QString endDate = m_ui->endDate->date().toString( Qt::TextDate );
    const Task task = DATAMODEL->getTask( m_selectedTaskId );

    const QString htmlStartDate = toHtmlEscaped( startDate );
    const QString htmlEndDate = toHtmlEscaped( endDate );
    const QString htmlTaskName = toHtmlEscaped( task.name() );

    QString html = "<html><body>";
    html += QString::fromLatin1("<h1>%1</h1>").arg( tr("Vacation"));
    html += QString::fromLatin1("<h3>%1</h3>").arg( tr("From %1 to %2").arg( htmlStartDate, htmlEndDate ) );
    html += QString::fromLatin1("<h4>%1</h4>").arg( tr("Task used: %1").arg( htmlTaskName ) );
    html += "<p>";
    Q_FOREACH ( const Event& event, events ) {
        const QDate eventStart = event.startDateTime().date();
        const QDate eventEnd = event.endDateTime().date();
        Q_ASSERT( eventStart == eventEnd );
        Q_UNUSED( eventEnd ) //release mode
        const QString shortDate = eventStart.toString( Qt::DefaultLocaleShortDate );
        const QString duration = formatDuration( event.startDateTime(), event.endDateTime() );

        const QString htmlShortDate = toHtmlEscaped( shortDate );
        const QString htmlDuration = toHtmlEscaped( duration );

        html += QString::fromLatin1("%1").arg( tr( "%1: %3", "short date, duration" ).arg( htmlShortDate, htmlDuration ) );
        html += "</p><p>";
    }
    html += "</p>";
    html += "</body></html>";
    textBrowser->setHtml( html );
    confirmationDialog.resize( 400, 600 );
    if ( confirmationDialog.exec() == QDialog::Accepted )
        m_events = events;
}
Ejemplo n.º 23
0
void SearchWidget::zoomOut()
{
    TRACE_OBJ
    QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>();
    if (browser && zoomCount != -5) {
        zoomCount--;
        browser->zoomOut();
    }
}
Ejemplo n.º 24
0
void session::send_message()
{
    QLineEdit *temp = (QLineEdit *)_tabWidget->currentWidget()->layout()->itemAt(1)->widget();
    (*_chatVct)[_tabWidget->currentIndex()]->send_message(temp->displayText());
    QTextBrowser *tb = (QTextBrowser *)_tabWidget->currentWidget()->layout()->itemAt(0)->widget();
    tb->insertPlainText("\t\t\t\t\t");
    tb->insertPlainText(temp->displayText() + "\n");
    temp->clear();
}
Ejemplo n.º 25
0
void SearchWidget::zoomIn()
{
    TRACE_OBJ
    QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>();
    if (browser && zoomCount != 10) {
        zoomCount++;
        browser->zoomIn();
    }
}
Ejemplo n.º 26
0
void UIDesktopPanePrivate::prepareErrorPane()
{
    if (m_pErrBox)
        return;

    /* Create error pane: */
    m_pErrBox = new QWidget;

    /* Create main layout: */
    QVBoxLayout *pMainLayout = new QVBoxLayout(m_pErrBox);
#if   defined(VBOX_WS_MAC)
    pMainLayout->setContentsMargins(4, 5, 5, 5);
#elif defined(VBOX_WS_WIN)
    pMainLayout->setContentsMargins(3, 5, 5, 0);
#elif defined(VBOX_WS_X11)
    pMainLayout->setContentsMargins(0, 5, 5, 5);
#endif
    pMainLayout->setSpacing(10);

    /* Create error label: */
    m_pErrLabel = new QLabel(m_pErrBox);
    m_pErrLabel->setWordWrap(true);
    m_pErrLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    pMainLayout->addWidget(m_pErrLabel);

    /* Create error text-browser: */
    m_pErrText = new QTextBrowser(m_pErrBox);
    m_pErrText->setFocusPolicy(Qt::StrongFocus);
    m_pErrText->document()->setDefaultStyleSheet("a { text-decoration: none; }");
    pMainLayout->addWidget(m_pErrText);

    /* If refresh action was set: */
    if (m_pRefreshAction)
    {
        /* Create refresh button: */
        m_pRefreshButton = new QToolButton(m_pErrBox);
        m_pRefreshButton->setFocusPolicy(Qt::StrongFocus);

        /* Create refresh button layout: */
        QHBoxLayout *pButtonLayout = new QHBoxLayout;
        pMainLayout->addLayout(pButtonLayout);
        pButtonLayout->addStretch();
        pButtonLayout->addWidget(m_pRefreshButton);

        /* Connect refresh button: */
        connect(m_pRefreshButton, SIGNAL(clicked()), m_pRefreshAction, SIGNAL(triggered()));
    }

    pMainLayout->addStretch();

    /* Add into the stack: */
    addWidget(m_pErrBox);

    /* Retranslate finally: */
    retranslateUi();
}
Ejemplo n.º 27
0
void HelpWidget::setupUi()
{
   QVBoxLayout * vb = new QVBoxLayout;
   QTextBrowser * browser = new QTextBrowser(this);

   QString appExe = qApp->applicationDirPath();

   browser->setSource(QUrl("file:///" + appExe + "/tutorial/help/index.htm"));
   vb->addWidget(browser);
   setLayout(vb);
}
Ejemplo n.º 28
0
void MainWindow::createOutputTab(const QString &label, const QString &content)
{
  QTextBrowser *browser = new QTextBrowser(m_tabWidget);
  QFont f;
  f.setFamily("monospace");
  browser->setCurrentFont(f);

  m_tabWidget->addTab(browser, label);

  browser->setPlainText(content);
}
Ejemplo n.º 29
0
void SearchWidget::resetZoom()
{
    if (zoomCount == 0)
        return;

    QTextBrowser* browser = qFindChild<QTextBrowser*>(resultWidget);
    if (browser) {
        browser->zoomOut(zoomCount);
        zoomCount = 0;
    }
}
Ejemplo n.º 30
0
void SearchWidget::showEvent(QShowEvent *event)
{
    if (!event->spontaneous() && !searchEngine) {
        QVBoxLayout *vLayout = new QVBoxLayout(this);
        vLayout->setMargin(0);
        vLayout->setSpacing(0);

        searchEngine = new QHelpSearchEngine(&LocalHelpManager::helpEngine(), this);

        Utils::StyledBar *toolbar = new Utils::StyledBar(this);
        toolbar->setSingleRow(false);
        QHelpSearchQueryWidget *queryWidget = searchEngine->queryWidget();
        QLayout *tbLayout = new QVBoxLayout();
        tbLayout->setSpacing(6);
        tbLayout->setMargin(4);
        tbLayout->addWidget(queryWidget);
        toolbar->setLayout(tbLayout);

        Utils::StyledBar *toolbar2 = new Utils::StyledBar(this);
        toolbar2->setSingleRow(false);
        tbLayout = new QVBoxLayout();
        tbLayout->setSpacing(0);
        tbLayout->setMargin(0);
        tbLayout->addWidget(resultWidget = searchEngine->resultWidget());
        toolbar2->setLayout(tbLayout);

        vLayout->addWidget(toolbar);
        vLayout->addWidget(toolbar2);

        setFocusProxy(queryWidget);

        connect(queryWidget, SIGNAL(search()), this, SLOT(search()));
        connect(resultWidget, &QHelpSearchResultWidget::requestShowLink, this,
                [this](const QUrl &url) {
                    emit linkActivated(url, currentSearchTerms(), false/*newPage*/);
                });

        connect(searchEngine, SIGNAL(searchingStarted()), this,
            SLOT(searchingStarted()));
        connect(searchEngine, SIGNAL(searchingFinished(int)), this,
            SLOT(searchingFinished(int)));

        QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>();
        browser->viewport()->installEventFilter(this);

        connect(searchEngine, SIGNAL(indexingStarted()), this,
            SLOT(indexingStarted()));
        connect(searchEngine, SIGNAL(indexingFinished()), this,
            SLOT(indexingFinished()));

        QMetaObject::invokeMethod(&LocalHelpManager::helpEngine(), "setupFinished",
            Qt::QueuedConnection);
    }