本文整理汇总了C++中QTextBrowser::setHtml方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextBrowser::setHtml方法的具体用法?C++ QTextBrowser::setHtml怎么用?C++ QTextBrowser::setHtml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextBrowser
的用法示例。
在下文中一共展示了QTextBrowser::setHtml方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onTabNewsSourceChanged
/*
* This SLOT is called every time the user clicks a url inside newsTab textBrowser
*/
void MainWindow::onTabNewsSourceChanged(QUrl newSource)
{
if(newSource.isRelative())
{
//If the user clicked a relative and impossible to display link...
QTextBrowser *text = ui->twProperties->widget(ctn_TABINDEX_NEWS)->findChild<QTextBrowser*>("textBrowser");
if (text)
{
disconnect(text, SIGNAL(sourceChanged(QUrl)), this, SLOT(onTabNewsSourceChanged(QUrl)));
text->setHtml(utils::parseDistroNews());
connect(text, SIGNAL(sourceChanged(QUrl)), this, SLOT(onTabNewsSourceChanged(QUrl)));
}
}
}
示例2: fileHashingFinished
void ChatWidget::fileHashingFinished(QList<HashedFile> hashedFiles)
{
std::cerr << "ChatWidget::fileHashingFinished() started." << std::endl;
QString message;
QList<HashedFile>::iterator it;
for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) {
HashedFile& hashedFile = *it;
QString ext = QFileInfo(hashedFile.filename).suffix();
RetroShareLink link;
if(mDefaultExtraFileFlags & RS_FILE_REQ_ANONYMOUS_ROUTING)
link.createFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash));
else
link.createExtraFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash),QString::fromStdString(rsPeers->getOwnId()));
if (hashedFile.flag & HashedFile::Picture) {
message += QString("<img src=\"file:///%1\" width=\"100\" height=\"100\">").arg(hashedFile.filepath);
message+="<br>";
} else {
QString image = FilesDefs::getImageFromFilename(hashedFile.filename, false);
if (!image.isEmpty()) {
message += QString("<img src=\"%1\">").arg(image);
}
}
message += link.toHtmlSize();
if (it != hashedFiles.end()) {
message += "<BR>";
}
}
#ifdef CHAT_DEBUG
std::cerr << "ChatWidget::fileHashingFinished message : " << message.toStdString() << std::endl;
#endif
/* convert to real html document */
QTextBrowser textBrowser;
textBrowser.setHtml(message);
std::wstring msg = textBrowser.toHtml().toStdWString();
if (rsMsgs->sendPrivateChat(peerId, msg)) {
QDateTime currentTime = QDateTime::currentDateTime();
addChatMsg(false, name, currentTime, currentTime, QString::fromStdWString(msg), TYPE_NORMAL);
}
}
示例3: QVLCFrame
HelpDialog::HelpDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
{
setWindowTitle( qtr( "Help" ) );
setMinimumSize( 350, 300 );
QGridLayout *layout = new QGridLayout( this );
QTextBrowser *helpBrowser = new QTextBrowser( this );
helpBrowser->setOpenExternalLinks( true );
helpBrowser->setHtml( qtr(I_LONGHELP) );
QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
closeButton->setDefault( true );
layout->addWidget( helpBrowser, 0, 0, 1, 0 );
layout->addWidget( closeButton, 1, 3 );
BUTTONACT( closeButton, close() );
readSettings( "Help", QSize( 500, 450 ) );
}
示例4: setupUi
void SupportWidget::setupUi()
{
QVBoxLayout * vb = new QVBoxLayout;
setLayout(vb);
QTextBrowser * lblContact = new QTextBrowser(this);
lblContact->setOpenExternalLinks(true);
QString supText = "<h3>We love to hear from the people who use our software.</h3>"
"<font color=orange>Contact us</font>"
"<p>"
"Technical support is available by e-mail addressed to our support department at <a href=\"mailto:[email protected]\" target=_blank>[email protected]</a>. "
"Please feel free to email us, normally we will reply to you within one business day."
"<p>Please specify in your message the following details:<ul>"
"<li> program version"
"<li> processor type"
"<li> operating system version"
"<li> amount of memory available"
"<li> active applications</ul>"
"<p><font color=orange>Registration key reclamation</font><p>"
"If you are a registered user of the program and for a certain reason you need to reclaim your registration key, please contact us at <a href=\"mailto:[email protected]\" target=_blank>[email protected]</a> subject <b>Registration key reclamation</b>,"
" message with the following information:<ul>"
"<li> Your first and last names</li>"
"<li> The e-mail address the registration message was sent to</li>"
"<li> Program name</li>"
"<li> License type</li>"
"<li> Purchase date</li>"
"<li> Purchase method</li>"
"<li> Other purchase details</li></ul>"
"The new registration data will be sent to you within 24 hours."
"We will send you a registration key by e-mail free of charge. If you use an e-mail address different from the one specified during the registration, please specify all your registration information, including your previous e-mail address. We will send you a registration key after we have checked the registration information.";
lblContact->setHtml(supText);
vb->addWidget(lblContact);
QLabel * lblInfo = new QLabel(this);
lblInfo->setTextInteractionFlags(Qt::TextSelectableByMouse);
QDate dtRelease = QDate::fromString(RELEASE_DATE, "yyyy-MM-dd");
lblInfo->setText(QString("Holdem Folder (c) v. %1 by %2 All Right Reserved")
.arg(VERSION).arg(dtRelease.toString(Qt::SystemLocaleShortDate)));
lblInfo->setCursor(Qt::IBeamCursor);
vb->addWidget(lblInfo);
}
示例5: file
DialogAbout::DialogAbout(PageWelcome* parent)
: QDialog(parent) {
setWindowTitle(tr("About SimpleScreenRecorder"));
QString html_about;
{
QFile file(":/about.htm");
if(file.open(QIODevice::ReadOnly | QIODevice::Text))
html_about = file.readAll();
}
html_about.replace("%MOREINFO%", tr("For more information:"));
html_about.replace("%SOURCECODE%", tr("The source code of this program can be found at:"));
html_about.replace("%USES%", tr("This program uses:"));
html_about.replace("%USES_QT4%", tr("%1 for the graphical user interface").arg("<a href=\"https://qt-project.org/\">Qt 4</a>"));
html_about.replace("%USES_LIBAV_FFMPEG%", tr("%1 or %2 (depending on your distribution) for video/audio encoding").arg("<a href=\"http://libav.org/\">libav</a>").arg("<a href=\"http://ffmpeg.org/\">ffmpeg</a>"));
html_about.replace("%USES_ELFHACKS%", tr("%1 for hooking system functions for OpenGL recording").arg("<a href=\"https://github.com/nullkey/elfhacks\">elfhacks</a>"));
html_about.replace("%VERSION%", PACKAGE_VERSION);
html_about.replace("%VERSIONINFO%", GetVersionInfo().replace("\n", "<br>\n"));
QTextBrowser *textbrowser = new QTextBrowser(this);
textbrowser->setHtml(html_about);
textbrowser->setOpenExternalLinks(true);
textbrowser->setMinimumSize(700, 500);
QPushButton *pushbutton_close = new QPushButton("Close", this);
connect(pushbutton_close, SIGNAL(clicked()), this, SLOT(accept()));
QVBoxLayout *layout = new QVBoxLayout(this);
layout->addWidget(textbrowser);
{
QHBoxLayout *layout2 = new QHBoxLayout();
layout->addLayout(layout2);
layout2->addStretch();
layout2->addWidget(pushbutton_close);
layout2->addStretch();
}
}
示例6: on_actionHilfe_triggered
/*---------------------------------------------------------------------------
* Hilfe
*---------------------------------------------------------------------------*/
void MainWindow::on_actionHilfe_triggered()
{
if(!helpDialog)
{
// Hilfe laden
QString helpText;
QFile *f = new QFile(":/help/doc/hilfe.html");
if(f->open(QFile::ReadOnly))
{
QTextStream strm(f);
helpText = strm.readAll();
f->close();
delete f;
}
else
{
QMessageBox::warning( this,
tr("Hilfe"),
tr("Hilfe konnte nicht geladen werden!"));
delete f;
return;
}
// Hilfefenster erstellen
helpDialog = new QDialog( this, Qt::Dialog);
helpDialog->setWindowTitle(tr("DtaGui Hilfe"));
helpDialog->resize(800,600);
QTextBrowser *text = new QTextBrowser(this);
text->setHtml(helpText);
QVBoxLayout *layout = new QVBoxLayout();
layout->addWidget(text);
helpDialog->setLayout(layout);
}
// Hilfe anzeigen
helpDialog->show();
helpDialog->raise();
helpDialog->activateWindow();
}
示例7: QDialog
AboutDialog::AboutDialog(QWidget *parent)
: QDialog(parent)
{
setWindowTitle(tr("Bluecherry Client - About"));
setFixedSize(500, 400);
setModal(true);
QGridLayout *layout = new QGridLayout(this);
QLabel *logo = new QLabel;
logo->setPixmap(QPixmap(QLatin1String(":/images/logo.png"))
.scaled(130, 130, Qt::KeepAspectRatio, Qt::SmoothTransformation));
logo->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
layout->addWidget(logo, 0, 0);
QLabel *text = new QLabel;
text->setText(tr("Bluecherry DVR Client<br>Version %1").arg(QApplication::applicationVersion()));
text->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
QFont font = text->font();
font.setPixelSize(15);
text->setFont(font);
layout->addWidget(text, 0, 1);
layout->setColumnStretch(1, 1);
QTextBrowser *license = new QTextBrowser;
license->setHtml(getLicenseText());
license->setStyleSheet(QLatin1String("font-size: 12px"));
license->setReadOnly(true);
license->setOpenExternalLinks(true);
license->setTabChangesFocus(true);
layout->addWidget(license, 1, 0, 1, 2);
font = QFont();
font.setStyleHint(QFont::SansSerif);
font.setPixelSize(13);
license->setFont(font);
}
示例8: file
DialogAbout::DialogAbout(PageWelcome* parent)
: QDialog(parent) {
setWindowTitle("About SimpleScreenRecorder");
QString html_about;
{
QFile file(":/about.htm");
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
html_about = "Error: Can't load about dialog text.";
} else {
html_about = file.readAll();
}
}
html_about.replace("%VERSION%", SSR_VERSION);
html_about.replace("%VERSIONINFO%", GetVersionInfo().replace("\n", "<br>\n"));
QTextBrowser *textbrowser = new QTextBrowser(this);
textbrowser->setHtml(html_about);
textbrowser->setOpenExternalLinks(true);
textbrowser->setMinimumSize(700, 500);
QPushButton *pushbutton_close = new QPushButton("Close", this);
connect(pushbutton_close, SIGNAL(clicked()), this, SLOT(accept()));
QVBoxLayout *layout = new QVBoxLayout(this);
layout->addWidget(textbrowser);
{
QHBoxLayout *layout2 = new QHBoxLayout();
layout->addLayout(layout2);
layout2->addStretch();
layout2->addWidget(pushbutton_close);
layout2->addStretch();
}
}
示例9: QDialog
/** Geocache information dialog */
CacheInfoDialog::CacheInfoDialog(Cache * cache, QWidget * parent) :
QDialog(parent), cache_(cache) {
setWindowTitle(cache->name + " (" + cache->waypoint + ")");
// Grid layout as main layout
QGridLayout * mainLayout = new QGridLayout(this);
// cache name
mainLayout->addWidget(new QLabel("<big><b>" + cache->name + "</b></big>"), 0,
0, Qt::AlignLeft);
// cache icon
QLabel * pic = new QLabel;
pic->setPixmap(cacheIcon(cache));
mainLayout->addWidget(pic, 0, 1, Qt::AlignRight);
// tab pages
// setup description browser
QTextBrowser * descBrowser = new QTextBrowser();
descBrowser->setHtml(cache->desc);
descBrowser->setOpenExternalLinks(true);
// prepare tab widgets
QTabWidget * tab = new QTabWidget;
tab->addTab(new InfoTab(cache), "General");
tab->addTab(descBrowser, "Description");
mainLayout->addWidget(tab, 1, 0, 1, 2);
// button box
QDialogButtonBox * buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
mainLayout->addWidget(buttonBox, 2, 0, 1, 2, Qt::AlignRight);
setLayout(mainLayout);
}
示例10: showAboutDialog
void About::showAboutDialog()
{
m_dialog = new QDialog ( QApplication::focusWidget() );
m_dialog->setWindowTitle ( QObject::tr( "About..." ) );
QVBoxLayout * layout = new QVBoxLayout ( m_dialog );
QHBoxLayout * titleLayout = new QHBoxLayout ( );
QLabel * programName = new QLabel ( QString ( "<b>" ) + QObject::tr(ApplicationName) + QString ( " " ) +QString( ZMVIEWER_VERSION_STRING ) + QString ( "</b>" ), m_dialog );
titleLayout->addWidget ( programName );
QLabel * programIcon = new QLabel ( m_dialog );
programIcon->setPixmap ( qApp->windowIcon().pixmap ( 32,32 ) );
titleLayout->addWidget ( programIcon );
layout->addLayout ( titleLayout );
QTabWidget * tab = new QTabWidget ( m_dialog );
QLabel * label = new QLabel ( aboutText (), m_dialog );
tab->addTab ( label , QObject::tr( "About" ) );
QTextBrowser * authors = new QTextBrowser ( m_dialog );
authors->setHtml ( authorsText () );
authors->setReadOnly ( true );
authors->setOpenExternalLinks ( m_dialog );
tab->addTab ( authors , QObject::tr( "Authors and Thanks" ) );
layout->addWidget ( tab );
QPushButton * button = new QPushButton ( QObject::tr( "Ok" ) , m_dialog );
QHBoxLayout * buttonLayout = new QHBoxLayout ( );
buttonLayout->addItem ( new QSpacerItem ( 20,30, QSizePolicy::Expanding ) );
buttonLayout->addWidget ( button );
layout->addLayout ( buttonLayout );
QObject::connect ( button, SIGNAL ( clicked() ),m_dialog,SLOT ( accept() ) );
m_dialog->exec();
m_dialog->deleteLater();
}
示例11: QPushButton
HelpDialog::HelpDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
{
setWindowTitle( qtr( "Help" ) );
setWindowRole( "vlc-help" );
setMinimumSize( 350, 300 );
QVBoxLayout *layout = new QVBoxLayout( this );
QTextBrowser *helpBrowser = new QTextBrowser( this );
helpBrowser->setOpenExternalLinks( true );
helpBrowser->setHtml( qtr(I_LONGHELP) );
QDialogButtonBox *closeButtonBox = new QDialogButtonBox( this );
closeButtonBox->addButton(
new QPushButton( qtr("&Close") ), QDialogButtonBox::RejectRole );
closeButtonBox->setFocus();
layout->addWidget( helpBrowser );
layout->addWidget( closeButtonBox );
CONNECT( closeButtonBox, rejected(), this, close() );
restoreWidgetPosition( "Help", QSize( 500, 450 ) );
}
示例12: Dialog
AboutDialog::AboutDialog(const QString &lang, QWidget *parent) :
Dialog(parent, Qt::MSWindowsFixedSizeDialogHint)
{
setWindowTitle(tr("About"));
setWindowFlags (windowFlags() & ~Qt::WindowContextHelpButtonHint);
setObjectName("AboutDialog");
setMinimumWidth(480);
QTabWidget *tabWidget = new QTabWidget();
QyurSqlTreeView treeView;
QString revisionStr;
if (QString("%1").arg(VCS_REVISION) != "0") {
revisionStr = "<BR>" + tr("Revision") + " " + QString("%1").arg(VCS_REVISION);
}
QString appInfo =
"<html><style>a { color: blue; text-decoration: none; }</style><body>"
"<CENTER>"
"<IMG SRC=\":/images/images/logo.png\">"
"<BR><IMG SRC=\":/images/images/logo_text.png\">"
"<P>"
+ tr("Version") + " " + "<B>" + QString(STRPRODUCTVER) + "</B>" + QString(" (%1)").arg(STRDATE)
+ revisionStr
+ "</P>"
+ "<BR>"
+ tr("QuiteRSS is a open-source cross-platform RSS/Atom news reader")
+ "<P>" + tr("Includes:")
+ QString(" Qt-%1, SQLite-%2, QyurSqlTreeView-%3,").
arg(QT_VERSION_STR).arg(SQLITE_VERSION).
arg(treeView.metaObject()->classInfo(treeView.metaObject()->indexOfClassInfo("Version")).value())
+ "<BR>"
+ QString(" WebKit-%4, QupZilla-1.7.0").
arg(qWebKitVersion())
+ "</P>"
+ QString("<a href=\"%1\">%1</a>").arg("http://quiterss.org") +
"<P>Copyright © 2011-2015 QuiteRSS Team "
+ QString("<a href=\"%1\">E-mail</a>").arg("mailto:[email protected]") + "</P>"
"</CENTER></body></html>";
QLabel *infoLabel = new QLabel(appInfo);
infoLabel->setOpenExternalLinks(true);
infoLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
QHBoxLayout *mainLayout = new QHBoxLayout();
mainLayout->addWidget(infoLabel);
QWidget *mainWidget = new QWidget();
mainWidget->setLayout(mainLayout);
QTextEdit *authorsTextEdit = new QTextEdit(this);
authorsTextEdit->setReadOnly(true);
QFile file;
file.setFileName(":/file/AUTHORS");
file.open(QFile::ReadOnly);
authorsTextEdit->setText(QString::fromUtf8(file.readAll()));
file.close();
QHBoxLayout *authorsLayout = new QHBoxLayout();
authorsLayout->addWidget(authorsTextEdit);
QWidget *authorsWidget = new QWidget();
authorsWidget->setLayout(authorsLayout);
QTextBrowser *historyTextBrowser = new QTextBrowser();
historyTextBrowser->setOpenExternalLinks(true);
if (lang.contains("ru", Qt::CaseInsensitive))
file.setFileName(":/file/HISTORY_RU");
else
file.setFileName(":/file/HISTORY_EN");
file.open(QFile::ReadOnly);
historyTextBrowser->setHtml(QString::fromUtf8(file.readAll()));
file.close();
QHBoxLayout *historyLayout = new QHBoxLayout();
historyLayout->addWidget(historyTextBrowser);
QWidget *historyWidget = new QWidget();
historyWidget->setLayout(historyLayout);
QTextEdit *licenseTextEdit = new QTextEdit();
licenseTextEdit->setReadOnly(true);
file.setFileName(":/file/COPYING");
file.open(QFile::ReadOnly);
QString str = QString(QString::fromUtf8(file.readAll())).section("-----", 1, 1);
licenseTextEdit->setText(str);
file.close();
QHBoxLayout *licenseLayout = new QHBoxLayout();
licenseLayout->addWidget(licenseTextEdit);
QWidget *licenseWidget = new QWidget();
licenseWidget->setLayout(licenseLayout);
QString portable;
if (mainApp->isPortable()) {
if (!mainApp->isPortableAppsCom())
portable = "(Portable)";
else
portable = "(PortableApps)";
}
Settings settings;
QString information =
"<table border=\"0\"><tr>"
"<td>" + tr("Version") + " </td>"
//.........这里部分代码省略.........
示例13: CreateWidget
QWidget* ExtensionDialog::CreateWidget( extension_widget_t *p_widget )
{
QLabel *label = NULL;
QPushButton *button = NULL;
QTextBrowser *textArea = NULL;
QLineEdit *textInput = NULL;
QCheckBox *checkBox = NULL;
QComboBox *comboBox = NULL;
QListWidget *list = NULL;
SpinningIcon *spinIcon = NULL;
struct /*extension_widget_t::*/extension_widget_value_t *p_value = NULL; // sunqueen modify
assert( p_widget->p_sys_intf == NULL );
switch( p_widget->type )
{
case EXTENSION_WIDGET_LABEL:
label = new QLabel( qfu( p_widget->psz_text ), this );
p_widget->p_sys_intf = label;
label->setTextFormat( Qt::RichText );
label->setOpenExternalLinks( true );
return label;
case EXTENSION_WIDGET_BUTTON:
button = new QPushButton( qfu( p_widget->psz_text ), this );
clickMapper->setMapping( button, new WidgetMapper( p_widget ) );
CONNECT( button, clicked(), clickMapper, map() );
p_widget->p_sys_intf = button;
return button;
case EXTENSION_WIDGET_IMAGE:
label = new QLabel( this );
label->setPixmap( QPixmap( qfu( p_widget->psz_text ) ) );
if( p_widget->i_width > 0 )
label->setMaximumWidth( p_widget->i_width );
if( p_widget->i_height > 0 )
label->setMaximumHeight( p_widget->i_height );
label->setScaledContents( true );
p_widget->p_sys_intf = label;
return label;
case EXTENSION_WIDGET_HTML:
textArea = new QTextBrowser( this );
textArea->setOpenExternalLinks( true );
textArea->setHtml( qfu( p_widget->psz_text ) );
p_widget->p_sys_intf = textArea;
return textArea;
case EXTENSION_WIDGET_TEXT_FIELD:
textInput = new QLineEdit( this );
textInput->setText( qfu( p_widget->psz_text ) );
textInput->setReadOnly( false );
textInput->setEchoMode( QLineEdit::Normal );
inputMapper->setMapping( textInput, new WidgetMapper( p_widget ) );
/// @note: maybe it would be wiser to use textEdited here?
CONNECT( textInput, textChanged(const QString &),
inputMapper, map() );
p_widget->p_sys_intf = textInput;
return textInput;
case EXTENSION_WIDGET_PASSWORD:
textInput = new QLineEdit( this );
textInput->setText( qfu( p_widget->psz_text ) );
textInput->setReadOnly( false );
textInput->setEchoMode( QLineEdit::Password );
inputMapper->setMapping( textInput, new WidgetMapper( p_widget ) );
/// @note: maybe it would be wiser to use textEdited here?
CONNECT( textInput, textChanged(const QString &),
inputMapper, map() );
p_widget->p_sys_intf = textInput;
return textInput;
case EXTENSION_WIDGET_CHECK_BOX:
checkBox = new QCheckBox( this );
checkBox->setText( qfu( p_widget->psz_text ) );
checkBox->setChecked( p_widget->b_checked );
clickMapper->setMapping( checkBox, new WidgetMapper( p_widget ) );
CONNECT( checkBox, stateChanged( int ), clickMapper, map() );
p_widget->p_sys_intf = checkBox;
return checkBox;
case EXTENSION_WIDGET_DROPDOWN:
comboBox = new QComboBox( this );
comboBox->setEditable( false );
for( p_value = p_widget->p_values;
p_value != NULL;
p_value = p_value->p_next )
{
comboBox->addItem( qfu( p_value->psz_text ), p_value->i_id );
}
/* Set current item */
if( p_widget->psz_text )
{
int idx = comboBox->findText( qfu( p_widget->psz_text ) );
if( idx >= 0 )
comboBox->setCurrentIndex( idx );
}
selectMapper->setMapping( comboBox, new WidgetMapper( p_widget ) );
CONNECT( comboBox, currentIndexChanged( const QString& ),
selectMapper, map() );
//.........这里部分代码省略.........
示例14: strProduct
AboutDialog::AboutDialog(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);
QString strPath = QApplication::applicationDirPath();
QFileInfo fi(strPath);
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);
textCredits->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
QString strHtml;
QFile file(":/credits.html");
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream stream(&file);
strHtml = stream.readAll();
file.close();
}
//Utils::Misc::loadUnicodeTextFromFile(":/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(this);
layout->setContentsMargins(0, 10, 0, 10);
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"));
}
示例15: refreshDistroNews
/*
* This is the high level method that orquestrates the Distro RSS News printing in tabNews
*
* boolean parameter searchForLatestNews:
* controls whether this method tries to connect to the remote RSS News Feed (default is true)
* boolean parameter gotoNewsTab:
* controls whether this method must set the mainwindow focus to NewsTab (default is true)
*/
void MainWindow::refreshDistroNews(bool searchForLatestNews, bool gotoNewsTab)
{
qApp->processEvents();
if (searchForLatestNews)
{
LinuxDistro distro = UnixCommand::getLinuxDistro();
clearTabOutput();
if (distro == ectn_ARCHLINUX || distro == ectn_ARCHBANGLINUX)
{
writeToTabOutputExt("<b>" +
StrConstants::getSearchingForDistroNews().arg("Arch Linux") + "</b>");
}
else if (distro == ectn_CHAKRA)
{
writeToTabOutputExt("<b>" +
StrConstants::getSearchingForDistroNews().arg("Chakra") + "</b>");
}
else if (distro == ectn_MANJAROLINUX)
{
writeToTabOutputExt("<b>" +
StrConstants::getSearchingForDistroNews().arg("Manjaro Linux") + "</b>");
}
qApp->processEvents();
}
CPUIntensiveComputing *cic = new CPUIntensiveComputing;
QString distroRSSXML = retrieveDistroNews(searchForLatestNews);
delete cic;
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 (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 = 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);
}
clearTabOutput();
qApp->processEvents();
if (searchForLatestNews && gotoNewsTab)
{
_changeTabWidgetPropertiesIndex(ctn_TABINDEX_NEWS);
}
}