Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
weblate committed Mar 10, 2017
2 parents 1eef4b3 + ac21338 commit 72dc9b4
Show file tree
Hide file tree
Showing 19 changed files with 55 additions and 102 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Martin Lepadusch <[email protected]>
Matt d'Entremont <[email protected]>
Michal Čihař <[email protected]>
Patricio M. Ros <[email protected]>
Robert Orzanna <[email protected]>
Ryan Wooden <[email protected]>
Scott Kostyshak <[email protected]>
Sebastian Schuberth <[email protected]>
Expand Down
5 changes: 0 additions & 5 deletions plugins/itemfakevim/itemfakevim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,6 @@ ItemFakeVim::ItemFakeVim(ItemWidget *childItem, const QString &sourceFileName)
{
}

void ItemFakeVim::setCurrent(bool current)
{
m_childItem->setCurrent(current);
}

void ItemFakeVim::highlight(const QRegExp &re, const QFont &highlightFont, const QPalette &highlightPalette)
{
m_childItem->setHighlight(re, highlightFont, highlightPalette);
Expand Down
2 changes: 0 additions & 2 deletions plugins/itemfakevim/itemfakevim.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ class ItemFakeVim : public ItemWidget
public:
ItemFakeVim(ItemWidget *childItem, const QString &sourceFileName);

void setCurrent(bool current) override;

protected:
void highlight(const QRegExp &re, const QFont &highlightFont,
const QPalette &highlightPalette) override;
Expand Down
43 changes: 17 additions & 26 deletions plugins/itemimage/itemimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,28 +127,6 @@ QObject *ItemImage::createExternalEditor(const QModelIndex &index, QWidget *pare
return cmd.isEmpty() ? nullptr : new ItemEditor(data, mime, cmd, parent);
}

void ItemImage::setCurrent(bool current)
{
if (current) {
if ( !m_animationData.isEmpty() ) {
if (!m_animation) {
QBuffer *stream = new QBuffer(&m_animationData, this);
m_animation = new QMovie(stream, m_animationFormat, this);
m_animation->setScaledSize( m_pixmap.size() );
}

if (m_animation) {
setMovie(m_animation);
startAnimation();
m_animation->start();
}
}
} else {
stopAnimation();
setPixmap(m_pixmap);
}
}

void ItemImage::showEvent(QShowEvent *event)
{
startAnimation();
Expand All @@ -163,14 +141,27 @@ void ItemImage::hideEvent(QHideEvent *event)

void ItemImage::startAnimation()
{
if (movie())
movie()->start();
if ( !m_animationData.isEmpty() ) {
if (!m_animation) {
QBuffer *stream = new QBuffer(&m_animationData, this);
m_animation = new QMovie(stream, m_animationFormat, this);
m_animation->setScaledSize( m_pixmap.size() );
}

if (m_animation) {
setMovie(m_animation);
movie()->start();
m_animation->start();
}
}
}

void ItemImage::stopAnimation()
{
if (movie())
movie()->stop();
if (m_animation) {
m_animation->stop();
setPixmap(m_pixmap);
}
}

ItemImageLoader::ItemImageLoader()
Expand Down
2 changes: 0 additions & 2 deletions plugins/itemimage/itemimage.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ class ItemImage : public QLabel, public ItemWidget

QObject *createExternalEditor(const QModelIndex &index, QWidget *parent) const override;

void setCurrent(bool current) override;

protected:
void showEvent(QShowEvent *event) override;
void hideEvent(QHideEvent *event) override;
Expand Down
35 changes: 20 additions & 15 deletions plugins/itemnotes/itemnotes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,21 +143,6 @@ ItemNotes::ItemNotes(ItemWidget *childItem, const QString &text, const QByteArra
layout->setSpacing(0);
}

void ItemNotes::setCurrent(bool current)
{
ItemWidget::setCurrent(current);

if (m_timerShowToolTip == nullptr)
return;

QToolTip::hideText();

if (current)
m_timerShowToolTip->start();
else
m_timerShowToolTip->stop();
}

void ItemNotes::highlight(const QRegExp &re, const QFont &highlightFont, const QPalette &highlightPalette)
{
m_childItem->setHighlight(re, highlightFont, highlightPalette);
Expand Down Expand Up @@ -270,6 +255,26 @@ bool ItemNotes::eventFilter(QObject *, QEvent *event)
return ItemWidget::filterMouseEvents(m_notes, event);
}

void ItemNotes::showEvent(QShowEvent *event)
{
QWidget::showEvent(event);

if (m_timerShowToolTip != nullptr) {
QToolTip::hideText();
m_timerShowToolTip->start();
}
}

void ItemNotes::hideEvent(QHideEvent *event)
{
if (m_timerShowToolTip != nullptr) {
QToolTip::hideText();
m_timerShowToolTip->stop();
}

QWidget::hideEvent(event);
}

void ItemNotes::showToolTip()
{
QToolTip::hideText();
Expand Down
5 changes: 3 additions & 2 deletions plugins/itemnotes/itemnotes.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ class ItemNotes : public QWidget, public ItemWidget
ItemNotes(ItemWidget *childItem, const QString &text, const QByteArray &icon,
bool notesAtBottom, bool showIconOnly, bool showToolTip);

void setCurrent(bool current) override;

protected:
void highlight(const QRegExp &re, const QFont &highlightFont,
const QPalette &highlightPalette) override;
Expand All @@ -65,6 +63,9 @@ class ItemNotes : public QWidget, public ItemWidget

bool eventFilter(QObject *, QEvent *event) override;

void showEvent(QShowEvent *event) override;
void hideEvent(QHideEvent *event) override;

private slots:
void showToolTip();

Expand Down
6 changes: 0 additions & 6 deletions plugins/itemsync/itemsync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,6 @@ ItemSync::ItemSync(const QString &label, const QString &icon, ItemWidget *childI
m_label->setPlainText(label);
}

void ItemSync::setCurrent(bool current)
{
if (m_childItem != nullptr)
m_childItem->setCurrent(current);
}

void ItemSync::highlight(const QRegExp &re, const QFont &highlightFont, const QPalette &highlightPalette)
{
m_childItem->setHighlight(re, highlightFont, highlightPalette);
Expand Down
2 changes: 0 additions & 2 deletions plugins/itemsync/itemsync.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ class ItemSync : public QWidget, public ItemWidget
public:
ItemSync(const QString &label, const QString &icon, ItemWidget *childItem = nullptr);

void setCurrent(bool current) override;

protected:
void highlight(const QRegExp &re, const QFont &highlightFont,
const QPalette &highlightPalette) override;
Expand Down
6 changes: 0 additions & 6 deletions plugins/itemtags/itemtags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,6 @@ ItemTags::ItemTags(ItemWidget *childItem, const Tags &tags)
layout->addWidget( m_childItem->widget() );
}

void ItemTags::setCurrent(bool current)
{
if (m_childItem != nullptr)
m_childItem->setCurrent(current);
}

void ItemTags::highlight(const QRegExp &re, const QFont &highlightFont, const QPalette &highlightPalette)
{
m_childItem->setHighlight(re, highlightFont, highlightPalette);
Expand Down
2 changes: 0 additions & 2 deletions plugins/itemtags/itemtags.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ class ItemTags : public QWidget, public ItemWidget

ItemTags(ItemWidget *childItem, const Tags &tags);

void setCurrent(bool current) override;

signals:
void runCommand(const Command &command);

Expand Down
1 change: 1 addition & 0 deletions src/gui/aboutdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ QString AboutDialog::aboutPage()
+ helpDeveloper("Matt d'Entremont", "[email protected]")
+ helpDeveloper("Michal Čihař", "[email protected]")
+ helpDeveloper("Patricio M. Ros", "[email protected]")
+ helpDeveloper("Robert Orzanna", "[email protected]>")
+ helpDeveloper("Ryan Wooden", "[email protected]")
+ helpDeveloper("Scott Kostyshak", "[email protected]")
+ helpDeveloper("Sebastian Schuberth", "[email protected]")
Expand Down
18 changes: 0 additions & 18 deletions src/gui/clipboardbrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,16 +390,6 @@ void ClipboardBrowser::stopExpiring()
m_timerExpire.stop();
}

void ClipboardBrowser::updateCurrentItem()
{
const QModelIndex current = currentIndex();
if ( current.isValid() && d.hasCache(current) ) {
ItemWidget *item = d.cache(current);
item->setCurrent(false);
item->setCurrent( hasFocus() );
}
}

QModelIndex ClipboardBrowser::indexNear(int offset) const
{
return ::indexNear(this, offset);
Expand Down Expand Up @@ -884,13 +874,6 @@ void ClipboardBrowser::currentChanged(const QModelIndex &current, const QModelIn

QListView::currentChanged(current, previous);
d.setWidgetVisible(previous, false);

if ( previous.isValid() && d.hasCache(previous) ) {
ItemWidget *item = d.cache(previous);
item->setCurrent(false);
}

updateCurrentItem();
}

void ClipboardBrowser::selectionChanged(const QItemSelection &selected,
Expand All @@ -909,7 +892,6 @@ void ClipboardBrowser::focusInEvent(QFocusEvent *event)
if ( !currentIndex().isValid() )
setCurrent(0);
QListView::focusInEvent(event);
updateCurrentItem();
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/gui/clipboardbrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,6 @@ class ClipboardBrowser : public QListView

void stopExpiring();

void updateCurrentItem();

/**
* Get index near given @a point.
* If space between items is at the @a point, return next item.
Expand Down
2 changes: 0 additions & 2 deletions src/item/itemdelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,6 @@ void ItemDelegate::setIndexWidget(const QModelIndex &index, ItemWidget *w)

ww->installEventFilter(this);

w->setCurrent(m_view->currentIndex() == index);

// TODO: Check if sizeHint() really changes.
emit sizeHintChanged(index);
}
Expand Down
10 changes: 10 additions & 0 deletions src/item/itemdelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,18 @@ class ItemDelegate : public QItemDelegate
/** Load settings for @a editor. */
void loadEditorSettings(ItemEditorWidget *editor);

/**
* Highlight matched text with current serch expression, font and color.
*/
void highlightMatches(ItemWidget *itemWidget) const;

/**
* Show/hide item widget.
*
* Only current widget should be visible.
*
* This allows interaction and updates only to happen on current items.
*/
void setWidgetVisible(const QModelIndex &index, bool visible);

public slots:
Expand Down
6 changes: 0 additions & 6 deletions src/item/itemwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,6 @@ void ItemWidget::updateSize(const QSize &maximumSize, int idealWidth)
w->setFixedSize(idealWidth, idealHeight);
}

void ItemWidget::setCurrent(bool current)
{
// Propagate mouse events to item list until the item is selected.
widget()->setAttribute(Qt::WA_TransparentForMouseEvents, !current);
}

bool ItemWidget::filterMouseEvents(QTextEdit *edit, QEvent *event)
{
QEvent::Type type = event->type();
Expand Down
5 changes: 0 additions & 5 deletions src/item/itemwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,6 @@ class ItemWidget
*/
virtual void updateSize(const QSize &maximumSize, int idealSize);

/**
* Called if widget is set or unset as current.
*/
virtual void setCurrent(bool current);

/**
* Mark item as tagged/untagged.
*
Expand Down
4 changes: 3 additions & 1 deletion src/platform/unix/unixsignalhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ bool UnixSignalHandler::create(QObject *parent)
void UnixSignalHandler::exitSignalHandler(int)
{
const qint64 pid = QCoreApplication::applicationPid();
::write(signalFd[Write], &pid, sizeof(pid));
const auto written = ::write(signalFd[Write], &pid, sizeof(pid));
if (written == -1)
log("Failed to handle signal!", LogError);
}

void UnixSignalHandler::handleSignal()
Expand Down

0 comments on commit 72dc9b4

Please sign in to comment.