Commit 5781da82 authored by Sanchit Samuel's avatar Sanchit Samuel

* Added a new ClickableLabel class * Implimented in kernel installer

parent 5630b3c5
......@@ -11,3 +11,5 @@ build-manjaro-settings-manager-Qt4_Desktop-Debug
pkg
*.pkg.tar.xz
CMakeLists.txt.user
.vscode/*
.kdev4/*
[Project]
CreatedFrom=CMakeLists.txt
Manager=KDevCMakeManager
Name=manjaro-settings-manager
......@@ -18,6 +18,7 @@
*/
#include "ActionDialog.h"
#include "ClickableLabel.h"
#include <KAuth/KAuthExecuteJob>
......@@ -32,7 +33,10 @@ ActionDialog::ActionDialog( QWidget* parent ) :
{
QVBoxLayout* vBoxLayout = new QVBoxLayout();
this->setLayout( vBoxLayout );
this->resize( 600,400 );
x = 400;
y = 100;
this->resize( x, y );
m_messageLabel = new QLabel();
vBoxLayout->addWidget( m_messageLabel );
......@@ -45,6 +49,15 @@ ActionDialog::ActionDialog( QWidget* parent ) :
m_terminal = new QTextEdit();
vBoxLayout->addWidget( m_terminal );
m_terminal->setReadOnly( true );
m_terminal->hide();
m_detailOn = false;
m_showDetails = new ClickableLabel();
vBoxLayout->addWidget( m_showDetails );
m_showDetails->setText( tr( "Show Details" ));
ClickableLabel::connect( m_showDetails, &ClickableLabel::clicked,
this, &ActionDialog::showDetails );
m_buttonBox = new QDialogButtonBox();
vBoxLayout->addWidget( m_buttonBox );
......@@ -57,6 +70,29 @@ ActionDialog::ActionDialog( QWidget* parent ) :
this, &ActionDialog::reject );
}
void
ActionDialog::writeToTerminal( const QString& information )
{
m_terminal->append(information);
}
void
ActionDialog::showDetails()
{
if (m_detailOn)
{
m_detailOn = false;
m_terminal -> hide();
m_showDetails->setText( tr( "Show Details" ));
this->resize( x, y );
}
else
{
m_detailOn = true;
m_terminal -> show();
m_showDetails->setText( tr( "Hide Details" ));
}
}
void
ActionDialog::startJob()
......
......@@ -20,6 +20,8 @@
#ifndef ACTIONDIALOG_H
#define ACTIONDIALOG_H
#include "ClickableLabel.h"
#include <KAuth/KAuthAction>
#include <QtWidgets/QDialog>
......@@ -45,12 +47,16 @@ public:
bool isJobSuccesful() const;
void showDetails();
void writeToTerminal(const QString& infomation);
private:
void startJob();
QTextEdit* m_terminal;
QLabel* m_messageLabel;
QLabel* m_informationLabel;
ClickableLabel* m_showDetails;
QDialogButtonBox* m_buttonBox;
KAuth::Action m_installAction;
......@@ -59,6 +65,10 @@ private:
bool m_jobSuccesful;
QString m_lastMessage;
bool m_detailOn;
int x, y;
};
#endif // ACTIONDIALOG_H
......@@ -21,6 +21,7 @@ set(LIBMSM_SRCS
${LIBMSM_GLOB}
${KDSINGLEAPPLICATIONGUARD}
ActionDialog.cpp
ClickableLabel.cpp
Kernel.cpp
KernelModel.cpp
LanguageCommon.cpp
......
/*
* This file is part of Manjaro Settings Manager.
*
* Sanchit Samuel <sanchit.samuel@live.com>
*
* Manjaro Settings Manager 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.
*
* Manjaro Settings Manager 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 Manjaro Settings Manager. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ClickableLabel.h"
#include <QDebug>
ClickableLabel::ClickableLabel(const QString& text, QWidget* parent)
: QLabel(parent)
{
setText(text);
setStyleSheet( "QLabel {color : blue;}" );
QFont f = font();
f.setUnderline(true);
setFont(f);
}
ClickableLabel::~ClickableLabel()
{
}
void ClickableLabel::mousePressEvent(QMouseEvent* event)
{
emit clicked();
}
/*
* This file is part of Manjaro Settings Manager.
*
* Sanchit Samuel <sanchit.samuel@live.com>
*
* Manjaro Settings Manager 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.
*
* Manjaro Settings Manager 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 Manjaro Settings Manager. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CLICKABLELABEL_H
#define CLICKABLELABEL_H
#include <QtWidgets/QDialog>
#include <QtWidgets/QLabel>
class ClickableLabel : public QLabel
{
Q_OBJECT
public:
explicit ClickableLabel( const QString& text="", QWidget* parent=0 );
~ClickableLabel();
signals:
void clicked();
protected:
void mousePressEvent(QMouseEvent* event);
};
#endif // CLICKABLELABEL_H
......@@ -75,8 +75,9 @@ KernelCommon::installKernel( const QModelIndex& index )
packageList << kernel << modules;
QString title = QString( tr( "Install Linux %1" ) ).arg( version );
QString message = QString( tr( "The following packages will be installed:" ) );
QString information = QString();
QString message = QString( tr( "New Kernel package(s) is/are ready to install. \nWould you like to continue?" ) );
QString information = QString( tr( "The following packages will be installed:\n" ) );
foreach ( const QString p, packageList )
{
information.append( p );
......@@ -96,7 +97,7 @@ KernelCommon::installKernel( const QModelIndex& index )
actionDialog.setInstallAction( installAction );
actionDialog.setWindowTitle( title );
actionDialog.setMessage( message );
actionDialog.setInformation( information );
actionDialog.writeToTerminal( information );
actionDialog.exec();
}
......
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