source: src-qt4/pc-bugreport/toolbox.cpp @ 1620346

9.1-release9.2-releaseenter/10releng/10.0releng/10.0.1releng/10.0.2releng/10.0.3releng/10.1releng/10.1.1releng/10.1.2
Last change on this file since 1620346 was 1620346, checked in by Kris Moore <kris@…>, 2 years ago

Initial import of PC-BSD /current/ SVN repo

  • Property mode set to 100644
File size: 2.2 KB
Line 
1#include "toolbox.h"
2#include "ui_toolbox.h"
3#include "showinfodialog.h"
4
5#include <QFile>
6#include <QProcess>
7
8#define PREFIX "/usr/local/"
9static const QString KSANPSHOT_FILE(PREFIX"bin/ksnapshot");
10static const QString GNOME_PANEL_SCREENSHOT_FILE(PREFIX"bin/gnome-panel-screenshot");
11
12Toolbox::Toolbox(QWidget *parent) :
13    QWidget(parent),
14    ui(new Ui::Toolbox)
15{
16    ui->setupUi(this);
17
18        ui->LogsButton->addAction(ui->actionDiagnostic_report);
19        ui->LogsButton->addAction(ui->actionUname);
20        ui->LogsButton->addAction(ui->actionDmesg);
21        ui->LogsButton->addAction(ui->actionXorg_version);
22        ui->LogsButton->addAction(ui->actionXorg_log_file);
23
24        ui->HardwareButton->addAction(ui->actionPCIConf);
25
26        // Setup screenshot button. Check for present screenshot tools
27        ui->ScreenshotButton->setVisible(false);
28        if (QFile::exists(KSANPSHOT_FILE))
29        {
30                mScreenshotCommand= KSANPSHOT_FILE;
31                ui->ScreenshotButton->setVisible(true);
32        }
33        else if (QFile::exists(GNOME_PANEL_SCREENSHOT_FILE))
34        {
35                mScreenshotCommand= GNOME_PANEL_SCREENSHOT_FILE;
36                ui->ScreenshotButton->setVisible(true);
37        }
38}
39
40Toolbox::~Toolbox()
41{
42    delete ui;
43}
44
45void Toolbox::changeEvent(QEvent *e)
46{
47    QWidget::changeEvent(e);
48    switch (e->type()) {
49    case QEvent::LanguageChange:
50        ui->retranslateUi(this);
51        break;
52    default:
53        break;
54    }
55}
56
57void Toolbox::on_actionXorg_log_file_triggered()
58{
59        ShowInfoDialog* dlg = new ShowInfoDialog(this);
60        dlg->show(QString("/var/log/Xorg.0.log"));
61}
62
63void Toolbox::on_actionDmesg_triggered()
64{
65        ShowInfoDialog* dlg = new ShowInfoDialog(this);
66        dlg->show("dmesg", QStringList());
67}
68
69void Toolbox::on_actionDiagnostic_report_triggered()
70{
71
72}
73
74void Toolbox::on_actionPCIConf_triggered()
75{
76        ShowInfoDialog* dlg = new ShowInfoDialog(this);
77        dlg->show("pciconf", QStringList()<<"-l"<<"-v");
78}
79
80void Toolbox::on_ScreenshotButton_clicked()
81{
82        if (mScreenshotCommand.length())
83        {
84                QProcess proc;
85                proc.startDetached(mScreenshotCommand);
86        }
87}
88
89void Toolbox::on_actionXorg_version_triggered()
90{
91        ShowInfoDialog* dlg = new ShowInfoDialog(this);
92        dlg->show("Xorg", QStringList()<<"-version");
93}
94
95void Toolbox::on_actionUname_triggered()
96{
97        ShowInfoDialog* dlg = new ShowInfoDialog(this);
98        dlg->show("uname", QStringList()<<"-a");
99}
Note: See TracBrowser for help on using the repository browser.