first re-commit.
This commit is contained in:
82
swsetupcontrol.cpp
Normal file
82
swsetupcontrol.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
/***************************************************************************
|
||||
|
||||
source::worx raDIYo
|
||||
Copyright © 2020-2022 c.holzheuer
|
||||
chris@sourceworx.org
|
||||
|
||||
This program 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 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFileDialog>
|
||||
#include <QInputDialog>
|
||||
|
||||
#include <swsetupcontrol.h>
|
||||
#include <raDIYo.h>
|
||||
|
||||
|
||||
SWSetupControl::SWSetupControl( QWidget* parent, QSettings* settings )
|
||||
: SWBaseControl( parent, settings )
|
||||
{
|
||||
|
||||
Ui_SWSetup::setupUi( this );
|
||||
setHeaderText( "Setup" );
|
||||
|
||||
connect( _buttonSongs, SIGNAL( clicked() ), this, SLOT( onSongsClicked() ) );
|
||||
connect( _buttonSender, SIGNAL( clicked() ), this, SLOT( onSenderClicked() ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SWSetupControl::onShow()
|
||||
{
|
||||
QString dirName = settings().value( raDIYo::KeySongsPath ).toString();
|
||||
_labelSongs->setText( dirName );
|
||||
QString senderList = settings().value( raDIYo::KeySenderPath ).toString();
|
||||
_labelSender->setText( senderList );
|
||||
}
|
||||
|
||||
|
||||
void SWSetupControl::onSongsClicked()
|
||||
{
|
||||
|
||||
QString defName = _settings->value( raDIYo::KeySongsPath ).toString();
|
||||
QDir defDir( defName );
|
||||
if( !defDir.exists() )
|
||||
defName = QDir::homePath();
|
||||
|
||||
defName = QFileDialog::getExistingDirectory( this, tr("Songs Directory"),
|
||||
defName,
|
||||
QFileDialog::ShowDirsOnly
|
||||
| QFileDialog::DontResolveSymlinks );
|
||||
|
||||
if( defName.isEmpty() )
|
||||
return;
|
||||
|
||||
settings().setValue( raDIYo::KeySongsPath,defName );
|
||||
_labelSongs->setText( defName );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SWSetupControl::onSenderClicked()
|
||||
{
|
||||
|
||||
QString defName = QFileDialog::getOpenFileName(this, tr("Open Sender File"),
|
||||
QDir::homePath(),
|
||||
tr("List (*.csv)"));
|
||||
|
||||
if( defName.isEmpty() )
|
||||
return;
|
||||
|
||||
settings().setValue( raDIYo::KeySenderPath, defName );
|
||||
_labelSender->setText( defName );
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user