forked from qt-creator/qt-creator
QtSupport: style
Change-Id: Iabf3c96fc6d6b17282ec2ad43f32f76b04ac2ef0 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -524,10 +524,9 @@ void ExamplesListModelFilter::updateFilter()
|
||||
|
||||
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;
|
||||
|
||||
@@ -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,
|
||||
enum ExampleRoles
|
||||
{
|
||||
Name = Qt::UserRole, ProjectPath, Description, ImageUrl,
|
||||
DocUrl, FilesToOpen, Tags, Difficulty, HasSourceCode,
|
||||
Type, Dependencies, IsVideo, VideoUrl, VideoLength, Platforms };
|
||||
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();
|
||||
@@ -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,8 +126,8 @@ 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)
|
||||
@@ -147,15 +153,11 @@ public slots:
|
||||
|
||||
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;
|
||||
|
||||
@@ -87,6 +87,7 @@ QPointer<ExamplesListModel> &examplesModelStatic()
|
||||
class Fetcher : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Fetcher() : QObject(), m_shutdown(false)
|
||||
{
|
||||
|
||||
@@ -65,6 +65,7 @@ private:
|
||||
class ExamplesWelcomePage : public Utils::IWelcomePage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ExamplesWelcomePage();
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user