Stubs for DebugWindow.

This commit is contained in:
Teo Mrnjavac 2015-03-04 19:35:10 +01:00
parent bc8793e66a
commit 00565d0f12
6 changed files with 152 additions and 2 deletions

View File

@ -23,6 +23,8 @@
#include "utils/CalamaresUtilsGui.h"
#include "utils/CalamaresStyle.h"
#include "utils/Logger.h"
#include "utils/DebugWindow.h"
#include "Settings.h"
#include "Branding.h"
#include <QApplication>
@ -33,6 +35,7 @@
CalamaresWindow::CalamaresWindow( QWidget* parent )
: QWidget( parent )
, m_debugWindow( nullptr )
{
// Hide close button
setWindowFlags( Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint );
@ -83,6 +86,37 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
ProgressTreeView* tv = new ProgressTreeView( sideBox );
sideLayout->addWidget( tv );
tv->setFocusPolicy( Qt::NoFocus );
if ( Calamares::Settings::instance()->debugMode() )
{
QPushButton* debugWindowBtn = new QPushButton( tr( "Show diagnostics" ) );
sideLayout->addWidget( debugWindowBtn );
debugWindowBtn->setFlat( true );
debugWindowBtn->setCheckable( true );
connect( debugWindowBtn, &QPushButton::clicked,
[ this, debugWindowBtn ]( bool checked )
{
if ( checked )
{
m_debugWindow = new Calamares::DebugWindow();
m_debugWindow->show();
connect( m_debugWindow, &Calamares::DebugWindow::closed,
[ this, debugWindowBtn ]
{
m_debugWindow->deleteLater();
debugWindowBtn->setChecked( false );
} );
}
else
{
if ( m_debugWindow )
{
m_debugWindow->deleteLater();
}
}
} );
}
CalamaresUtils::unmarginLayout( sideLayout );
CalamaresUtils::unmarginLayout( mainLayout );

View File

@ -1,6 +1,6 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,8 +19,14 @@
#ifndef CALAMARESWINDOW_H
#define CALAMARESWINDOW_H
#include <QPointer>
#include <QWidget>
namespace Calamares
{
class DebugWindow;
}
class CalamaresWindow : public QWidget
{
Q_OBJECT
@ -28,6 +34,8 @@ public:
CalamaresWindow( QWidget* parent = nullptr );
virtual ~CalamaresWindow() {}
private:
QPointer< Calamares::DebugWindow > m_debugWindow;
};
#endif //CALAMARESWINDOW_H

View File

@ -7,6 +7,7 @@ list( APPEND ${CALAMARESUI_LIBRARY_TARGET}_SOURCES
modulesystem/ViewModule.cpp
utils/CalamaresUtilsGui.cpp
utils/DebugWindow.cpp
utils/ImageRegistry.cpp
utils/YamlUtils.cpp
@ -24,7 +25,7 @@ list( APPEND ${CALAMARESUI_LIBRARY_TARGET}_SOURCES
)
list( APPEND ${CALAMARESUI_LIBRARY_TARGET}_UI
utils/DebugWindow.ui
)
if( WITH_PYTHON )

View File

@ -0,0 +1,41 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2015, Teo Mrnjavac <teo@kde.org>
*
* Calamares 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.
*
* Calamares 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.
*
* You should have received a copy of the GNU General Public License
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#include "DebugWindow.h"
#include "utils/Retranslator.h"
namespace Calamares {
DebugWindow::DebugWindow()
: QWidget( nullptr )
{
setupUi( this );
CALAMARES_RETRANSLATE( retranslateUi( this ); )
}
void
DebugWindow::closeEvent( QCloseEvent* e )
{
Q_UNUSED( e )
emit closed();
}
} // namespace Calamares

View File

@ -0,0 +1,45 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2015, Teo Mrnjavac <teo@kde.org>
*
* Calamares 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.
*
* Calamares 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.
*
* You should have received a copy of the GNU General Public License
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CALAMARES_DEBUGWINDOW_H
#define CALAMARES_DEBUGWINDOW_H
#include "ui_DebugWindow.h"
#include <QWidget>
namespace Calamares {
class DebugWindow : public QWidget, private Ui::DebugWindow
{
Q_OBJECT
public:
explicit DebugWindow();
signals:
void closed();
protected:
void closeEvent( QCloseEvent* e ) override;
};
} // namespace Calamares
#endif // CALAMARES_DEBUGWINDOW_H

View File

@ -0,0 +1,21 @@
<ui version="4.0">
<author/>
<comment/>
<exportmacro/>
<class>Calamares::DebugWindow</class>
<widget class="QWidget" name="Calamares::DebugWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
</widget>
<pixmapfunction/>
<connections/>
</ui>