forked from qt-creator/qt-creator
Todo: Modernize
modernize-* Change-Id: Ib03e15cac77fa15d51f18e3351462a0c5a9ab224 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -36,10 +36,10 @@ namespace Internal {
|
|||||||
class CppTodoItemsScanner : public TodoItemsScanner
|
class CppTodoItemsScanner : public TodoItemsScanner
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CppTodoItemsScanner(const KeywordList &keywordList, QObject *parent = 0);
|
explicit CppTodoItemsScanner(const KeywordList &keywordList, QObject *parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void scannerParamsChanged();
|
void scannerParamsChanged() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void documentUpdated(CPlusPlus::Document::Ptr doc);
|
void documentUpdated(CPlusPlus::Document::Ptr doc);
|
||||||
|
@@ -47,7 +47,7 @@ public:
|
|||||||
bool equals(const Keyword &other) const;
|
bool equals(const Keyword &other) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QList<Keyword> KeywordList;
|
using KeywordList = QList<Keyword>;
|
||||||
|
|
||||||
bool operator ==(Keyword &k1, Keyword &k2);
|
bool operator ==(Keyword &k1, Keyword &k2);
|
||||||
bool operator !=(Keyword &k1, Keyword &k2);
|
bool operator !=(Keyword &k1, Keyword &k2);
|
||||||
|
@@ -142,8 +142,8 @@ bool KeywordDialog::isKeywordNameCorrect()
|
|||||||
if (name.isEmpty())
|
if (name.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (int i = 0; i < name.size(); ++i)
|
for (const QChar i : name)
|
||||||
if (LineParser::isKeywordSeparator(name.at(i)))
|
if (LineParser::isKeywordSeparator(i))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@@ -42,8 +42,8 @@ class KeywordDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
KeywordDialog(const Keyword &keyword, const QSet<QString> &alreadyUsedKeywordNames,
|
KeywordDialog(const Keyword &keyword, const QSet<QString> &alreadyUsedKeywordNames,
|
||||||
QWidget *parent = 0);
|
QWidget *parent = nullptr);
|
||||||
~KeywordDialog();
|
~KeywordDialog() override;
|
||||||
|
|
||||||
Keyword keyword();
|
Keyword keyword();
|
||||||
|
|
||||||
|
@@ -47,7 +47,7 @@ private:
|
|||||||
|
|
||||||
// map key here is keyword start position in the text line
|
// map key here is keyword start position in the text line
|
||||||
// and map value is keyword index in m_keywords
|
// and map value is keyword index in m_keywords
|
||||||
typedef QMap<int, int> KeywordEntryCandidates;
|
using KeywordEntryCandidates = QMap<int, int> ;
|
||||||
|
|
||||||
struct KeywordEntry {
|
struct KeywordEntry {
|
||||||
int keywordIndex;
|
int keywordIndex;
|
||||||
|
@@ -43,8 +43,8 @@ class Keyword;
|
|||||||
class OptionsDialog : public QWidget
|
class OptionsDialog : public QWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit OptionsDialog(QWidget *parent = 0);
|
explicit OptionsDialog(QWidget *parent = nullptr);
|
||||||
~OptionsDialog();
|
~OptionsDialog() override;
|
||||||
|
|
||||||
void setSettings(const Settings &settings);
|
void setSettings(const Settings &settings);
|
||||||
Settings settings();
|
Settings settings();
|
||||||
|
@@ -34,14 +34,13 @@
|
|||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
Todo::Internal::OptionsDialog *some = 0;
|
Todo::Internal::OptionsDialog *some = nullptr;
|
||||||
|
|
||||||
namespace Todo {
|
namespace Todo {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
OptionsPage::OptionsPage(const Settings &settings, QObject *parent) :
|
OptionsPage::OptionsPage(const Settings &settings, QObject *parent) :
|
||||||
IOptionsPage(parent),
|
IOptionsPage(parent)
|
||||||
m_widget(0)
|
|
||||||
{
|
{
|
||||||
setSettings(settings);
|
setSettings(settings);
|
||||||
|
|
||||||
|
@@ -42,13 +42,13 @@ class OptionsPage : public Core::IOptionsPage
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OptionsPage(const Settings &settings, QObject *parent = 0);
|
OptionsPage(const Settings &settings, QObject *parent = nullptr);
|
||||||
|
|
||||||
void setSettings(const Settings &settings);
|
void setSettings(const Settings &settings);
|
||||||
|
|
||||||
QWidget *widget();
|
QWidget *widget() override;
|
||||||
void apply();
|
void apply() override;
|
||||||
void finish();
|
void finish() override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void settingsChanged(const Settings &settings);
|
void settingsChanged(const Settings &settings);
|
||||||
|
@@ -36,7 +36,7 @@ namespace Internal {
|
|||||||
class QmlJsTodoItemsScanner : public TodoItemsScanner
|
class QmlJsTodoItemsScanner : public TodoItemsScanner
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit QmlJsTodoItemsScanner(const KeywordList &keywordList, QObject *parent = 0);
|
explicit QmlJsTodoItemsScanner(const KeywordList &keywordList, QObject *parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool shouldProcessFile(const QString &fileName);
|
bool shouldProcessFile(const QString &fileName);
|
||||||
|
@@ -41,12 +41,10 @@ namespace Internal {
|
|||||||
class TodoItem
|
class TodoItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TodoItem() : line(-1) {}
|
|
||||||
|
|
||||||
QString text;
|
QString text;
|
||||||
Utils::FileName file;
|
Utils::FileName file;
|
||||||
int line;
|
int line = -1;
|
||||||
IconType iconType;
|
IconType iconType = IconType::Todo;
|
||||||
QColor color;
|
QColor color;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -40,9 +40,7 @@ namespace Internal {
|
|||||||
|
|
||||||
TodoItemsModel::TodoItemsModel(QObject *parent) :
|
TodoItemsModel::TodoItemsModel(QObject *parent) :
|
||||||
QAbstractTableModel(parent),
|
QAbstractTableModel(parent),
|
||||||
m_todoItemsList(0),
|
m_currentSortColumn(Constants::OutputColumnIndex(0))
|
||||||
m_currentSortColumn(Constants::OutputColumnIndex(0)),
|
|
||||||
m_currentSortOrder(Qt::AscendingOrder)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,22 +39,22 @@ class TodoItemsModel : public QAbstractTableModel
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TodoItemsModel(QObject *parent = 0);
|
explicit TodoItemsModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
void setTodoItemsList(QList<TodoItem> *list);
|
void setTodoItemsList(QList<TodoItem> *list);
|
||||||
|
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
QVariant data(const QModelIndex &index, int role) const;
|
QVariant data(const QModelIndex &index, int role) const override;
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||||
|
|
||||||
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
|
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
|
||||||
void todoItemsListUpdated();
|
void todoItemsListUpdated();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<TodoItem> *m_todoItemsList;
|
QList<TodoItem> *m_todoItemsList = nullptr;
|
||||||
Constants::OutputColumnIndex m_currentSortColumn;
|
Constants::OutputColumnIndex m_currentSortColumn;
|
||||||
Qt::SortOrder m_currentSortOrder;
|
Qt::SortOrder m_currentSortOrder = Qt::AscendingOrder;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -46,7 +46,7 @@ class TodoItemsProvider : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TodoItemsProvider(Settings settings, QObject *parent = 0);
|
explicit TodoItemsProvider(Settings settings, QObject *parent = nullptr);
|
||||||
TodoItemsModel *todoItemsModel();
|
TodoItemsModel *todoItemsModel();
|
||||||
|
|
||||||
void settingsChanged(const Settings &newSettings);
|
void settingsChanged(const Settings &newSettings);
|
||||||
|
@@ -41,7 +41,7 @@ class TodoItemsScanner : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TodoItemsScanner(const KeywordList &keywordList, QObject *parent = 0);
|
explicit TodoItemsScanner(const KeywordList &keywordList, QObject *parent = nullptr);
|
||||||
void setParams(const KeywordList &keywordList);
|
void setParams(const KeywordList &keywordList);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@@ -193,7 +193,7 @@ void TodoOutputPane::updateTodoCount()
|
|||||||
void TodoOutputPane::updateFilter()
|
void TodoOutputPane::updateFilter()
|
||||||
{
|
{
|
||||||
QStringList keywords;
|
QStringList keywords;
|
||||||
for (QToolButton *btn: m_filterButtons) {
|
for (const QToolButton *btn: qAsConst(m_filterButtons)) {
|
||||||
if (btn->isChecked())
|
if (btn->isChecked())
|
||||||
keywords.append(btn->property(Constants::FILTER_KEYWORD_NAME).toString());
|
keywords.append(btn->property(Constants::FILTER_KEYWORD_NAME).toString());
|
||||||
}
|
}
|
||||||
@@ -210,7 +210,7 @@ void TodoOutputPane::updateFilter()
|
|||||||
|
|
||||||
void TodoOutputPane::clearFilter()
|
void TodoOutputPane::clearFilter()
|
||||||
{
|
{
|
||||||
for (QToolButton *btn: m_filterButtons)
|
for (QToolButton *btn: qAsConst(m_filterButtons))
|
||||||
btn->setChecked(false);
|
btn->setChecked(false);
|
||||||
|
|
||||||
updateFilter();
|
updateFilter();
|
||||||
@@ -225,7 +225,7 @@ void TodoOutputPane::createTreeView()
|
|||||||
|
|
||||||
m_todoTreeView = new TodoOutputTreeView();
|
m_todoTreeView = new TodoOutputTreeView();
|
||||||
m_todoTreeView->setModel(m_filteredTodoItemsModel);
|
m_todoTreeView->setModel(m_filteredTodoItemsModel);
|
||||||
Aggregation::Aggregate *agg = new Aggregation::Aggregate;
|
auto agg = new Aggregation::Aggregate;
|
||||||
agg->add(m_todoTreeView);
|
agg->add(m_todoTreeView);
|
||||||
agg->add(new Core::ItemViewFind(m_todoTreeView));
|
agg->add(new Core::ItemViewFind(m_todoTreeView));
|
||||||
|
|
||||||
@@ -240,7 +240,7 @@ void TodoOutputPane::freeTreeView()
|
|||||||
|
|
||||||
QToolButton *TodoOutputPane::createCheckableToolButton(const QString &text, const QString &toolTip, const QIcon &icon)
|
QToolButton *TodoOutputPane::createCheckableToolButton(const QString &text, const QString &toolTip, const QIcon &icon)
|
||||||
{
|
{
|
||||||
QToolButton *button = new QToolButton();
|
auto button = new QToolButton;
|
||||||
|
|
||||||
button->setCheckable(true);
|
button->setCheckable(true);
|
||||||
button->setText(text);
|
button->setText(text);
|
||||||
|
@@ -45,30 +45,30 @@ class TodoItem;
|
|||||||
class TodoItemsModel;
|
class TodoItemsModel;
|
||||||
class TodoOutputTreeView;
|
class TodoOutputTreeView;
|
||||||
|
|
||||||
typedef QList<QToolButton*> QToolButtonList;
|
using QToolButtonList = QList<QToolButton *>;
|
||||||
|
|
||||||
class TodoOutputPane : public Core::IOutputPane
|
class TodoOutputPane : public Core::IOutputPane
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TodoOutputPane(TodoItemsModel *todoItemsModel, const Settings *settings, QObject *parent = 0);
|
TodoOutputPane(TodoItemsModel *todoItemsModel, const Settings *settings, QObject *parent = nullptr);
|
||||||
~TodoOutputPane();
|
~TodoOutputPane() override;
|
||||||
|
|
||||||
QWidget *outputWidget(QWidget *parent);
|
QWidget *outputWidget(QWidget *parent) override;
|
||||||
QList<QWidget*> toolBarWidgets() const;
|
QList<QWidget*> toolBarWidgets() const override;
|
||||||
QString displayName() const;
|
QString displayName() const override;
|
||||||
int priorityInStatusBar() const;
|
int priorityInStatusBar() const override;
|
||||||
void clearContents();
|
void clearContents() override;
|
||||||
void visibilityChanged(bool visible);
|
void visibilityChanged(bool visible) override;
|
||||||
void setFocus();
|
void setFocus() override;
|
||||||
bool hasFocus() const;
|
bool hasFocus() const override;
|
||||||
bool canFocus() const;
|
bool canFocus() const override;
|
||||||
bool canNavigate() const;
|
bool canNavigate() const override;
|
||||||
bool canNext() const;
|
bool canNext() const override;
|
||||||
bool canPrevious() const;
|
bool canPrevious() const override;
|
||||||
void goToNext();
|
void goToNext() override;
|
||||||
void goToPrev();
|
void goToPrev() override;
|
||||||
|
|
||||||
void setScanningScope(ScanningScope scanningScope);
|
void setScanningScope(ScanningScope scanningScope);
|
||||||
|
|
||||||
|
@@ -37,9 +37,7 @@ namespace Todo {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
TodoOutputTreeView::TodoOutputTreeView(QWidget *parent) :
|
TodoOutputTreeView::TodoOutputTreeView(QWidget *parent) :
|
||||||
Utils::TreeView(parent),
|
Utils::TreeView(parent)
|
||||||
m_textColumnDefaultWidth(0),
|
|
||||||
m_fileColumnDefaultWidth(0)
|
|
||||||
{
|
{
|
||||||
setRootIsDecorated(false);
|
setRootIsDecorated(false);
|
||||||
setFrameStyle(QFrame::NoFrame);
|
setFrameStyle(QFrame::NoFrame);
|
||||||
|
@@ -33,10 +33,10 @@ namespace Internal {
|
|||||||
class TodoOutputTreeView : public Utils::TreeView
|
class TodoOutputTreeView : public Utils::TreeView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit TodoOutputTreeView(QWidget *parent = 0);
|
explicit TodoOutputTreeView(QWidget *parent = nullptr);
|
||||||
~TodoOutputTreeView();
|
~TodoOutputTreeView() override;
|
||||||
|
|
||||||
void resizeEvent(QResizeEvent *event);
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void todoColumnResized(int column, int oldSize, int newSize);
|
void todoColumnResized(int column, int oldSize, int newSize);
|
||||||
@@ -44,8 +44,8 @@ private:
|
|||||||
void saveDisplaySettings();
|
void saveDisplaySettings();
|
||||||
void loadDisplaySettings();
|
void loadDisplaySettings();
|
||||||
|
|
||||||
qreal m_textColumnDefaultWidth;
|
qreal m_textColumnDefaultWidth = 0.0;
|
||||||
qreal m_fileColumnDefaultWidth;
|
qreal m_fileColumnDefaultWidth = 0.0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -34,7 +34,7 @@ class TodoOutputTreeViewDelegate : public QStyledItemDelegate
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit TodoOutputTreeViewDelegate(QObject *parent = 0);
|
explicit TodoOutputTreeViewDelegate(QObject *parent = nullptr);
|
||||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -45,17 +45,12 @@
|
|||||||
namespace Todo {
|
namespace Todo {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
TodoPlugin::TodoPlugin() :
|
TodoPlugin::TodoPlugin()
|
||||||
m_todoOutputPane(0),
|
|
||||||
m_optionsPage(0),
|
|
||||||
m_todoItemsProvider(0)
|
|
||||||
{
|
{
|
||||||
qRegisterMetaType<TodoItem>("TodoItem");
|
qRegisterMetaType<TodoItem>("TodoItem");
|
||||||
}
|
}
|
||||||
|
|
||||||
TodoPlugin::~TodoPlugin()
|
TodoPlugin::~TodoPlugin() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TodoPlugin::initialize(const QStringList& args, QString *errMsg)
|
bool TodoPlugin::initialize(const QStringList& args, QString *errMsg)
|
||||||
{
|
{
|
||||||
|
@@ -45,10 +45,10 @@ class TodoPlugin : public ExtensionSystem::IPlugin
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
TodoPlugin();
|
TodoPlugin();
|
||||||
~TodoPlugin();
|
~TodoPlugin() override;
|
||||||
|
|
||||||
void extensionsInitialized();
|
void extensionsInitialized() override;
|
||||||
bool initialize(const QStringList &arguments, QString *errorString);
|
bool initialize(const QStringList &arguments, QString *errorString) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void settingsChanged(const Settings &settings);
|
void settingsChanged(const Settings &settings);
|
||||||
@@ -59,9 +59,9 @@ private:
|
|||||||
void createOptionsPage();
|
void createOptionsPage();
|
||||||
|
|
||||||
Settings m_settings;
|
Settings m_settings;
|
||||||
TodoOutputPane *m_todoOutputPane;
|
TodoOutputPane *m_todoOutputPane = nullptr;
|
||||||
OptionsPage *m_optionsPage;
|
OptionsPage *m_optionsPage = nullptr;
|
||||||
TodoItemsProvider *m_todoItemsProvider;
|
TodoItemsProvider *m_todoItemsProvider = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -63,7 +63,7 @@ TodoProjectSettingsWidget::~TodoProjectSettingsWidget()
|
|||||||
|
|
||||||
QListWidgetItem *TodoProjectSettingsWidget::addToExcludedPatternsList(const QString &pattern)
|
QListWidgetItem *TodoProjectSettingsWidget::addToExcludedPatternsList(const QString &pattern)
|
||||||
{
|
{
|
||||||
QListWidgetItem *item = new QListWidgetItem(pattern);
|
auto item = new QListWidgetItem(pattern);
|
||||||
item->setFlags(item->flags() | Qt::ItemIsEditable);
|
item->setFlags(item->flags() | Qt::ItemIsEditable);
|
||||||
prepareItem(item);
|
prepareItem(item);
|
||||||
ui->excludedPatternsList->addItem(item);
|
ui->excludedPatternsList->addItem(item);
|
||||||
|
@@ -48,7 +48,7 @@ class TodoProjectSettingsWidget : public QWidget
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TodoProjectSettingsWidget(ProjectExplorer::Project *project);
|
explicit TodoProjectSettingsWidget(ProjectExplorer::Project *project);
|
||||||
~TodoProjectSettingsWidget();
|
~TodoProjectSettingsWidget() override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void projectSettingsChanged();
|
void projectSettingsChanged();
|
||||||
|
Reference in New Issue
Block a user