Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
64f2d9f3
Commit
64f2d9f3
authored
Jan 26, 2009
by
hjk
Browse files
Fixes: coreplugin: small fixes
Details: comments & codestyle
parent
a438a853
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/plugins/coreplugin/icorelistener.h
View file @
64f2d9f3
...
...
@@ -42,23 +42,25 @@ namespace Core {
/*!
\class Core::ICoreListener
\brief Provides a hook for plugins to veto on certain events emitted from the core plugin.
You implement this interface if you want to prevent certain events from occurring, e.g.
if you want to prevent the closing of the whole application or to prevent the closing
of an editor window under certain conditions.
\brief Provides a hook for plugins to veto on certain events emitted from
the core plugin.
You implement this interface if you want to prevent certain events from
occurring, e.g. if you want to prevent the closing of the whole application
or to prevent the closing of an editor window under certain conditions.
If e.g. the application window requests a close, then first
ICoreListener::coreAboutToClose() is called (in arbitrary order)
on all
registered objects implementing this interface. If one if these calls returns
false, the process is aborted and the event is ignored.
If all calls return
true, the corresponding signal is emitted and the event is accepted/performed.
ICoreListener::coreAboutToClose() is called (in arbitrary order)
on all
registered objects implementing this interface. If one if these calls returns
false, the process is aborted and the event is ignored.
If all calls return
true, the corresponding signal is emitted and the event is accepted/performed.
Guidelines for implementing:
\list
\o Return false from the implemented method if you want to prevent the event.
\o You need to add your implementing object to the plugin managers objects:
ICore
::
p
luginManager()->addObject(yourImplementingObject);
ExtensionSystem
::
P
luginManager
::instance
()->addObject(yourImplementingObject);
\o Don't forget to remove the object again at deconstruction (e.g. in the destructor of
your plugin).
*/
...
...
src/plugins/coreplugin/inavigationwidgetfactory.cpp
View file @
64f2d9f3
...
...
@@ -33,6 +33,8 @@
#include
"inavigationwidgetfactory.h"
#include
<QtGui/QKeySequence>
using
namespace
Core
;
INavigationWidgetFactory
::
INavigationWidgetFactory
()
...
...
src/plugins/coreplugin/inavigationwidgetfactory.h
View file @
64f2d9f3
...
...
@@ -37,18 +37,19 @@
#include
<coreplugin/core_global.h>
#include
<QtCore/QObject>
#include
<QtCore/QList>
#include
<QtGui/QKeySequence>
QT_BEGIN_NAMESPACE
class
QToolButton
;
class
QKeySequence
;
class
QWidget
;
QT_END_NAMESPACE
namespace
Core
{
struct
NavigationView
{
QWidget
*
widget
;
QList
<
QToolButton
*>
doockToolBarWidgets
;
struct
NavigationView
{
QWidget
*
widget
;
QList
<
QToolButton
*>
doockToolBarWidgets
;
};
class
CORE_EXPORT
INavigationWidgetFactory
:
public
QObject
...
...
src/plugins/coreplugin/iview.h
View file @
64f2d9f3
...
...
@@ -36,14 +36,11 @@
#include
"core_global.h"
#include
<QtGui/QKeySequence>
#include
<coreplugin/icontext.h>
namespace
Core
{
class
CORE_EXPORT
IView
:
public
IContext
class
CORE_EXPORT
IView
:
public
IContext
{
Q_OBJECT
public:
...
...
src/plugins/coreplugin/mimedatabase.h
View file @
64f2d9f3
...
...
@@ -120,7 +120,8 @@ private:
* Extensions:
* - List of suffixes and preferred suffix (derived from glob patterns).
*/
class
CORE_EXPORT
MimeType
{
class
CORE_EXPORT
MimeType
{
public:
/* Return value of a glob match, which is higher than magic */
enum
{
GlobMatchPriority
=
101
};
...
...
src/plugins/coreplugin/rightpane.h
View file @
64f2d9f3
...
...
@@ -44,41 +44,51 @@ namespace Core {
class
IMode
;
class
RightPaneWidget
;
// TODO: The right pane works only for the help plugin atm.
// It can't cope with more than one plugin publishing objects they want in the right pane
// For that the API would need to be different. (Might be that instead of adding objects
// to the pool, there should be a method RightPaneWidget::setWidget(QWidget *w)
// Anyway if a second plugin wants to show something there, redesign this API
// TODO: The right pane works only for the help plugin atm. It can't cope
// with more than one plugin publishing objects they want in the right pane
// For that the API would need to be different. (Might be that instead of
// adding objects to the pool, there should be a method
// RightPaneWidget::setWidget(QWidget *w) Anyway if a second plugin wants to
// show something there, redesign this API
class
CORE_EXPORT
RightPanePlaceHolder
:
public
QWidget
{
friend
class
Core
::
RightPaneWidget
;
Q_OBJECT
public:
RightPanePlaceHolder
(
Core
::
IMode
*
mode
,
QWidget
*
parent
=
0
);
~
RightPanePlaceHolder
();
static
RightPanePlaceHolder
*
current
();
private
slots
:
void
currentModeChanged
(
Core
::
IMode
*
);
private:
void
applyStoredSize
(
int
width
);
Core
::
IMode
*
m_mode
;
static
RightPanePlaceHolder
*
m_current
;
};
class
CORE_EXPORT
BaseRightPaneWidget
:
public
QObject
{
Q_OBJECT
public:
BaseRightPaneWidget
(
QWidget
*
widget
);
~
BaseRightPaneWidget
();
QWidget
*
widget
()
const
;
private:
QWidget
*
m_widget
;
};
class
CORE_EXPORT
RightPaneWidget
:
public
QWidget
{
Q_OBJECT
public:
RightPaneWidget
();
~
RightPaneWidget
();
...
...
@@ -89,11 +99,13 @@ public:
bool
isShown
();
void
setShown
(
bool
b
);
static
RightPaneWidget
*
instance
();
static
RightPaneWidget
*
instance
();
int
storedWidth
();
protected:
void
resizeEvent
(
QResizeEvent
*
);
private
slots
:
void
objectAdded
(
QObject
*
obj
);
void
aboutToRemoveObject
(
QObject
*
obj
);
...
...
src/plugins/coreplugin/styleanimator.cpp
View file @
64f2d9f3
...
...
@@ -54,25 +54,25 @@ void Animation::paint(QPainter *painter, const QStyleOption *option)
void
Animation
::
drawBlendedImage
(
QPainter
*
painter
,
QRect
rect
,
float
alpha
)
{
if
(
_secondaryImage
.
isNull
()
||
_primaryImage
.
isNull
())
if
(
m
_secondaryImage
.
isNull
()
||
m
_primaryImage
.
isNull
())
return
;
if
(
_tempImage
.
isNull
())
_tempImage
=
_secondaryImage
;
if
(
m
_tempImage
.
isNull
())
m
_tempImage
=
m
_secondaryImage
;
const
int
a
=
qRound
(
alpha
*
256
);
const
int
ia
=
256
-
a
;
const
int
sw
=
_primaryImage
.
width
();
const
int
sh
=
_primaryImage
.
height
();
const
int
bpl
=
_primaryImage
.
bytesPerLine
();
switch
(
_primaryImage
.
depth
())
{
const
int
sw
=
m
_primaryImage
.
width
();
const
int
sh
=
m
_primaryImage
.
height
();
const
int
bpl
=
m
_primaryImage
.
bytesPerLine
();
switch
(
m
_primaryImage
.
depth
())
{
case
32
:
{
uchar
*
mixed_data
=
_tempImage
.
bits
();
const
uchar
*
back_data
=
_primaryImage
.
bits
();
const
uchar
*
front_data
=
_secondaryImage
.
bits
();
uchar
*
mixed_data
=
m
_tempImage
.
bits
();
const
uchar
*
back_data
=
m
_primaryImage
.
bits
();
const
uchar
*
front_data
=
m
_secondaryImage
.
bits
();
for
(
int
sy
=
0
;
sy
<
sh
;
sy
++
)
{
quint32
*
mixed
=
(
quint32
*
)
mixed_data
;
quint32
*
mixed
=
(
quint32
*
)
mixed_data
;
const
quint32
*
back
=
(
const
quint32
*
)
back_data
;
const
quint32
*
front
=
(
const
quint32
*
)
front_data
;
for
(
int
sx
=
0
;
sx
<
sw
;
sx
++
)
{
...
...
@@ -91,27 +91,28 @@ void Animation::drawBlendedImage(QPainter *painter, QRect rect, float alpha)
default:
break
;
}
painter
->
drawImage
(
rect
,
_tempImage
);
painter
->
drawImage
(
rect
,
m
_tempImage
);
}
void
Transition
::
paint
(
QPainter
*
painter
,
const
QStyleOption
*
option
)
{
float
alpha
=
1.0
;
if
(
_duration
>
0
)
{
if
(
m
_duration
>
0
)
{
QTime
current
=
QTime
::
currentTime
();
if
(
_startTime
>
current
)
_startTime
=
current
;
if
(
m
_startTime
>
current
)
m
_startTime
=
current
;
int
timeDiff
=
_startTime
.
msecsTo
(
current
);
alpha
=
timeDiff
/
(
float
)
_duration
;
if
(
timeDiff
>
_duration
)
{
_running
=
false
;
int
timeDiff
=
m
_startTime
.
msecsTo
(
current
);
alpha
=
timeDiff
/
(
float
)
m
_duration
;
if
(
timeDiff
>
m
_duration
)
{
m
_running
=
false
;
alpha
=
1.0
;
}
}
else
{
_running
=
false
;
}
m_running
=
false
;
}
drawBlendedImage
(
painter
,
option
->
rect
,
alpha
);
}
...
...
src/plugins/coreplugin/styleanimator.h
View file @
64f2d9f3
...
...
@@ -51,24 +51,24 @@
class
Animation
{
public
:
Animation
()
:
_running
(
true
)
{
}
Animation
()
:
m
_running
(
true
)
{
}
virtual
~
Animation
()
{
}
QWidget
*
widget
()
const
{
return
_widget
;
}
bool
running
()
const
{
return
_running
;
}
const
QTime
&
startTime
()
const
{
return
_startTime
;
}
void
setRunning
(
bool
val
)
{
_running
=
val
;
}
void
setWidget
(
QWidget
*
widget
)
{
_widget
=
widget
;
}
void
setStartTime
(
const
QTime
&
startTime
)
{
_startTime
=
startTime
;
}
QWidget
*
widget
()
const
{
return
m
_widget
;
}
bool
running
()
const
{
return
m
_running
;
}
const
QTime
&
startTime
()
const
{
return
m
_startTime
;
}
void
setRunning
(
bool
val
)
{
m
_running
=
val
;
}
void
setWidget
(
QWidget
*
widget
)
{
m
_widget
=
widget
;
}
void
setStartTime
(
const
QTime
&
startTime
)
{
m
_startTime
=
startTime
;
}
virtual
void
paint
(
QPainter
*
painter
,
const
QStyleOption
*
option
);
protected:
void
drawBlendedImage
(
QPainter
*
painter
,
QRect
rect
,
float
value
);
QTime
_startTime
;
QPointer
<
QWidget
>
_widget
;
QImage
_primaryImage
;
QImage
_secondaryImage
;
QImage
_tempImage
;
bool
_running
;
QTime
m
_startTime
;
QPointer
<
QWidget
>
m
_widget
;
QImage
m
_primaryImage
;
QImage
m
_secondaryImage
;
QImage
m
_tempImage
;
bool
m
_running
;
};
// Handles state transition animations
...
...
@@ -76,13 +76,13 @@ class Transition : public Animation
{
public
:
Transition
()
:
Animation
()
{}
virtual
~
Transition
()
{
}
void
setDuration
(
int
duration
)
{
_duration
=
duration
;
}
void
setStartImage
(
const
QImage
&
image
)
{
_primaryImage
=
image
;
}
void
setEndImage
(
const
QImage
&
image
)
{
_secondaryImage
=
image
;
}
virtual
~
Transition
()
{}
void
setDuration
(
int
duration
)
{
m
_duration
=
duration
;
}
void
setStartImage
(
const
QImage
&
image
)
{
m
_primaryImage
=
image
;
}
void
setEndImage
(
const
QImage
&
image
)
{
m
_secondaryImage
=
image
;
}
virtual
void
paint
(
QPainter
*
painter
,
const
QStyleOption
*
option
);
int
duration
()
const
{
return
_duration
;
}
int
_duration
;
//set time in ms to complete a state transition
int
duration
()
const
{
return
m
_duration
;
}
int
m
_duration
;
//set time in ms to complete a state transition
};
class
StyleAnimator
:
public
QObject
...
...
src/plugins/coreplugin/stylehelper.h
View file @
64f2d9f3
...
...
@@ -69,9 +69,7 @@ public:
static
void
menuGradient
(
QPainter
*
painter
,
const
QRect
&
spanRect
,
const
QRect
&
clipRect
);
// Pixmap cache should only be enabled for X11 due to slow gradients
static
bool
usePixmapCache
()
{
return
true
;
}
static
bool
usePixmapCache
()
{
return
true
;
}
private:
static
QColor
m_baseColor
;
...
...
src/plugins/coreplugin/tabpositionindicator.h
View file @
64f2d9f3
...
...
@@ -36,8 +36,6 @@
#include
<QtGui/QWidget>
#define TABPOSITIONINDICATOR_WIDTH 2
namespace
Core
{
namespace
Internal
{
...
...
@@ -46,6 +44,8 @@ class TabPositionIndicator : public QWidget
Q_OBJECT
public:
enum
{
TABPOSITIONINDICATOR_WIDTH
=
2
};
TabPositionIndicator
();
int
indicatorWidth
()
{
return
TABPOSITIONINDICATOR_WIDTH
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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