Commit 78f45dc8 authored by Bryant's avatar Bryant

Fixed line endings in MainWindow.cc

parent 5c33850d
......@@ -845,7 +845,7 @@ void MainWindow::showTool(bool show)
}*/
void MainWindow::addCentralWidget(QWidget* widget, const QString& title)
{
Q_UNUSED(title);
Q_UNUSED(title);
// Check if this widget already has been added
if (centerStack->indexOf(widget) == -1)
{
......@@ -1266,49 +1266,50 @@ void MainWindow::loadStyle(QGC_MAINWINDOW_STYLE style)
void MainWindow::selectStylesheet()
{
// Let user select style sheet
styleFileName = QFileDialog::getOpenFileName(this, tr("Specify stylesheet"), styleFileName, tr("CSS Stylesheet (*.css);;"));
QString newStyleFileName = QFileDialog::getOpenFileName(this, tr("Specify stylesheet"), styleFileName, tr("CSS Stylesheet (*.css);;"));
if (!styleFileName.endsWith(".css"))
// Load the new style sheet if a valid one was selected.
if (!newStyleFileName.isNull())
{
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Information);
msgBox.setText(tr("QGroundControl did lot load a new style"));
msgBox.setInformativeText(tr("No suitable .css file selected. Please select a valid .css file."));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.exec();
return;
QFile styleSheet(newStyleFileName);
if (styleSheet.exists())
{
styleFileName = newStyleFileName;
reloadStylesheet();
}
}
// Load style sheet
reloadStylesheet();
}
void MainWindow::reloadStylesheet()
{
// Load style sheet
QFile* styleSheet = new QFile(styleFileName);
if (!styleSheet->exists())
QFile styleSheet(styleFileName);
// Default to the indoor stylesheet if an invalid stylesheet was chosen.
if (!styleSheet.exists())
{
styleSheet = new QFile(":files/styles/style-indoor.css");
styleSheet.setFileName(":files/styles/style-indoor.css");
}
if (styleSheet->open(QIODevice::ReadOnly | QIODevice::Text))
// Load the new stylesheet.
// We also replace an 'ICONDIR' token here with the proper application path.
if (styleSheet.open(QIODevice::ReadOnly | QIODevice::Text))
{
QString style = QString(styleSheet->readAll());
QString style = QString(styleSheet.readAll());
style.replace("ICONDIR", QCoreApplication::applicationDirPath()+ "files/styles/");
qApp->setStyleSheet(style);
}
// Otherwise alert the user to the failure.
else
{
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Information);
msgBox.setText(tr("QGroundControl did lot load a new style"));
msgBox.setText(tr("QGroundControl did not load a new style"));
msgBox.setInformativeText(tr("Stylesheet file %1 was not readable").arg(styleFileName));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.exec();
}
delete styleSheet;
}
/**
......@@ -1611,7 +1612,7 @@ void MainWindow::addLink(LinkInterface *link)
void MainWindow::setActiveUAS(UASInterface* uas)
{
Q_UNUSED(uas);
Q_UNUSED(uas);
// Enable and rename menu
// ui.menuUnmanned_System->setTitle(uas->getUASName());
// if (!ui.menuUnmanned_System->isEnabled()) ui.menuUnmanned_System->setEnabled(true);
......@@ -1872,7 +1873,7 @@ void MainWindow::UASCreated(UASInterface* uas)
void MainWindow::UASDeleted(UASInterface* uas)
{
Q_UNUSED(uas);
Q_UNUSED(uas);
if (UASManager::instance()->getUASList().count() == 0)
{
// Last system deleted
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment