Commit 8c9a4647 authored by Denis Steckelmacher's avatar Denis Steckelmacher
Browse files

Fix coding style and add some comments before merging into master

REVIEW: 119897
parent 086f3059
/* This file is part of the Nepomuk widgets collection
/* This file is part of the Baloo widgets collection
Copyright (c) 2013 Denis Steckelmacher <steckdenis@yahoo.fr>
This library is free software; you can redistribute it and/or
......@@ -199,10 +199,9 @@ void GroupedLineEdit::paintEvent(QPaintEvent *e)
painter.setBrush(color.lighter(180));
painter.drawPath(path);
color_index = (color_index + 1) & 0x7;
color_index = (color_index + 1) & 0x7; // Increment color_index, modulo 8 so that it does not overflow colors
}
QPlainTextEdit::paintEvent(e);
}
#include "groupedlineedit.moc"
......@@ -42,87 +42,87 @@ namespace Baloo {
*/
class BALOO_WIDGETS_EXPORT GroupedLineEdit : public QPlainTextEdit
{
Q_OBJECT
public:
explicit GroupedLineEdit(QWidget *parent = 0);
virtual ~GroupedLineEdit();
/**
* Text displayed in this control. Use this method instead of
* toPlainText() as it is garanteed that this method will return exactly
* what the user sees.
*/
QString text() const;
/**
* Current cursor position. The cursor position starts at 0 when the
* cursor is completely at the left of the control (for right-to-left
* languages) and goes to text().length() when the cursor is completely
* at the right of the control.
*/
int cursorPosition() const;
/**
* Set the cursor position
*
* \sa cursorPosition
*/
void setCursorPosition(int position);
/**
* Set the text dislayed by the control. Calling this method removes all
* the blocks.
*
* \sa text
* \sa removeAllBlocks
*/
void setText(const QString &text);
/**
* Clear the text and the blocks contained in the widget.
*/
void clear();
/**
* Select all the text present in the control.
*/
void selectAll();
/**
* Remove all the blocks that were present in the control. The text is
* not changed, but no block will be drawn any more.
*/
void removeAllBlocks();
/**
* Add a block to the control. A block represents a group and is
* identified by the indexes of the first and the last characters in it.
* These limits are inclusive.
*
* The control maintains a list of block colors, that are cycled through
* at each block insertion. If you want the blocks to always have the
* same color even if they are removed and then re-added, always add
* them in the same order.
*/
void addBlock(int start, int end);
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
Q_SIGNALS:
/**
* Signal triggered when the user presses Enter or Return in the control
*/
void editingFinished();
protected:
virtual void paintEvent(QPaintEvent *e);
virtual void keyPressEvent(QKeyEvent *e);
private:
struct Private;
Private *d;
Q_OBJECT
public:
explicit GroupedLineEdit(QWidget *parent = 0);
virtual ~GroupedLineEdit();
/**
* Text displayed in this control. Use this method instead of
* toPlainText() as it is garanteed that this method will return exactly
* what the user sees.
*/
QString text() const;
/**
* Current cursor position. The cursor position starts at 0 when the
* cursor is completely at the left of the control (for right-to-left
* languages) and goes to text().length() when the cursor is completely
* at the right of the control.
*/
int cursorPosition() const;
/**
* Set the cursor position
*
* \sa cursorPosition
*/
void setCursorPosition(int position);
/**
* Set the text dislayed by the control. Calling this method removes all
* the blocks.
*
* \sa text
* \sa removeAllBlocks
*/
void setText(const QString &text);
/**
* Clear the text and the blocks contained in the widget.
*/
void clear();
/**
* Select all the text present in the control.
*/
void selectAll();
/**
* Remove all the blocks that were present in the control. The text is
* not changed, but no block will be drawn any more.
*/
void removeAllBlocks();
/**
* Add a block to the control. A block represents a group and is
* identified by the indexes of the first and the last characters in it.
* These limits are inclusive.
*
* The control maintains a list of block colors, that are cycled through
* at each block insertion. If you want the blocks to always have the
* same color even if they are removed and then re-added, always add
* them in the same order.
*/
void addBlock(int start, int end);
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
Q_SIGNALS:
/**
* Signal triggered when the user presses Enter or Return in the control
*/
void editingFinished();
protected:
virtual void paintEvent(QPaintEvent *e);
virtual void keyPressEvent(QKeyEvent *e);
private:
struct Private;
Private *d;
};
}
......
/* This file is part of the Nepomuk widgets collection
/* This file is part of the Baloo widgets collection
Copyright (c) 2013 Denis Steckelmacher <steckdenis@yahoo.fr>
This library is free software; you can redistribute it and/or
......
/* This file is part of the Nepomuk widgets collection
/* This file is part of the Baloo widgets collection
Copyright (c) 2013 Denis Steckelmacher <steckdenis@yahoo.fr>
This library is free software; you can redistribute it and/or
......@@ -31,38 +31,38 @@ class Term;
class BALOO_WIDGETS_EXPORT QueryBuilder : public GroupedLineEdit
{
Q_OBJECT
public:
explicit QueryBuilder(NaturalQueryParser *parser, QWidget *parent = 0);
/**
* @brief Parse the user query and provide syntax-highlighting and auto-completion
*
* If parsing is disabled, the query builder acts like a simple
* QLineEdit without any fancy coloring. If parsing is enabled, all the
* features are exposed to the user.
*
* By default, parsing is enabled.
*/
void setParsingEnabled(bool enable);
/**
* @return whether parsing is enabled
*/
bool parsingEnabled() const;
private:
void handleTerm(const Term &term);
private Q_SLOTS:
void reparse();
void proposalSelected(CompletionProposal *proposal,
const QString &value);
private:
struct Private;
Private *d;
Q_OBJECT
public:
explicit QueryBuilder(NaturalQueryParser *parser, QWidget *parent = 0);
/**
* @brief Parse the user query and provide syntax-highlighting and auto-completion
*
* If parsing is disabled, the query builder acts like a simple
* QLineEdit without any fancy coloring. If parsing is enabled, all the
* features are exposed to the user.
*
* By default, parsing is enabled.
*/
void setParsingEnabled(bool enable);
/**
* @return whether parsing is enabled
*/
bool parsingEnabled() const;
private:
void handleTerm(const Term &term);
private Q_SLOTS:
void reparse();
void proposalSelected(CompletionProposal *proposal,
const QString &value);
private:
struct Private;
Private *d;
};
}
......
/* This file is part of the Nepomuk widgets collection
/* This file is part of the Baloo widgets collection
Copyright (c) 2013 Denis Steckelmacher <steckdenis@yahoo.fr>
This library is free software; you can redistribute it and/or
......@@ -30,34 +30,34 @@ class CompletionProposal;
class QueryBuilderCompleter : public QListWidget
{
Q_OBJECT
Q_OBJECT
public:
explicit QueryBuilderCompleter(QWidget *parent);
public:
explicit QueryBuilderCompleter(QWidget *parent);
void addProposal(CompletionProposal *proposal, const QString &prefix);
void addProposal(CompletionProposal *proposal, const QString &prefix);
public Q_SLOTS:
void open();
public Q_SLOTS:
void open();
private Q_SLOTS:
void proposalActivated(QListWidgetItem *item);
private Q_SLOTS:
void proposalActivated(QListWidgetItem *item);
protected:
virtual bool eventFilter(QObject *, QEvent *event);
protected:
virtual bool eventFilter(QObject *, QEvent *event);
Q_SIGNALS:
void proposalSelected(CompletionProposal *proposal,
const QString &value);
Q_SIGNALS:
void proposalSelected(CompletionProposal *proposal,
const QString &value);
private:
QString valueStartingWith(const QStringList &strings,
const QString &prefix) const;
QWidget *widgetForProposal(CompletionProposal *proposal,
const QString &value);
private:
QString valueStartingWith(const QStringList &strings,
const QString &prefix) const;
QWidget *widgetForProposal(CompletionProposal *proposal,
const QString &value);
private:
QStringList validPropertyNames;
private:
QStringList validPropertyNames;
};
}
......
add_executable(tagwidgetapp tagwidgetapp.cpp tagwidgettest.cpp)
target_link_libraries(tagwidgetapp
KF5::BalooFiles
KF5BalooWidgets
KF5::BalooWidgets
Qt5::Widgets
Qt5::Core
)
......@@ -9,7 +9,7 @@ target_link_libraries(tagwidgetapp
add_executable(metadatawidgetapp metadatawidgetapp.cpp metadatawidgettest.cpp)
target_link_libraries(metadatawidgetapp
KF5::BalooFiles
KF5BalooWidgets
KF5::BalooWidgets
Qt5::Widgets
Qt5::Core
)
......@@ -17,7 +17,7 @@ target_link_libraries(metadatawidgetapp
add_executable(metadataconfigwidgetapp metadataconfigwidgetapp.cpp)
target_link_libraries(metadataconfigwidgetapp
KF5::BalooFiles
KF5BalooWidgets
KF5::BalooWidgets
Qt5::Widgets
Qt5::Core
)
......@@ -25,7 +25,7 @@ target_link_libraries(metadataconfigwidgetapp
add_executable(querybuilderapp querybuilderapp.cpp )
target_link_libraries(querybuilderapp
KF5::BalooNaturalQueryParser
KF5BalooWidgets
KF5::BalooWidgets
Qt5::Widgets
Qt5::Core
)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment