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
2d9acbc2
Commit
2d9acbc2
authored
Oct 15, 2009
by
con
Browse files
QuickOpenPlugin --> LocatorPlugin
parent
2adb5d55
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/plugins/quickopen/
quickopen
plugin.cpp
→
src/plugins/quickopen/
locator
plugin.cpp
View file @
2d9acbc2
...
...
@@ -27,7 +27,7 @@
**
**************************************************************************/
#include
"
quickopen
plugin.h"
#include
"
locator
plugin.h"
#include
"quickopenconstants.h"
#include
"quickopenfiltersfilter.h"
#include
"locatormanager.h"
...
...
@@ -70,13 +70,13 @@ namespace {
}
}
QuickOpenPlugin
::
QuickOpen
Plugin
()
LocatorPlugin
::
Locator
Plugin
()
{
m_refreshTimer
.
setSingleShot
(
false
);
connect
(
&
m_refreshTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
refresh
()));
}
QuickOpenPlugin
::~
QuickOpen
Plugin
()
LocatorPlugin
::~
Locator
Plugin
()
{
removeObject
(
m_openDocumentsFilter
);
removeObject
(
m_fileSystemFilter
);
...
...
@@ -87,7 +87,7 @@ QuickOpenPlugin::~QuickOpenPlugin()
qDeleteAll
(
m_customFilters
);
}
bool
QuickOpen
Plugin
::
initialize
(
const
QStringList
&
,
QString
*
)
bool
Locator
Plugin
::
initialize
(
const
QStringList
&
,
QString
*
)
{
Core
::
ICore
*
core
=
Core
::
ICore
::
instance
();
m_settingsPage
=
new
SettingsPage
(
this
);
...
...
@@ -126,24 +126,24 @@ bool QuickOpenPlugin::initialize(const QStringList &, QString *)
return
true
;
}
void
QuickOpen
Plugin
::
openQuickOpen
()
void
Locator
Plugin
::
openQuickOpen
()
{
m_locatorWidget
->
show
(
""
);
}
void
QuickOpen
Plugin
::
extensionsInitialized
()
void
Locator
Plugin
::
extensionsInitialized
()
{
m_filters
=
ExtensionSystem
::
PluginManager
::
instance
()
->
getObjects
<
ILocatorFilter
>
();
qSort
(
m_filters
.
begin
(),
m_filters
.
end
(),
filterLessThan
);
}
void
QuickOpen
Plugin
::
startSettingsLoad
()
void
Locator
Plugin
::
startSettingsLoad
()
{
m_loadWatcher
.
setFuture
(
QtConcurrent
::
run
(
this
,
&
QuickOpen
Plugin
::
loadSettings
));
m_loadWatcher
.
setFuture
(
QtConcurrent
::
run
(
this
,
&
Locator
Plugin
::
loadSettings
));
connect
(
&
m_loadWatcher
,
SIGNAL
(
finished
()),
this
,
SLOT
(
settingsLoaded
()));
}
void
QuickOpen
Plugin
::
loadSettings
()
void
Locator
Plugin
::
loadSettings
()
{
Core
::
ICore
*
core
=
Core
::
ICore
::
instance
();
QSettings
*
qs
=
core
->
settings
();
...
...
@@ -159,7 +159,7 @@ void QuickOpenPlugin::loadSettings()
qs
->
remove
(
"QuickOpen"
);
}
void
QuickOpen
Plugin
::
settingsLoaded
()
void
Locator
Plugin
::
settingsLoaded
()
{
m_locatorWidget
->
updateFilterList
();
m_locatorWidget
->
setEnabled
(
true
);
...
...
@@ -167,7 +167,7 @@ void QuickOpenPlugin::settingsLoaded()
m_refreshTimer
.
start
();
}
void
QuickOpen
Plugin
::
saveSettings
()
void
Locator
Plugin
::
saveSettings
()
{
Core
::
ICore
*
core
=
Core
::
ICore
::
instance
();
if
(
core
&&
core
->
settingsDatabase
())
{
...
...
@@ -191,43 +191,43 @@ void QuickOpenPlugin::saveSettings()
}
/*!
\fn QList<ILocatorFilter*>
QuickOpen
Plugin::filter()
\fn QList<ILocatorFilter*>
Locator
Plugin::filter()
Return all filters, including the ones created by the user.
*/
QList
<
ILocatorFilter
*>
QuickOpen
Plugin
::
filters
()
QList
<
ILocatorFilter
*>
Locator
Plugin
::
filters
()
{
return
m_filters
;
}
/*!
\fn QList<ILocatorFilter*>
QuickOpen
Plugin::customFilter()
\fn QList<ILocatorFilter*>
Locator
Plugin::customFilter()
This returns a subset of all the filters, that contains only the filters that
have been created by the user at some point (maybe in a previous session).
*/
QList
<
ILocatorFilter
*>
QuickOpen
Plugin
::
customFilters
()
QList
<
ILocatorFilter
*>
Locator
Plugin
::
customFilters
()
{
return
m_customFilters
;
}
void
QuickOpen
Plugin
::
setFilters
(
QList
<
ILocatorFilter
*>
f
)
void
Locator
Plugin
::
setFilters
(
QList
<
ILocatorFilter
*>
f
)
{
m_filters
=
f
;
m_locatorWidget
->
updateFilterList
();
}
void
QuickOpen
Plugin
::
setCustomFilters
(
QList
<
ILocatorFilter
*>
filters
)
void
Locator
Plugin
::
setCustomFilters
(
QList
<
ILocatorFilter
*>
filters
)
{
m_customFilters
=
filters
;
}
int
QuickOpen
Plugin
::
refreshInterval
()
int
Locator
Plugin
::
refreshInterval
()
{
return
m_refreshTimer
.
interval
()
/
60000
;
}
void
QuickOpen
Plugin
::
setRefreshInterval
(
int
interval
)
void
Locator
Plugin
::
setRefreshInterval
(
int
interval
)
{
if
(
interval
<
1
)
{
m_refreshTimer
.
stop
();
...
...
@@ -238,7 +238,7 @@ void QuickOpenPlugin::setRefreshInterval(int interval)
m_refreshTimer
.
start
();
}
void
QuickOpen
Plugin
::
refresh
(
QList
<
ILocatorFilter
*>
filters
)
void
Locator
Plugin
::
refresh
(
QList
<
ILocatorFilter
*>
filters
)
{
if
(
filters
.
isEmpty
())
filters
=
m_filters
;
...
...
@@ -250,4 +250,4 @@ void QuickOpenPlugin::refresh(QList<ILocatorFilter*> filters)
connect
(
progress
,
SIGNAL
(
finished
()),
this
,
SLOT
(
saveSettings
()));
}
Q_EXPORT_PLUGIN
(
QuickOpen
Plugin
)
Q_EXPORT_PLUGIN
(
Locator
Plugin
)
src/plugins/quickopen/
quickopen
plugin.h
→
src/plugins/quickopen/
locator
plugin.h
View file @
2d9acbc2
...
...
@@ -27,8 +27,8 @@
**
**************************************************************************/
#ifndef
QUICKOPEN
PLUGIN_H
#define
QUICKOPEN
PLUGIN_H
#ifndef
LOCATOR
PLUGIN_H
#define
LOCATOR
PLUGIN_H
#include
"ilocatorfilter.h"
#include
"directoryfilter.h"
...
...
@@ -46,15 +46,15 @@ class LocatorWidget;
class
OpenDocumentsFilter
;
class
FileSystemFilter
;
class
SettingsPage
;
class
QuickOpen
Plugin
;
class
Locator
Plugin
;
class
QuickOpen
Plugin
:
public
ExtensionSystem
::
IPlugin
class
Locator
Plugin
:
public
ExtensionSystem
::
IPlugin
{
Q_OBJECT
public:
QuickOpen
Plugin
();
~
QuickOpen
Plugin
();
Locator
Plugin
();
~
Locator
Plugin
();
bool
initialize
(
const
QStringList
&
arguments
,
QString
*
error_message
);
void
extensionsInitialized
();
...
...
@@ -94,7 +94,7 @@ private:
};
template
<
typename
S
>
void
QuickOpen
Plugin
::
loadSettingsHelper
(
S
*
settings
)
void
Locator
Plugin
::
loadSettingsHelper
(
S
*
settings
)
{
settings
->
beginGroup
(
"QuickOpen"
);
m_refreshTimer
.
setInterval
(
settings
->
value
(
"RefreshInterval"
,
60
).
toInt
()
*
60000
);
...
...
@@ -123,4 +123,4 @@ void QuickOpenPlugin::loadSettingsHelper(S *settings)
}
// namespace Internal
}
// namespace QuickOpen
#endif //
QUICKOPEN
PLUGIN_H
#endif //
LOCATOR
PLUGIN_H
src/plugins/quickopen/locatorwidget.cpp
View file @
2d9acbc2
...
...
@@ -38,7 +38,7 @@ unsigned int qHash(const QuickOpen::FilterEntry &entry);
QT_END_NAMESPACE
#include
"locatorwidget.h"
#include
"
quickopen
plugin.h"
#include
"
locator
plugin.h"
#include
"quickopenconstants.h"
#include
<extensionsystem/pluginmanager.h>
...
...
@@ -246,8 +246,8 @@ void CompletionList::updatePreferredSize()
// =========== LocatorWidget ===========
LocatorWidget
::
LocatorWidget
(
QuickOpen
Plugin
*
qop
)
:
m_
quickOpen
Plugin
(
qop
),
LocatorWidget
::
LocatorWidget
(
Locator
Plugin
*
qop
)
:
m_
locator
Plugin
(
qop
),
m_quickOpenModel
(
new
QuickOpenModel
(
this
)),
m_completionList
(
new
CompletionList
(
this
)),
m_filterMenu
(
new
QMenu
(
this
)),
...
...
@@ -293,7 +293,7 @@ LocatorWidget::LocatorWidget(QuickOpenPlugin *qop) :
m_fileLineEdit
->
setMenu
(
m_filterMenu
);
connect
(
m_refreshAction
,
SIGNAL
(
triggered
()),
m_
quickOpen
Plugin
,
SLOT
(
refresh
()));
connect
(
m_refreshAction
,
SIGNAL
(
triggered
()),
m_
locator
Plugin
,
SLOT
(
refresh
()));
connect
(
m_configureAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
showConfigureDialog
()));
connect
(
m_fileLineEdit
,
SIGNAL
(
textEdited
(
const
QString
&
)),
this
,
SLOT
(
showPopup
()));
...
...
@@ -309,7 +309,7 @@ bool LocatorWidget::isShowingTypeHereMessage() const
void
LocatorWidget
::
updateFilterList
()
{
m_filterMenu
->
clear
();
foreach
(
ILocatorFilter
*
filter
,
m_
quickOpen
Plugin
->
filters
())
{
foreach
(
ILocatorFilter
*
filter
,
m_
locator
Plugin
->
filters
())
{
if
(
!
filter
->
shortcutString
().
isEmpty
()
&&
!
filter
->
isHidden
())
{
QAction
*
action
=
m_filterMenu
->
addAction
(
filter
->
trName
(),
this
,
SLOT
(
filterSelected
()));
action
->
setData
(
qVariantFromValue
(
filter
));
...
...
@@ -374,7 +374,7 @@ void LocatorWidget::showPopup()
QList
<
ILocatorFilter
*>
LocatorWidget
::
filtersFor
(
const
QString
&
text
,
QString
&
searchText
)
{
QList
<
ILocatorFilter
*>
filters
=
m_
quickOpen
Plugin
->
filters
();
QList
<
ILocatorFilter
*>
filters
=
m_
locator
Plugin
->
filters
();
int
whiteSpace
=
text
.
indexOf
(
" "
);
QString
prefix
;
if
(
whiteSpace
>=
0
)
...
...
@@ -463,7 +463,7 @@ void LocatorWidget::filterSelected()
// add shortcut string at front or replace existing shortcut string
if
(
!
currentText
.
isEmpty
())
{
searchText
=
currentText
;
foreach
(
ILocatorFilter
*
otherfilter
,
m_
quickOpen
Plugin
->
filters
())
{
foreach
(
ILocatorFilter
*
otherfilter
,
m_
locator
Plugin
->
filters
())
{
if
(
currentText
.
startsWith
(
otherfilter
->
shortcutString
()
+
" "
))
{
searchText
=
currentText
.
mid
(
otherfilter
->
shortcutString
().
length
()
+
1
);
break
;
...
...
src/plugins/quickopen/locatorwidget.h
View file @
2d9acbc2
...
...
@@ -30,7 +30,7 @@
#ifndef LOCATORWIDGET_H
#define LOCATORWIDGET_H
#include
"
quickopen
plugin.h"
#include
"
locator
plugin.h"
#include
<QtCore/QEvent>
#include
<QtGui/QWidget>
...
...
@@ -59,7 +59,7 @@ class LocatorWidget
Q_OBJECT
public:
LocatorWidget
(
QuickOpen
Plugin
*
qop
);
LocatorWidget
(
Locator
Plugin
*
qop
);
void
updateFilterList
();
...
...
@@ -81,7 +81,7 @@ private:
void
updateCompletionList
(
const
QString
&
text
);
QList
<
ILocatorFilter
*>
filtersFor
(
const
QString
&
text
,
QString
&
searchText
);
QuickOpen
Plugin
*
m_
quickOpen
Plugin
;
Locator
Plugin
*
m_
locator
Plugin
;
QuickOpenModel
*
m_quickOpenModel
;
CompletionList
*
m_completionList
;
...
...
src/plugins/quickopen/quickopen.pro
View file @
2d9acbc2
...
...
@@ -3,7 +3,7 @@ TARGET = QuickOpen
DEFINES
+=
QUICKOPEN_LIBRARY
include
(..
/../
qtcreatorplugin
.
pri
)
include
(
quickopen_dependencies
.
pri
)
HEADERS
+=
quickopen
plugin
.
h
\
HEADERS
+=
locator
plugin
.
h
\
locatorwidget
.
h
\
quickopenfiltersfilter
.
h
\
settingspage
.
h
\
...
...
@@ -15,7 +15,7 @@ HEADERS += quickopenplugin.h \
locatormanager
.
h
\
basefilefilter
.
h
\
quickopen_global
.
h
SOURCES
+=
quickopen
plugin
.
cpp
\
SOURCES
+=
locator
plugin
.
cpp
\
locatorwidget
.
cpp
\
quickopenfiltersfilter
.
cpp
\
opendocumentsfilter
.
cpp
\
...
...
src/plugins/quickopen/quickopenfiltersfilter.cpp
View file @
2d9acbc2
...
...
@@ -28,7 +28,7 @@
**************************************************************************/
#include
"quickopenfiltersfilter.h"
#include
"
quickopen
plugin.h"
#include
"
locator
plugin.h"
#include
"locatorwidget.h"
#include
<coreplugin/coreconstants.h>
...
...
@@ -38,7 +38,7 @@ using namespace QuickOpen::Internal;
Q_DECLARE_METATYPE
(
ILocatorFilter
*
);
QuickOpenFiltersFilter
::
QuickOpenFiltersFilter
(
QuickOpen
Plugin
*
plugin
,
QuickOpenFiltersFilter
::
QuickOpenFiltersFilter
(
Locator
Plugin
*
plugin
,
LocatorWidget
*
locatorWidget
)
:
m_plugin
(
plugin
),
m_locatorWidget
(
locatorWidget
),
...
...
src/plugins/quickopen/quickopenfiltersfilter.h
View file @
2d9acbc2
...
...
@@ -37,7 +37,7 @@
namespace
QuickOpen
{
namespace
Internal
{
class
QuickOpen
Plugin
;
class
Locator
Plugin
;
class
LocatorWidget
;
/*!
...
...
@@ -49,7 +49,7 @@ class QuickOpenFiltersFilter : public ILocatorFilter
Q_OBJECT
public:
QuickOpenFiltersFilter
(
QuickOpen
Plugin
*
plugin
,
QuickOpenFiltersFilter
(
Locator
Plugin
*
plugin
,
LocatorWidget
*
locatorWidget
);
// ILocatorFilter
...
...
@@ -62,7 +62,7 @@ public:
bool
isConfigurable
()
const
;
private:
QuickOpen
Plugin
*
m_plugin
;
Locator
Plugin
*
m_plugin
;
LocatorWidget
*
m_locatorWidget
;
QIcon
m_icon
;
};
...
...
src/plugins/quickopen/settingspage.cpp
View file @
2d9acbc2
...
...
@@ -30,7 +30,7 @@
#include
"settingspage.h"
#include
"quickopenconstants.h"
#include
"
quickopen
plugin.h"
#include
"
locator
plugin.h"
#include
"ilocatorfilter.h"
#include
"directoryfilter.h"
...
...
@@ -44,7 +44,7 @@ Q_DECLARE_METATYPE(QuickOpen::ILocatorFilter*)
using
namespace
QuickOpen
;
using
namespace
QuickOpen
::
Internal
;
SettingsPage
::
SettingsPage
(
QuickOpen
Plugin
*
plugin
)
SettingsPage
::
SettingsPage
(
Locator
Plugin
*
plugin
)
:
m_plugin
(
plugin
),
m_page
(
0
)
{
}
...
...
src/plugins/quickopen/settingspage.h
View file @
2d9acbc2
...
...
@@ -47,14 +47,14 @@ class ILocatorFilter;
namespace
Internal
{
class
QuickOpen
Plugin
;
class
Locator
Plugin
;
class
SettingsPage
:
public
Core
::
IOptionsPage
{
Q_OBJECT
public:
explicit
SettingsPage
(
QuickOpen
Plugin
*
plugin
);
explicit
SettingsPage
(
Locator
Plugin
*
plugin
);
QString
id
()
const
;
QString
trName
()
const
;
QString
category
()
const
;
...
...
@@ -77,7 +77,7 @@ private:
void
requestRefresh
();
Ui
::
SettingsWidget
m_ui
;
QuickOpen
Plugin
*
m_plugin
;
Locator
Plugin
*
m_plugin
;
QWidget
*
m_page
;
QList
<
ILocatorFilter
*>
m_filters
;
QList
<
ILocatorFilter
*>
m_addedFilters
;
...
...
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