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> © 2007-2010 Yichi Zhang <[email protected]><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); }
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); }
void MainWindow::initHistory(int snapType) { QString title = dockCtrlNames[snapType]; QDockWidget *dockWidget = new QDockWidget(this); dockWidget->setObjectName("dockWidget_" + title); dockWidget->setFeatures(QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetMovable|QDockWidget::NoDockWidgetFeatures); QWidget *dockWidgetContents = new QWidget(dockWidget); dockWidgetContents->setObjectName("dockWidgetContents_" + title); QGridLayout *gridLayout = new QGridLayout(dockWidgetContents); gridLayout->setObjectName("gridLayout_" + title); gridLayout->setContentsMargins(0, 0, 0, 0); QTextBrowser * tb; if (snapType == DOCK_HISTORY) { tb = tbHistory = new QTextBrowser(dockWidgetContents); tbHistory->setOpenExternalLinks(true); } else if (snapType == DOCK_MAMEINFO) tb = tbMameinfo = new QTextBrowser(dockWidgetContents); else if (snapType == DOCK_DRIVERINFO) tb = tbDriverinfo = new QTextBrowser(dockWidgetContents); else if (snapType == DOCK_STORY) tb = tbStory = new QTextBrowser(dockWidgetContents); else tb = tbCommand = new QTextBrowser(dockWidgetContents); tb->setObjectName("textBrowser_" + title); tb->setFrameShape(QFrame::NoFrame); gridLayout->addWidget(tb); dockWidget->setWidget(dockWidgetContents); dockWidget->setWindowTitle(tr(qPrintable(title))); addDockWidget(static_cast<Qt::DockWidgetArea>(Qt::RightDockWidgetArea), dockWidget); // create tabbed history widgets if (dwHistory) tabifyDockWidget(dwHistory, dockWidget); else dwHistory = dockWidget; menuDocuments->addAction(dockWidget->toggleViewAction()); dockCtrls[snapType] = dockWidget; }
/* * This is the TextBrowser News tab, which shows the latest news from Distro news feed */ void MainWindow::initTabNews() { QString aux(StrConstants::getTabNewsName()); QWidget *tabNews = new QWidget(); QGridLayout *gridLayoutX = new QGridLayout(tabNews); gridLayoutX->setSpacing(0); gridLayoutX->setMargin(0); QTextBrowser *text = new QTextBrowser(tabNews); text->setObjectName("textBrowser"); text->setReadOnly(true); text->setFrameShape(QFrame::NoFrame); text->setFrameShadow(QFrame::Plain); text->setOpenExternalLinks(true); gridLayoutX->addWidget(text, 0, 0, 1, 1); text->show(); #if QT_VERSION > 0x050000 int tindex = ui->twProperties->insertTab(ctn_TABINDEX_NEWS, tabNews, QApplication::translate ( "MainWindow", aux.toUtf8(), 0/*, QApplication::UnicodeUTF8*/ ) ); ui->twProperties->setTabText(ui->twProperties->indexOf(tabNews), QApplication::translate( "MainWindow", aux.toUtf8(), 0/*, QApplication::UnicodeUTF8*/)); #else int tindex = ui->twProperties->insertTab(ctn_TABINDEX_NEWS, tabNews, QApplication::translate ( "MainWindow", aux.toUtf8(), 0, QApplication::UnicodeUTF8 ) ); ui->twProperties->setTabText(ui->twProperties->indexOf(tabNews), QApplication::translate( "MainWindow", aux.toUtf8(), 0, QApplication::UnicodeUTF8)); #endif 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); connect(text, SIGNAL(sourceChanged(QUrl)), this, SLOT(onTabNewsSourceChanged(QUrl))); text->show(); ui->twProperties->setCurrentIndex(tindex); text->setFocus(); }
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); }
void SecurityInfo::init() { QTextBrowser *infoDisplay = new QTextBrowser(); infoDisplay->setFrameShape( QFrame::NoFrame ); QVBoxLayout *vb = new QVBoxLayout( this ); vb->setSpacing( 0 ); vb->setMargin( 0 ); vb->addWidget( infoDisplay ); QDesktopWidget *desktop = QApplication::desktop(); double imageScale = ((double)desktop->availableGeometry(desktop->screenNumber(this)).width())/290.0; if (imageScale > 1.0) imageScale = 1.0; int imageSize = (int)(60 * imageScale); // Add logo, TODO update with SXE logo, or lids logo QString infoString = "<p><img width=\"%1\" height=\"%2\"src=\":image/qpe-logo\"></p>"; infoString = infoString.arg( imageSize ); infoString = infoString.arg( imageSize ); // Add SXE info infoString += "<p><center>" + tr("Safe Execution Environment:") + " " + "</p></center>"; #ifndef QT_NO_SXE infoString += "<p><center><b>" + tr("Enabled") + "</b></center></p>"; #else infoString += "<p><center><font color=\"#ff0000\"><b>" + tr("Disabled") + "</b></font></center></p>"; #endif //QT_NO_SXE // Add LIDS info bool lidsEnabled = QFile::exists("/proc/sys/lids/locks"); infoString += "<p><center>" + tr("Kernel LIDS support:") + " " + "</p></center>"; if (lidsEnabled) infoString += "<p><center><b>" + tr("Available") + "</b></center></p>"; else infoString += "<p><center><font color=\"#ff0000\"><b>" + tr("Unavailable") + "</b></font></center></p>"; if (lidsEnabled) { QProcess lidsconf; lidsconf.start("lidsconf -L"); if (lidsconf.waitForFinished()) { QStringList output(QString(lidsconf.readAll()).split("\n")); if(!output.contains ("Killed")) { infoString += "<p><center>"; infoString += tr("Security Rules: %1").arg(output.count() - 5); infoString += "</center></p>"; } } } infoDisplay->setHtml( infoString ); }
/* * 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(); }