Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
1a9ff3b3
Commit
1a9ff3b3
authored
Jun 30, 2014
by
Bryant Mairs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed Utils library as it's no longer used.
parent
0ce13bb0
Changes
98
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
98 changed files
with
0 additions
and
13596 deletions
+0
-13596
QGCExternalLibs.pri
QGCExternalLibs.pri
+0
-8
cache.cpp
libs/opmapcontrol/src/core/cache.cpp
+0
-1
abstractprocess.h
libs/utils/abstractprocess.h
+0
-78
abstractprocess_win.cpp
libs/utils/abstractprocess_win.cpp
+0
-114
basevalidatinglineedit.cpp
libs/utils/basevalidatinglineedit.cpp
+0
-158
basevalidatinglineedit.h
libs/utils/basevalidatinglineedit.h
+0
-101
checkablemessagebox.cpp
libs/utils/checkablemessagebox.cpp
+0
-176
checkablemessagebox.h
libs/utils/checkablemessagebox.h
+0
-103
checkablemessagebox.ui
libs/utils/checkablemessagebox.ui
+0
-154
classnamevalidatinglineedit.cpp
libs/utils/classnamevalidatinglineedit.cpp
+0
-148
classnamevalidatinglineedit.h
libs/utils/classnamevalidatinglineedit.h
+0
-78
codegeneration.cpp
libs/utils/codegeneration.cpp
+0
-101
codegeneration.h
libs/utils/codegeneration.h
+0
-68
consoleprocess.cpp
libs/utils/consoleprocess.cpp
+0
-83
consoleprocess.h
libs/utils/consoleprocess.h
+0
-140
consoleprocess_unix.cpp
libs/utils/consoleprocess_unix.cpp
+0
-258
consoleprocess_win.cpp
libs/utils/consoleprocess_win.cpp
+0
-260
coordinateconversions.cpp
libs/utils/coordinateconversions.cpp
+0
-240
coordinateconversions.h
libs/utils/coordinateconversions.h
+0
-58
detailsbutton.cpp
libs/utils/detailsbutton.cpp
+0
-60
detailsbutton.h
libs/utils/detailsbutton.h
+0
-56
detailswidget.cpp
libs/utils/detailswidget.cpp
+0
-199
detailswidget.h
libs/utils/detailswidget.h
+0
-83
fancylineedit.cpp
libs/utils/fancylineedit.cpp
+0
-311
fancylineedit.h
libs/utils/fancylineedit.h
+0
-109
fancymainwindow.cpp
libs/utils/fancymainwindow.cpp
+0
-186
fancymainwindow.h
libs/utils/fancymainwindow.h
+0
-87
filenamevalidatinglineedit.cpp
libs/utils/filenamevalidatinglineedit.cpp
+0
-133
filenamevalidatinglineedit.h
libs/utils/filenamevalidatinglineedit.h
+0
-69
filesearch.cpp
libs/utils/filesearch.cpp
+0
-260
filesearch.h
libs/utils/filesearch.h
+0
-64
filewizarddialog.cpp
libs/utils/filewizarddialog.cpp
+0
-69
filewizarddialog.h
libs/utils/filewizarddialog.h
+0
-64
filewizardpage.cpp
libs/utils/filewizardpage.cpp
+0
-130
filewizardpage.h
libs/utils/filewizardpage.h
+0
-89
filewizardpage.ui
libs/utils/filewizardpage.ui
+0
-54
homelocationutil.cpp
libs/utils/homelocationutil.cpp
+0
-77
homelocationutil.h
libs/utils/homelocationutil.h
+0
-53
removesubmitfield.png
libs/utils/images/removesubmitfield.png
+0
-0
iwelcomepage.cpp
libs/utils/iwelcomepage.cpp
+0
-41
iwelcomepage.h
libs/utils/iwelcomepage.h
+0
-60
linecolumnlabel.cpp
libs/utils/linecolumnlabel.cpp
+0
-62
linecolumnlabel.h
libs/utils/linecolumnlabel.h
+0
-63
listutils.h
libs/utils/listutils.h
+0
-48
newclasswidget.cpp
libs/utils/newclasswidget.cpp
+0
-510
newclasswidget.h
libs/utils/newclasswidget.h
+0
-167
newclasswidget.ui
libs/utils/newclasswidget.ui
+0
-181
parameteraction.cpp
libs/utils/parameteraction.cpp
+0
-86
parameteraction.h
libs/utils/parameteraction.h
+0
-82
pathchooser.cpp
libs/utils/pathchooser.cpp
+0
-328
pathchooser.h
libs/utils/pathchooser.h
+0
-121
pathlisteditor.cpp
libs/utils/pathlisteditor.cpp
+0
-310
pathlisteditor.h
libs/utils/pathlisteditor.h
+0
-107
pathutils.cpp
libs/utils/pathutils.cpp
+0
-148
pathutils.h
libs/utils/pathutils.h
+0
-58
projectintropage.cpp
libs/utils/projectintropage.cpp
+0
-210
projectintropage.h
libs/utils/projectintropage.h
+0
-103
projectintropage.ui
libs/utils/projectintropage.ui
+0
-116
projectnamevalidatinglineedit.cpp
libs/utils/projectnamevalidatinglineedit.cpp
+0
-60
projectnamevalidatinglineedit.h
libs/utils/projectnamevalidatinglineedit.h
+0
-52
qtcassert.h
libs/utils/qtcassert.h
+0
-44
qtcolorbutton.cpp
libs/utils/qtcolorbutton.cpp
+0
-287
qtcolorbutton.h
libs/utils/qtcolorbutton.h
+0
-78
qwineventnotifier_p.h
libs/utils/qwineventnotifier_p.h
+0
-94
reloadpromptutils.cpp
libs/utils/reloadpromptutils.cpp
+0
-69
reloadpromptutils.h
libs/utils/reloadpromptutils.h
+0
-48
savedaction.cpp
libs/utils/savedaction.cpp
+0
-437
savedaction.h
libs/utils/savedaction.h
+0
-123
settingsutils.cpp
libs/utils/settingsutils.cpp
+0
-48
settingsutils.h
libs/utils/settingsutils.h
+0
-42
styledbar.cpp
libs/utils/styledbar.cpp
+0
-83
styledbar.h
libs/utils/styledbar.h
+0
-58
stylehelper.cpp
libs/utils/stylehelper.cpp
+0
-253
stylehelper.h
libs/utils/stylehelper.h
+0
-78
submiteditorwidget.cpp
libs/utils/submiteditorwidget.cpp
+0
-507
submiteditorwidget.h
libs/utils/submiteditorwidget.h
+0
-146
submiteditorwidget.ui
libs/utils/submiteditorwidget.ui
+0
-72
submitfieldwidget.cpp
libs/utils/submitfieldwidget.cpp
+0
-370
submitfieldwidget.h
libs/utils/submitfieldwidget.h
+0
-97
synchronousprocess.cpp
libs/utils/synchronousprocess.cpp
+0
-493
synchronousprocess.h
libs/utils/synchronousprocess.h
+0
-148
treewidgetcolumnstretcher.cpp
libs/utils/treewidgetcolumnstretcher.cpp
+0
-64
treewidgetcolumnstretcher.h
libs/utils/treewidgetcolumnstretcher.h
+0
-60
uncommentselection.cpp
libs/utils/uncommentselection.cpp
+0
-159
uncommentselection.h
libs/utils/uncommentselection.h
+0
-44
utils.pri
libs/utils/utils.pri
+0
-9
utils.pro
libs/utils/utils.pro
+0
-108
utils.qrc
libs/utils/utils.qrc
+0
-5
utils_external.pri
libs/utils/utils_external.pri
+0
-123
utils_global.h
libs/utils/utils_global.h
+0
-42
welcomemodetreewidget.cpp
libs/utils/welcomemodetreewidget.cpp
+0
-119
welcomemodetreewidget.h
libs/utils/welcomemodetreewidget.h
+0
-79
winutils.cpp
libs/utils/winutils.cpp
+0
-113
winutils.h
libs/utils/winutils.h
+0
-50
worldmagmodel.cpp
libs/utils/worldmagmodel.cpp
+0
-1077
worldmagmodel.h
libs/utils/worldmagmodel.h
+0
-180
xmlconfig.cpp
libs/utils/xmlconfig.cpp
+0
-333
xmlconfig.h
libs/utils/xmlconfig.h
+0
-63
No files found.
QGCExternalLibs.pri
View file @
1a9ff3b3
...
...
@@ -302,16 +302,8 @@ DEFINES += NOMINMAX
#
# [REQUIRED] OPMapControl library from OpenPilot. Provides 2D mapping functionality.
#
include(libs/utils/utils_external.pri)
include(libs/opmapcontrol/opmapcontrol_external.pri)
DEPENDPATH += \
libs/utils \
libs/utils/src \
libs/opmapcontrol \
libs/opmapcontrol/src \
libs/opmapcontrol/src/mapwidget
INCLUDEPATH += \
libs/utils \
libs \
...
...
libs/opmapcontrol/src/core/cache.cpp
View file @
1a9ff3b3
...
...
@@ -25,7 +25,6 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "cache.h"
#include "utils/pathutils.h"
#include <QSettings>
namespace
core
{
...
...
libs/utils/abstractprocess.h
deleted
100644 → 0
View file @
0ce13bb0
/**
******************************************************************************
*
* @file abstractprocess.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup
* @{
*
*****************************************************************************/
/*
* 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 3 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.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef ABSTRACTPROCESS_H
#define ABSTRACTPROCESS_H
#include "utils_global.h"
#include <QtCore/QStringList>
namespace
Utils
{
class
QTCREATOR_UTILS_EXPORT
AbstractProcess
{
public:
AbstractProcess
()
{}
virtual
~
AbstractProcess
()
{}
QString
workingDirectory
()
const
{
return
m_workingDir
;
}
void
setWorkingDirectory
(
const
QString
&
dir
)
{
m_workingDir
=
dir
;
}
QStringList
environment
()
const
{
return
m_environment
;
}
void
setEnvironment
(
const
QStringList
&
env
)
{
m_environment
=
env
;
}
virtual
bool
start
(
const
QString
&
program
,
const
QStringList
&
args
)
=
0
;
virtual
void
stop
()
=
0
;
virtual
bool
isRunning
()
const
=
0
;
virtual
qint64
applicationPID
()
const
=
0
;
virtual
int
exitCode
()
const
=
0
;
//signals:
virtual
void
processError
(
const
QString
&
error
)
=
0
;
#ifdef Q_OS_WIN
// Add PATH and SystemRoot environment variables in case they are missing
static
QStringList
fixWinEnvironment
(
const
QStringList
&
env
);
// Quote a Windows command line correctly for the "CreateProcess" API
static
QString
createWinCommandline
(
const
QString
&
program
,
const
QStringList
&
args
);
// Create a bytearray suitable to be passed on as environment
// to the "CreateProcess" API (0-terminated UTF 16 strings).
static
QByteArray
createWinEnvironment
(
const
QStringList
&
env
);
#endif
private:
QString
m_workingDir
;
QStringList
m_environment
;
};
}
//namespace Utils
#endif // ABSTRACTPROCESS_H
libs/utils/abstractprocess_win.cpp
deleted
100644 → 0
View file @
0ce13bb0
/**
******************************************************************************
*
* @file abstractprocess_win.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup
* @{
*
*****************************************************************************/
/*
* 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 3 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.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "abstractprocess.h"
#include <windows.h>
namespace
Utils
{
QStringList
AbstractProcess
::
fixWinEnvironment
(
const
QStringList
&
env
)
{
QStringList
envStrings
=
env
;
// add PATH if necessary (for DLL loading)
if
(
envStrings
.
filter
(
QRegExp
(
QLatin1String
(
"^PATH="
),
Qt
::
CaseInsensitive
)).
isEmpty
())
{
QByteArray
path
=
qgetenv
(
"PATH"
);
if
(
!
path
.
isEmpty
())
envStrings
.
prepend
(
QString
(
QLatin1String
(
"PATH=%1"
)).
arg
(
QString
::
fromLocal8Bit
(
path
)));
}
// add systemroot if needed
if
(
envStrings
.
filter
(
QRegExp
(
QLatin1String
(
"^SystemRoot="
),
Qt
::
CaseInsensitive
)).
isEmpty
())
{
QByteArray
systemRoot
=
qgetenv
(
"SystemRoot"
);
if
(
!
systemRoot
.
isEmpty
())
envStrings
.
prepend
(
QString
(
QLatin1String
(
"SystemRoot=%1"
)).
arg
(
QString
::
fromLocal8Bit
(
systemRoot
)));
}
return
envStrings
;
}
QString
AbstractProcess
::
createWinCommandline
(
const
QString
&
program
,
const
QStringList
&
args
)
{
const
QChar
doubleQuote
=
QLatin1Char
(
'"'
);
const
QChar
blank
=
QLatin1Char
(
' '
);
const
QChar
backSlash
=
QLatin1Char
(
'\\'
);
QString
programName
=
program
;
if
(
!
programName
.
startsWith
(
doubleQuote
)
&&
!
programName
.
endsWith
(
doubleQuote
)
&&
programName
.
contains
(
blank
))
{
programName
.
insert
(
0
,
doubleQuote
);
programName
.
append
(
doubleQuote
);
}
// add the prgram as the first arrg ... it works better
programName
.
replace
(
QLatin1Char
(
'/'
),
backSlash
);
QString
cmdLine
=
programName
;
if
(
args
.
empty
())
return
cmdLine
;
cmdLine
+=
blank
;
for
(
int
i
=
0
;
i
<
args
.
size
();
++
i
)
{
QString
tmp
=
args
.
at
(
i
);
// in the case of \" already being in the string the \ must also be escaped
tmp
.
replace
(
QLatin1String
(
"
\\\"
"
),
QLatin1String
(
"
\\\\\"
"
));
// escape a single " because the arguments will be parsed
tmp
.
replace
(
QString
(
doubleQuote
),
QLatin1String
(
"
\\\"
"
));
if
(
tmp
.
isEmpty
()
||
tmp
.
contains
(
blank
)
||
tmp
.
contains
(
'\t'
))
{
// The argument must not end with a \ since this would be interpreted
// as escaping the quote -- rather put the \ behind the quote: e.g.
// rather use "foo"\ than "foo\"
QString
endQuote
(
doubleQuote
);
int
i
=
tmp
.
length
();
while
(
i
>
0
&&
tmp
.
at
(
i
-
1
)
==
backSlash
)
{
--
i
;
endQuote
+=
backSlash
;
}
cmdLine
+=
QLatin1String
(
"
\"
"
);
cmdLine
+=
tmp
.
left
(
i
);
cmdLine
+=
endQuote
;
}
else
{
cmdLine
+=
blank
;
cmdLine
+=
tmp
;
}
}
return
cmdLine
;
}
QByteArray
AbstractProcess
::
createWinEnvironment
(
const
QStringList
&
env
)
{
QByteArray
envlist
;
int
pos
=
0
;
foreach
(
const
QString
&
tmp
,
env
)
{
const
uint
tmpSize
=
sizeof
(
TCHAR
)
*
(
tmp
.
length
()
+
1
);
envlist
.
resize
(
envlist
.
size
()
+
tmpSize
);
memcpy
(
envlist
.
data
()
+
pos
,
tmp
.
utf16
(),
tmpSize
);
pos
+=
tmpSize
;
}
envlist
.
resize
(
envlist
.
size
()
+
2
);
envlist
[
pos
++
]
=
0
;
envlist
[
pos
++
]
=
0
;
return
envlist
;
}
}
//namespace Utils
libs/utils/basevalidatinglineedit.cpp
deleted
100644 → 0
View file @
0ce13bb0
/**
******************************************************************************
*
* @file basevalidatinglineedit.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup
* @{
*
*****************************************************************************/
/*
* 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 3 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.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "basevalidatinglineedit.h"
#include <QtCore/QDebug>
enum
{
debug
=
0
};
namespace
Utils
{
struct
BaseValidatingLineEditPrivate
{
explicit
BaseValidatingLineEditPrivate
(
const
QWidget
*
w
);
const
QColor
m_okTextColor
;
QColor
m_errorTextColor
;
BaseValidatingLineEdit
::
State
m_state
;
QString
m_errorMessage
;
QString
m_initialText
;
bool
m_firstChange
;
};
BaseValidatingLineEditPrivate
::
BaseValidatingLineEditPrivate
(
const
QWidget
*
w
)
:
m_okTextColor
(
BaseValidatingLineEdit
::
textColor
(
w
)),
m_errorTextColor
(
Qt
::
red
),
m_state
(
BaseValidatingLineEdit
::
Invalid
),
m_firstChange
(
true
)
{
}
BaseValidatingLineEdit
::
BaseValidatingLineEdit
(
QWidget
*
parent
)
:
QLineEdit
(
parent
),
m_bd
(
new
BaseValidatingLineEditPrivate
(
this
))
{
// Note that textChanged() is also triggered automagically by
// QLineEdit::setText(), no need to trigger manually.
connect
(
this
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
slotChanged
(
QString
)));
}
BaseValidatingLineEdit
::~
BaseValidatingLineEdit
()
{
delete
m_bd
;
}
QString
BaseValidatingLineEdit
::
initialText
()
const
{
return
m_bd
->
m_initialText
;
}
void
BaseValidatingLineEdit
::
setInitialText
(
const
QString
&
t
)
{
if
(
m_bd
->
m_initialText
!=
t
)
{
m_bd
->
m_initialText
=
t
;
m_bd
->
m_firstChange
=
true
;
setText
(
t
);
}
}
QColor
BaseValidatingLineEdit
::
errorColor
()
const
{
return
m_bd
->
m_errorTextColor
;
}
void
BaseValidatingLineEdit
::
setErrorColor
(
const
QColor
&
c
)
{
m_bd
->
m_errorTextColor
=
c
;
}
QColor
BaseValidatingLineEdit
::
textColor
(
const
QWidget
*
w
)
{
return
w
->
palette
().
color
(
QPalette
::
Active
,
QPalette
::
Text
);
}
void
BaseValidatingLineEdit
::
setTextColor
(
QWidget
*
w
,
const
QColor
&
c
)
{
QPalette
palette
=
w
->
palette
();
palette
.
setColor
(
QPalette
::
Active
,
QPalette
::
Text
,
c
);
w
->
setPalette
(
palette
);
}
BaseValidatingLineEdit
::
State
BaseValidatingLineEdit
::
state
()
const
{
return
m_bd
->
m_state
;
}
bool
BaseValidatingLineEdit
::
isValid
()
const
{
return
m_bd
->
m_state
==
Valid
;
}
QString
BaseValidatingLineEdit
::
errorMessage
()
const
{
return
m_bd
->
m_errorMessage
;
}
void
BaseValidatingLineEdit
::
slotChanged
(
const
QString
&
t
)
{
m_bd
->
m_errorMessage
.
clear
();
// Are we displaying the initial text?
const
bool
isDisplayingInitialText
=
!
m_bd
->
m_initialText
.
isEmpty
()
&&
t
==
m_bd
->
m_initialText
;
const
State
newState
=
isDisplayingInitialText
?
DisplayingInitialText
:
(
validate
(
t
,
&
m_bd
->
m_errorMessage
)
?
Valid
:
Invalid
);
setToolTip
(
m_bd
->
m_errorMessage
);
if
(
debug
)
qDebug
()
<<
Q_FUNC_INFO
<<
t
<<
"State"
<<
m_bd
->
m_state
<<
"->"
<<
newState
<<
m_bd
->
m_errorMessage
;
// Changed..figure out if valid changed. DisplayingInitialText is not valid,
// but should not show error color. Also trigger on the first change.
if
(
newState
!=
m_bd
->
m_state
||
m_bd
->
m_firstChange
)
{
const
bool
validHasChanged
=
(
m_bd
->
m_state
==
Valid
)
!=
(
newState
==
Valid
);
m_bd
->
m_state
=
newState
;
m_bd
->
m_firstChange
=
false
;
setTextColor
(
this
,
newState
==
Invalid
?
m_bd
->
m_errorTextColor
:
m_bd
->
m_okTextColor
);
if
(
validHasChanged
)
{
emit
validChanged
(
newState
==
Valid
);
emit
validChanged
();
}
}
}
void
BaseValidatingLineEdit
::
slotReturnPressed
()
{
if
(
isValid
())
emit
validReturnPressed
();
}
void
BaseValidatingLineEdit
::
triggerChanged
()
{
slotChanged
(
text
());
}
}
// namespace Utils
libs/utils/basevalidatinglineedit.h
deleted
100644 → 0
View file @
0ce13bb0
/**
******************************************************************************
*
* @file basevalidatinglineedit.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup
* @{
*
*****************************************************************************/
/*
* 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 3 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.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef BASEVALIDATINGLINEEDIT_H
#define BASEVALIDATINGLINEEDIT_H
#include "utils_global.h"
#include <QtGui/QLineEdit>
namespace
Utils
{
struct
BaseValidatingLineEditPrivate
;
/**
* Base class for validating line edits that performs validation in a virtual
* validate() function to be implemented in derived classes.
* When invalid, the text color will turn red and a tooltip will
* contain the error message. This approach is less intrusive than a
* QValidator which will prevent the user from entering certain characters.
*
* The widget has a concept of an "initialText" which can be something like
* "<Enter name here>". This results in state 'DisplayingInitialText', which
* is not valid, but is not marked red.
*/
class
QTCREATOR_UTILS_EXPORT
BaseValidatingLineEdit
:
public
QLineEdit
{
Q_OBJECT
Q_DISABLE_COPY
(
BaseValidatingLineEdit
)
Q_PROPERTY
(
QString
initialText
READ
initialText
WRITE
setInitialText
DESIGNABLE
true
)
Q_PROPERTY
(
QColor
errorColor
READ
errorColor
WRITE
setErrorColor
DESIGNABLE
true
)
public:
enum
State
{
Invalid
,
DisplayingInitialText
,
Valid
};
explicit
BaseValidatingLineEdit
(
QWidget
*
parent
=
0
);
virtual
~
BaseValidatingLineEdit
();
State
state
()
const
;
bool
isValid
()
const
;
QString
errorMessage
()
const
;
QString
initialText
()
const
;
void
setInitialText
(
const
QString
&
);
QColor
errorColor
()
const
;
void
setErrorColor
(
const
QColor
&
);
// Trigger an update (after changing settings)
void
triggerChanged
();
static
QColor
textColor
(
const
QWidget
*
w
);
static
void
setTextColor
(
QWidget
*
w
,
const
QColor
&
c
);
signals:
void
validChanged
();
void
validChanged
(
bool
validState
);
void
validReturnPressed
();
protected:
virtual
bool
validate
(
const
QString
&
value
,
QString
*
errorMessage
)
const
=
0
;
protected
slots
:
// Custom behaviour can be added here. The base implementation must
// be called.
virtual
void
slotReturnPressed
();
virtual
void
slotChanged
(
const
QString
&
t
);
private:
BaseValidatingLineEditPrivate
*
m_bd
;
};
}
// namespace Utils
#endif // BASEVALIDATINGLINEEDIT_H
libs/utils/checkablemessagebox.cpp
deleted
100644 → 0
View file @
0ce13bb0
/**
******************************************************************************
*
* @file checkablemessagebox.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup
* @{
*
*****************************************************************************/
/*
* 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 3 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.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "checkablemessagebox.h"
#include "ui_checkablemessagebox.h"
#include <QtGui/QPushButton>
#include <QtCore/QDebug>
namespace
Utils
{
struct
CheckableMessageBoxPrivate
{
CheckableMessageBoxPrivate
()
:
clickedButton
(
0
)
{}
Ui
::
CheckableMessageBox
ui
;
QAbstractButton
*
clickedButton
;
};
CheckableMessageBox
::
CheckableMessageBox
(
QWidget
*
parent
)
:
QDialog
(
parent
),
m_d
(
new
CheckableMessageBoxPrivate
)
{
setModal
(
true
);
setWindowFlags
(
windowFlags
()
&
~
Qt
::
WindowContextHelpButtonHint
);
m_d
->
ui
.
setupUi
(
this
);
m_d
->
ui
.
pixmapLabel
->
setVisible
(
false
);
connect
(
m_d
->
ui
.
buttonBox
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
accept
()));
connect
(
m_d
->
ui
.
buttonBox
,
SIGNAL
(
rejected
()),
this
,
SLOT
(
reject
()));
connect
(
m_d
->
ui
.
buttonBox
,
SIGNAL
(
clicked
(
QAbstractButton
*
)),
this
,
SLOT
(
slotClicked
(
QAbstractButton
*
)));
}
CheckableMessageBox
::~
CheckableMessageBox
()
{
delete
m_d
;
}
void
CheckableMessageBox
::
slotClicked
(
QAbstractButton
*
b
)
{
m_d
->
clickedButton
=
b
;
}
QAbstractButton
*
CheckableMessageBox
::
clickedButton
()
const
{
return
m_d
->
clickedButton
;
}
QDialogButtonBox
::
StandardButton
CheckableMessageBox
::
clickedStandardButton
()
const
{
if
(
m_d
->
clickedButton
)
return
m_d
->
ui
.
buttonBox
->
standardButton
(
m_d
->
clickedButton
);
return
QDialogButtonBox
::
NoButton
;
}
QString
CheckableMessageBox
::
text
()
const
{
return
m_d
->
ui
.
messageLabel
->
text
();
}
void
CheckableMessageBox
::
setText
(
const
QString
&
t
)
{
m_d
->
ui
.
messageLabel
->
setText
(
t
);
}
QPixmap
CheckableMessageBox
::
iconPixmap
()
const
{
if
(
const
QPixmap
*
p
=
m_d
->
ui
.
pixmapLabel
->
pixmap
())
return
QPixmap
(
*
p
);
return
QPixmap
();
}
void
CheckableMessageBox
::
setIconPixmap
(
const
QPixmap
&
p
)
{
m_d
->
ui
.
pixmapLabel
->
setPixmap
(
p
);
m_d
->
ui
.
pixmapLabel
->
setVisible
(
!
p
.
isNull
());
}
bool
CheckableMessageBox
::
isChecked
()
const
{
return
m_d
->
ui
.
checkBox
->
isChecked
();
}
void
CheckableMessageBox
::
setChecked
(
bool
s
)
{
m_d
->
ui
.
checkBox
->
setChecked
(
s
);
}
QString
CheckableMessageBox
::
checkBoxText
()
const
{
return
m_d
->
ui
.
checkBox
->
text
();
}
void
CheckableMessageBox
::
setCheckBoxText
(
const
QString
&
t
)
{
m_d
->
ui
.
checkBox
->
setText
(
t
);
}
QDialogButtonBox
::
StandardButtons
CheckableMessageBox
::
standardButtons
()
const
{
return
m_d
->
ui
.
buttonBox
->
standardButtons
();
}
void
CheckableMessageBox
::
setStandardButtons
(
QDialogButtonBox
::
StandardButtons
s
)
{
m_d
->
ui
.
buttonBox
->
setStandardButtons
(
s
);
}
QDialogButtonBox
::
StandardButton
CheckableMessageBox
::
defaultButton
()
const
{
foreach
(
QAbstractButton
*
b
,
m_d
->
ui
.
buttonBox
->
buttons
())
if
(
QPushButton
*
pb
=
qobject_cast
<
QPushButton
*>
(
b
))
if
(
pb
->
isDefault
())
return
m_d
->
ui
.
buttonBox
->
standardButton
(
pb
);
return
QDialogButtonBox
::
NoButton
;
}
void
CheckableMessageBox
::
setDefaultButton
(
QDialogButtonBox
::
StandardButton
s
)
{
if
(
QPushButton
*
b
=
m_d
->
ui
.
buttonBox
->
button
(
s
))
{
b
->
setDefault
(
true
);
b
->
setFocus
();
}
}
QDialogButtonBox
::
StandardButton
CheckableMessageBox
::
question
(
QWidget
*
parent
,
const
QString
&
title
,
const
QString
&
question
,
const
QString
&
checkBoxText
,
bool
*
checkBoxSetting
,
QDialogButtonBox
::
StandardButtons
buttons
,
QDialogButtonBox
::
StandardButton
defaultButton
)
{
CheckableMessageBox
mb
(
parent
);
mb
.
setWindowTitle
(
title
);
mb
.
setIconPixmap
(
QMessageBox
::
standardIcon
(
QMessageBox
::
Question
));
mb
.
setText
(
question
);
mb
.
setCheckBoxText
(
checkBoxText
);
mb
.
setChecked
(
*
checkBoxSetting
);
mb
.
setStandardButtons
(
buttons
);
mb
.
setDefaultButton
(
defaultButton
);
mb
.
exec
();
*
checkBoxSetting
=
mb
.
isChecked
();
return
mb
.
clickedStandardButton
();
}
QMessageBox
::
StandardButton
CheckableMessageBox
::
dialogButtonBoxToMessageBoxButton
(
QDialogButtonBox
::
StandardButton
db
)
{
return
static_cast
<
QMessageBox
::
StandardButton
>
(
int
(
db
));
}
}
// namespace Utils
libs/utils/checkablemessagebox.h
deleted
100644 → 0
View file @
0ce13bb0
/**
******************************************************************************
*
* @file checkablemessagebox.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup
* @{
*
*****************************************************************************/
/*
* 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 3 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.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef CHECKABLEMESSAGEBOX_H
#define CHECKABLEMESSAGEBOX_H