Commit 1e008d8d authored by Ramon Buldó's avatar Ramon Buldó

mhwd: use QLabel with hyperlink instead of QPushButton

This way it respects the current theme
Hide disabled QLabel option
parent 272f5dc3
......@@ -51,8 +51,8 @@ void
MhwdCommon::load( Ui::PageMhwd* ui )
{
ui->treeWidget->clear();
ui->buttonInstallFree->setEnabled( false );
ui->buttonInstallNonFree->setEnabled( false );
ui->buttonInstallFree->hide();
ui->buttonInstallNonFree->hide();
// Create mhwd data object and fill it with hardware informations
mhwd::Data data;
mhwd::initData( &data );
......@@ -115,12 +115,12 @@ MhwdCommon::load( Ui::PageMhwd* ui )
if ( ( *conf_iter )->freedriver )
{
item->setCheckState( 1, Qt::Checked );
ui->buttonInstallFree->setEnabled( true );
ui->buttonInstallFree->show();
}
else
{
item->setCheckState( 1, Qt::Unchecked );
ui->buttonInstallNonFree->setEnabled( true );
ui->buttonInstallNonFree->show();
}
//Check if installed
......@@ -149,12 +149,12 @@ MhwdCommon::installConfiguration( QString configuration )
installAction.setHelperId( QLatin1String( "org.manjaro.msm.mhwd" ) );
installAction.setArguments( args );
installAction.setTimeout( std::numeric_limits<int>::max() );
ActionDialog actionDialog;
actionDialog.setInstallAction( installAction );
actionDialog.setWindowTitle( title );
actionDialog.setMessage( message );
actionDialog.writeToTerminal( QString( tr( "Waiting for user input..." )));
actionDialog.writeToTerminal( QString( tr( "Waiting for user input..." ) ) );
actionDialog.exec();
return actionDialog.isJobSuccesful();
}
......@@ -177,7 +177,7 @@ MhwdCommon::installFreeConfiguration( )
actionDialog.setInstallAction( installAction );
actionDialog.setWindowTitle( title );
actionDialog.setMessage( message );
actionDialog.writeToTerminal( QString( tr( "Waiting for user input..." )));
actionDialog.writeToTerminal( QString( tr( "Waiting for user input..." ) ) );
actionDialog.exec();
return actionDialog.isJobSuccesful();
}
......
......@@ -66,21 +66,19 @@ MhwdModule::MhwdModule( QWidget* parent, const QVariantList& args ) :
ui->installAction->setIcon( QIcon::fromTheme( "list-add", QIcon( ":/icons/add.png" ) ) );
ui->removeAction->setIcon( QIcon::fromTheme( "list-remove", QIcon( ":/icons/remove.png" ) ) );
ui->reinstallAction->setIcon( QIcon::fromTheme( "view-refresh", QIcon( ":/icons/restore.png" ) ) );
ui->buttonInstallFree->setStyleSheet("QPushButton {color: blue;}");
ui->buttonInstallNonFree->setStyleSheet("QPushButton {color: blue;}");
// Connect signals and slots
connect( ui->buttonInstallFree, &QPushButton::clicked,
[=] ( bool checked )
connect( ui->buttonInstallFree, &QLabel::linkActivated,
[=] ( const QString& link )
{
Q_UNUSED( checked )
Q_UNUSED( link )
MhwdCommon::installFreeConfiguration( );
load();
} );
connect( ui->buttonInstallNonFree, &QPushButton::clicked,
[=] ( bool checked )
connect( ui->buttonInstallNonFree, &QLabel::linkActivated,
[=] ( const QString& link )
{
Q_UNUSED( checked )
Q_UNUSED( link )
MhwdCommon::installNonFreeConfiguration( );
load();
} );
......
......@@ -43,17 +43,17 @@ MhwdPage::MhwdPage( QWidget* parent ) :
ui->reinstallAction->setIcon( QIcon::fromTheme( "view-refresh", QIcon( ":/icons/restore.png" ) ) );
// Connect signals and slots
connect( ui->buttonInstallFree, &QPushButton::clicked,
[=] ( bool checked )
connect( ui->buttonInstallFree, &QLabel::linkActivated,
[=] ( const QString& link )
{
Q_UNUSED( checked )
Q_UNUSED( link )
MhwdCommon::installFreeConfiguration();
load();
} );
connect( ui->buttonInstallNonFree, &QPushButton::clicked,
[=] ( bool checked )
connect( ui->buttonInstallNonFree, &QLabel::linkActivated,
[=] ( const QString& link )
{
Q_UNUSED( checked )
Q_UNUSED( link )
MhwdCommon::installNonFreeConfiguration();
load();
} );
......
......@@ -26,46 +26,25 @@
<property name="bottomMargin">
<number>11</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>You can also:</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0">
<property name="spacing">
<number>10</number>
</property>
<item alignment="Qt::AlignLeft">
<widget class="QPushButton" name="buttonInstallNonFree">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="font">
<font>
<underline>true</underline>
<kerning>true</kerning>
</font>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
<item>
<widget class="QLabel" name="buttonInstallFree">
<property name="text">
<string>&lt;a href=&quot;#&quot;&gt;Auto Install Open-Source Driver&lt;/a&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="buttonInstallNonFree">
<property name="text">
<string>Auto Install Proprietary Driver</string>
<string>&lt;a href=&quot;#&quot;&gt;Auto Install Proprietary Driver&lt;/a&gt;</string>
</property>
<property name="flat">
<bool>true</bool>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
</widget>
</item>
......@@ -85,45 +64,6 @@
</property>
</spacer>
</item>
<item alignment="Qt::AlignLeft">
<widget class="QPushButton" name="buttonInstallFree">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="font">
<font>
<underline>true</underline>
</font>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Auto Install Open-source Driver</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
......
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