Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLMC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
21
Issues
21
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VideoLAN
VLMC
Commits
e480a507
Commit
e480a507
authored
Jun 27, 2010
by
Hugo Beauzée-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Settings: Adding a path selection widget.
parent
02a0b81b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
137 additions
and
1 deletion
+137
-1
src/CMakeLists.txt
src/CMakeLists.txt
+2
-0
src/Gui/settings/PathWidget.cpp
src/Gui/settings/PathWidget.cpp
+72
-0
src/Gui/settings/PathWidget.h
src/Gui/settings/PathWidget.h
+53
-0
src/Gui/settings/PreferenceWidget.cpp
src/Gui/settings/PreferenceWidget.cpp
+3
-0
src/Settings/SettingValue.h
src/Settings/SettingValue.h
+2
-1
src/Settings/SettingsManager.h
src/Settings/SettingsManager.h
+5
-0
No files found.
src/CMakeLists.txt
View file @
e480a507
...
...
@@ -167,6 +167,7 @@ ELSE(NOT WITH_GUI)
Gui/settings/KeyboardShortcutInput.cpp
Gui/settings/LanguageWidget.cpp
Gui/settings/Panel.cpp
Gui/settings/PathWidget.cpp
Gui/settings/PreferenceWidget.cpp
Gui/settings/Settings.cpp
Gui/settings/StringWidget.cpp
...
...
@@ -221,6 +222,7 @@ ELSE(NOT WITH_GUI)
Gui/settings/IntWidget.h
Gui/settings/ISettingsCategoryWidget.h
Gui/settings/LanguageWidget.h
Gui/settings/PathWidget.h
Gui/settings/PreferenceWidget.h
Gui/settings/StringWidget.h
Gui/settings/Panel.h
...
...
src/Gui/settings/PathWidget.cpp
0 → 100644
View file @
e480a507
/*****************************************************************************
* StringWidget.h: Handle text settings.
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzée-Luyssen <hugo@vlmc.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.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "PathWidget.h"
#include "SettingValue.h"
#include <QFileDialog>
#include <QHBoxLayout>
#include <QLineEdit>
#include <QPushButton>
PathWidget
::
PathWidget
(
SettingValue
*
s
,
QWidget
*
parent
/*= NULL*/
)
:
m_setting
(
s
)
{
m_widget
=
new
QWidget
(
parent
);
QHBoxLayout
*
layout
=
new
QHBoxLayout
;
m_lineEdit
=
new
QLineEdit
(
m_widget
);
m_pushButton
=
new
QPushButton
(
m_widget
);
m_pushButton
->
setText
(
tr
(
"Select path"
)
);
layout
->
addWidget
(
m_lineEdit
);
layout
->
addWidget
(
m_pushButton
);
m_widget
->
setLayout
(
layout
);
connect
(
s
,
SIGNAL
(
changed
(
const
QVariant
&
)
),
this
,
SLOT
(
changed
(
const
QVariant
&
)
)
);
changed
(
s
->
get
()
);
connect
(
m_pushButton
,
SIGNAL
(
clicked
()
),
this
,
SLOT
(
selectPathButtonPressed
()
)
);
}
QWidget
*
PathWidget
::
widget
()
{
return
m_widget
;
}
void
PathWidget
::
save
()
{
m_setting
->
set
(
m_lineEdit
->
text
()
);
}
void
PathWidget
::
changed
(
const
QVariant
&
val
)
{
m_lineEdit
->
setText
(
val
.
toString
()
);
}
void
PathWidget
::
selectPathButtonPressed
()
{
QString
path
=
QFileDialog
::
getExistingDirectory
(
NULL
,
tr
(
"Select a path"
),
m_setting
->
get
().
toString
()
);
m_lineEdit
->
setText
(
path
);
}
src/Gui/settings/PathWidget.h
0 → 100644
View file @
e480a507
/*****************************************************************************
* PathWidget: Handle path settings.
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzée-Luyssen <hugo@vlmc.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.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef PATHWIDGET_H
#define PATHWIDGET_H
#include "ISettingsCategoryWidget.h"
#include <stddef.h>
class
SettingValue
;
class
QLineEdit
;
class
QPushButton
;
class
PathWidget
:
public
ISettingsCategoryWidget
{
Q_OBJECT
public:
PathWidget
(
SettingValue
*
s
,
QWidget
*
parent
=
NULL
);
QWidget
*
widget
();
void
save
();
private
slots
:
virtual
void
changed
(
const
QVariant
&
);
void
selectPathButtonPressed
();
private:
SettingValue
*
m_setting
;
QLineEdit
*
m_lineEdit
;
QPushButton
*
m_pushButton
;
QWidget
*
m_widget
;
};
#endif // PATHWIDGET_H
src/Gui/settings/PreferenceWidget.cpp
View file @
e480a507
...
...
@@ -31,6 +31,7 @@
#include "IntWidget.h"
#include "KeyboardShortcut.h"
#include "LanguageWidget.h"
#include "PathWidget.h"
#include "StringWidget.h"
#include <QFormLayout>
...
...
@@ -88,6 +89,8 @@ PreferenceWidget::widgetFactory( SettingValue *s )
return
new
DoubleWidget
(
s
,
this
);
case
SettingValue
::
Bool
:
return
new
BoolWidget
(
s
,
this
);
case
SettingValue
::
Path
:
return
new
PathWidget
(
s
,
this
);
default:
return
NULL
;
}
...
...
src/Settings/SettingValue.h
View file @
e480a507
...
...
@@ -44,7 +44,8 @@ class SettingValue : public QObject
String
,
Bool
,
Language
,
KeyboardShortcut
KeyboardShortcut
,
Path
,
};
enum
Flags
{
...
...
src/Settings/SettingsManager.h
View file @
e480a507
...
...
@@ -63,6 +63,9 @@ SettingsManager::getInstance()->createVar( type, key, defaultValue, name, \
VLMC_CREATE_PROJECT_VAR( SettingValue::Double, key, defaultValue, name, desc, SettingValue::Nothing )
#define VLMC_CREATE_PROJECT_BOOL( key, defaultValue, name, desc ) \
VLMC_CREATE_PROJECT_VAR( SettingValue::Bool, key, defaultValue, name, desc, SettingValue::Nothing )
#define VLMC_CREATE_PROJECT_PATH( key, defaultValue, name, desc ) \
VLMC_CREATE_PROJECT_PATH( SettingValue::Path, key, defaultValue, name, desc, SettingValue::Nothing )
#define VLMC_CREATE_PREFERENCE( type, key, defaultValue, name, desc, flags ) \
SettingsManager::getInstance()->createVar( type, key, defaultValue, name, \
...
...
@@ -81,6 +84,8 @@ SettingsManager::getInstance()->createVar( type, key, defaultValue, name, \
VLMC_CREATE_PREFERENCE( SettingValue::KeyboardShortcut, key, defaultValue, name, desc, SettingValue::Nothing )
#define VLMC_CREATE_PREFERENCE_BOOL( key, defaultValue, name, desc ) \
VLMC_CREATE_PREFERENCE( SettingValue::Bool, key, defaultValue, name, desc, SettingValue::Nothing )
#define VLMC_CREATE_PREFERENCE_PATH( key, defaultValue, name, desc ) \
VLMC_CREATE_PREFERENCE( SettingValue::Path, key, defaultValue, name, desc, SettingValue::Nothing )
//Convenience maccros :
#define VLMC_CREATE_PRIVATE_PREFERENCE_STRING( key, defaultValue ) \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment