1 #include "helpwindow.h"
2 #include "ui_helpwindow.h"
12 HelpWindow::HelpWindow(QWidget *parent) :
14 ui(new Ui::HelpWindow)
16 //this is a stacked window on Maemo 5
17 #if defined(Q_WS_MAEMO_5)
18 //setAttribute(Qt::WA_Maemo5StackedWindow);
24 //format color of help text according to system color scheme
26 QBrush brush = palette.windowText();
27 QColor color = brush.color();
28 ui->textBrowser->setStyleSheet( "QTextEdit {background: transparent; color: " + color.name() + ";}" );
32 HelpWindow::~HelpWindow()
39 * Assigns the help text to the QTextEdit
41 void HelpWindow::setHelpText()
43 //get the current locale name for lacalized help messages
44 QString locale = QLocale::system().name();
45 QStringList tmp = locale.split("_");
49 QFile help( ":/txt/help_" + locale );
52 if ( !help.exists() || !help.open( QIODevice::ReadOnly ) ) {
53 //try to open the file in english language instead
54 help.setFileName(":/txt/help_en");
55 if ( !help.exists() || !help.open( QIODevice::ReadOnly ) ) {
56 QMessageBox::critical(this, tr("QCPUFreq"), tr("Cannot open help file!"));
62 QTextStream in( &help );
67 } while ( !in.atEnd() );
69 ui->textBrowser->setText( txt );