summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhjk <qthjk@ovi.com>2012-11-26 08:35:57 +0100
committerhjk <qthjk@ovi.com>2012-11-27 09:00:34 +0100
commit6cae330ec771b44165ac14a71707b68e408d57a8 (patch)
treedaa76e19a6d2509bb10a042735644372151ce5b3
parentf4a06ffd06970a19bb9ecc7eff0d915d9ead8c2b (diff)
downloadqt-creator-6cae330ec771b44165ac14a71707b68e408d57a8.tar.gz
QtSupport: style
Change-Id: Iabf3c96fc6d6b17282ec2ad43f32f76b04ac2ef0 Reviewed-by: hjk <qthjk@ovi.com>
-rw-r--r--src/plugins/qtsupport/exampleslistmodel.cpp15
-rw-r--r--src/plugins/qtsupport/exampleslistmodel.h62
-rw-r--r--src/plugins/qtsupport/gettingstartedwelcomepage.cpp1
-rw-r--r--src/plugins/qtsupport/gettingstartedwelcomepage.h1
-rw-r--r--src/plugins/qtsupport/qtkitinformation.h9
5 files changed, 46 insertions, 42 deletions
diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp
index b59733efee..e590a704eb 100644
--- a/src/plugins/qtsupport/exampleslistmodel.cpp
+++ b/src/plugins/qtsupport/exampleslistmodel.cpp
@@ -101,7 +101,7 @@ static inline QStringList trimStringList(const QStringList &stringlist)
return returnList;
}
-QList<ExampleItem> ExamplesListModel::parseExamples(QXmlStreamReader* reader, const QString& projectsOffset)
+QList<ExampleItem> ExamplesListModel::parseExamples(QXmlStreamReader *reader, const QString &projectsOffset)
{
QList<ExampleItem> examples;
ExampleItem item;
@@ -149,7 +149,7 @@ QList<ExampleItem> ExamplesListModel::parseExamples(QXmlStreamReader* reader, co
return examples;
}
-QList<ExampleItem> ExamplesListModel::parseDemos(QXmlStreamReader* reader, const QString& projectsOffset)
+QList<ExampleItem> ExamplesListModel::parseDemos(QXmlStreamReader *reader, const QString &projectsOffset)
{
QList<ExampleItem> demos;
ExampleItem item;
@@ -522,12 +522,11 @@ void ExamplesListModelFilter::updateFilter()
}
}
-bool containsSubString(const QStringList& list, const QString& substr, Qt::CaseSensitivity cs)
+bool containsSubString(const QStringList &list, const QString &substr, Qt::CaseSensitivity cs)
{
- foreach (const QString &elem, list) {
+ foreach (const QString &elem, list)
if (elem.contains(substr, cs))
return true;
- }
return false;
}
@@ -549,10 +548,9 @@ bool ExamplesListModelFilter::filterAcceptsRow(int sourceRow, const QModelIndex
const QStringList tags = sourceModel()->index(sourceRow, 0, sourceParent).data(Tags).toStringList();
if (!m_filterTags.isEmpty()) {
- foreach(const QString &tag, m_filterTags) {
+ foreach(const QString &tag, m_filterTags)
if (!tags.contains(tag, Qt::CaseInsensitive))
return false;
- }
return true;
}
@@ -617,7 +615,8 @@ void ExamplesListModelFilter::timerEvent(QTimerEvent *timerEvent)
}
}
-struct SearchStringLexer {
+struct SearchStringLexer
+{
QString code;
const QChar *codePtr;
QChar yychar;
diff --git a/src/plugins/qtsupport/exampleslistmodel.h b/src/plugins/qtsupport/exampleslistmodel.h
index f76f239f83..b181810ce7 100644
--- a/src/plugins/qtsupport/exampleslistmodel.h
+++ b/src/plugins/qtsupport/exampleslistmodel.h
@@ -31,20 +31,27 @@
#define EXAMPLESLISTMODEL_H
#include <QAbstractListModel>
+#include <QSortFilterProxyModel>
#include <QStringList>
#include <QXmlStreamReader>
-#include <QSortFilterProxyModel>
namespace QtSupport {
namespace Internal {
-enum ExampleRoles { Name=Qt::UserRole, ProjectPath, Description, ImageUrl,
- DocUrl, FilesToOpen, Tags, Difficulty, HasSourceCode,
- Type, Dependencies, IsVideo, VideoUrl, VideoLength, Platforms };
+enum ExampleRoles
+{
+ Name = Qt::UserRole, ProjectPath, Description, ImageUrl,
+ DocUrl, FilesToOpen, Tags, Difficulty, HasSourceCode,
+ Type, Dependencies, IsVideo, VideoUrl, VideoLength, Platforms
+};
-enum InstructionalType { Example=0, Demo, Tutorial };
+enum InstructionalType
+{
+ Example = 0, Demo, Tutorial
+};
-struct ExampleItem {
+struct ExampleItem
+{
ExampleItem(): difficulty(0), isVideo(false) {}
InstructionalType type;
QString name;
@@ -63,24 +70,21 @@ struct ExampleItem {
QStringList platforms;
};
-class ExamplesListModel : public QAbstractListModel {
+class ExamplesListModel : public QAbstractListModel
+{
Q_OBJECT
+
public:
explicit ExamplesListModel(QObject *parent);
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QStringList tags() const;
-
-
void ensureInitialized() const;
- void beginReset()
- { beginResetModel(); }
-
- void endReset()
- { endResetModel(); }
+ void beginReset() { beginResetModel(); }
+ void endReset() { endResetModel(); }
signals:
void tagsUpdated();
@@ -92,9 +96,9 @@ public slots:
private:
void addItems(const QList<ExampleItem> &items);
- QList<ExampleItem> parseExamples(QXmlStreamReader* reader, const QString& projectsOffset);
- QList<ExampleItem> parseDemos(QXmlStreamReader* reader, const QString& projectsOffset);
- QList<ExampleItem> parseTutorials(QXmlStreamReader* reader, const QString& projectsOffset);
+ QList<ExampleItem> parseExamples(QXmlStreamReader *reader, const QString &projectsOffset);
+ QList<ExampleItem> parseDemos(QXmlStreamReader *reader, const QString &projectsOffset);
+ QList<ExampleItem> parseTutorials(QXmlStreamReader *reader, const QString &projectsOffset);
void clear();
QStringList exampleSources(QString *examplesFallback, QString *demosFallback,
QString *sourceFallback);
@@ -105,8 +109,10 @@ private:
bool m_helpInitialized;
};
-class ExamplesListModelFilter : public QSortFilterProxyModel {
+class ExamplesListModelFilter : public QSortFilterProxyModel
+{
Q_OBJECT
+
public:
Q_PROPERTY(bool showTutorialsOnly READ showTutorialsOnly WRITE setShowTutorialsOnly NOTIFY showTutorialsOnlyChanged)
Q_PROPERTY(QStringList filterTags READ filterTags WRITE setFilterTags NOTIFY filterTagsChanged)
@@ -120,11 +126,11 @@ public:
QStringList filterTags() const { return m_filterTags; }
QStringList searchStrings() const { return m_searchString; }
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
public slots:
- void setFilterTags(const QStringList& arg)
+ void setFilterTags(const QStringList &arg)
{
if (m_filterTags != arg) {
m_filterTags = arg;
@@ -133,7 +139,7 @@ public slots:
}
void updateFilter();
- void setSearchStrings(const QStringList& arg)
+ void setSearchStrings(const QStringList &arg)
{
if (m_searchString != arg) {
m_searchString = arg;
@@ -142,20 +148,16 @@ public slots:
}
}
- void parseSearchString(const QString& arg);
+ void parseSearchString(const QString &arg);
void setShowTutorialsOnly(bool showTutorialsOnly);
signals:
void showTutorialsOnlyChanged();
-
void filterTagsChanged(const QStringList& arg);
-
void searchStrings(const QStringList& arg);
-protected:
- void timerEvent(QTimerEvent *event);
-
private:
+ void timerEvent(QTimerEvent *event);
void delayedUpdateFilter();
bool m_showTutorialsOnly;
diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp
index 2d562ab065..b2c205f101 100644
--- a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp
+++ b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp
@@ -87,6 +87,7 @@ QPointer<ExamplesListModel> &examplesModelStatic()
class Fetcher : public QObject
{
Q_OBJECT
+
public:
Fetcher() : QObject(), m_shutdown(false)
{
diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.h b/src/plugins/qtsupport/gettingstartedwelcomepage.h
index 2ce092982e..e75efb95ec 100644
--- a/src/plugins/qtsupport/gettingstartedwelcomepage.h
+++ b/src/plugins/qtsupport/gettingstartedwelcomepage.h
@@ -65,6 +65,7 @@ private:
class ExamplesWelcomePage : public Utils::IWelcomePage
{
Q_OBJECT
+
public:
ExamplesWelcomePage();
diff --git a/src/plugins/qtsupport/qtkitinformation.h b/src/plugins/qtsupport/qtkitinformation.h
index 508c21f246..b7ba52e027 100644
--- a/src/plugins/qtsupport/qtkitinformation.h
+++ b/src/plugins/qtsupport/qtkitinformation.h
@@ -32,10 +32,10 @@
#include "qtsupport_global.h"
-#include <projectexplorer/kitinformation.h>
-
#include "baseqtversion.h"
+#include <projectexplorer/kitinformation.h>
+
namespace QtSupport {
class QTSUPPORT_EXPORT QtKitInformation : public ProjectExplorer::KitInformation
@@ -67,6 +67,7 @@ public:
static void setQtVersionId(ProjectExplorer::Kit *k, const int id);
static BaseQtVersion *qtVersion(const ProjectExplorer::Kit *k);
static void setQtVersion(ProjectExplorer::Kit *k, const BaseQtVersion *v);
+
private slots:
void qtVersionsChanged(const QList<int> &addedIds,
const QList<int> &removedIds,
@@ -88,8 +89,8 @@ class QTSUPPORT_EXPORT QtVersionKitMatcher : public ProjectExplorer::KitMatcher
{
public:
explicit QtVersionKitMatcher(const Core::FeatureSet &required = Core::FeatureSet(),
- const QtVersionNumber &min = QtVersionNumber(0, 0, 0),
- const QtVersionNumber &max = QtVersionNumber(INT_MAX, INT_MAX, INT_MAX)) :
+ const QtVersionNumber &min = QtVersionNumber(0, 0, 0),
+ const QtVersionNumber &max = QtVersionNumber(INT_MAX, INT_MAX, INT_MAX)) :
m_min(min), m_max(max), m_features(required)
{ }