diff options
author | ramon <ramongomez@us.es> | 2017-05-11 11:07:07 +0000 |
---|---|---|
committer | ramon <ramongomez@us.es> | 2017-05-11 11:07:07 +0000 |
commit | dd5efc656beeecf9ec169bdc70d6fd6ffd63dff7 (patch) | |
tree | f4a29f09118ab29be5aa34b2af6719fa2d4ca416 /client/browser | |
parent | 7deab6eca49b52cf6a3b64a1b6fc31cdcc3f3869 (diff) |
#746: Velocidad de conexión por defecto configurable en variable {{{DEFAULTSPEED}}} del fichero {{{engine.cfg}}}.
git-svn-id: https://opengnsys.es/svn/branches/version1.1@5293 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'client/browser')
-rw-r--r-- | client/browser/src/mainwindow.cpp | 30 | ||||
-rw-r--r-- | client/browser/src/mainwindow.h | 3 |
2 files changed, 17 insertions, 16 deletions
diff --git a/client/browser/src/mainwindow.cpp b/client/browser/src/mainwindow.cpp index e8cdc78f..2143e435 100644 --- a/client/browser/src/mainwindow.cpp +++ b/client/browser/src/mainwindow.cpp @@ -90,7 +90,7 @@ MainWindow::MainWindow(QWidget *parent) // OpenGnsys logo (or alternate text) m_logo=new QLabel(); QPixmap logo; - if (logo.load("/opt/opengnsys/lib/pictures/oglogo.png")) + if(logo.load("/opt/opengnsys/lib/pictures/oglogo.png")) m_logo->setPixmap(logo); else m_logo->setText("OG"); @@ -101,8 +101,9 @@ MainWindow::MainWindow(QWidget *parent) QString speed=readSpeed(); m_speedInfo=new QLabel(speed); m_speedInfo->setAlignment(Qt::AlignCenter); - if (speed.compare("1000Mb/s")) - m_speedInfo->setStyleSheet("background-color: darkred; color: white; font-weight: bold;"); + if(m_env.contains("DEFAULTSPEED") && m_env["DEFAULTSPEED"]!="") + if(speed.compare(m_env["DEFAULTSPEED"])!=0) + m_speedInfo->setStyleSheet("background-color: darkred; color: white; font-weight: bold;"); // Clock m_clock=new DigitalClock(this); @@ -136,18 +137,19 @@ MainWindow::MainWindow(QWidget *parent) connect(button,SIGNAL(clicked()),this,SLOT(slotCreateTerminal())); connect(m_webBar,SIGNAL(returnPressed()),this,SLOT(slotWebBarReturnPressed())); + // Open the log file for append if(m_env.contains("OGLOGFILE") && m_env["OGLOGFILE"]!="") { - QFile* m_logfile=new QFile(m_env["OGLOGFILE"]); - if(!m_logfile->open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) - { - delete m_logfile; - print(tr(gettext("El fichero de log no ha podido ser abierto: "))+m_env["OGLOGFILE"]+"."); - } - else - { - m_logstream=new QTextStream(m_logfile); - } + QFile* m_logfile=new QFile(m_env["OGLOGFILE"]); + if(!m_logfile->open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) + { + delete m_logfile; + print(tr(gettext("El fichero de log no ha podido ser abierto: "))+m_env["OGLOGFILE"]+"."); + } + else + { + m_logstream=new QTextStream(m_logfile); + } } QStringList arguments=QCoreApplication::arguments(); @@ -469,7 +471,7 @@ QString MainWindow::readSpeed() { if(m_env.contains("OGLOGFILE")) { QString infoFile=m_env["OGLOGFILE"].replace(".log", ".info.html"); - QString command = "grep -hoe \"[0-9]*Mb/s\" "+infoFile+" 2>/dev/null"; + QString command="grep -hoe \"[0-9]*Mb/s\" "+infoFile+" 2>/dev/null"; QProcess process; process.start(command); process.waitForFinished(); diff --git a/client/browser/src/mainwindow.h b/client/browser/src/mainwindow.h index aa155644..e4e02fa3 100644 --- a/client/browser/src/mainwindow.h +++ b/client/browser/src/mainwindow.h @@ -3,8 +3,7 @@ #define COMMAND "command:" #define COMMAND_WITH_CONFIRMATION "commandwithconfirmation:" -#define ENVIRONMENT "OGLOGFILE,ogactiveadmin" -//#define ENVIRONMENT "OGIP,OGSERVER,OGLOG" +#define ENVIRONMENT "OGLOGFILE,ogactiveadmin,DEFAULTSPEED" #include <QWidget> #include <QProcess> |