layout->addWidget(picker);
connect(picker, SIGNAL(colorPicked(QColor)), this, SLOT(setColor(QColor)));
+ connect(picker, SIGNAL(displayMessage(const QString&, int)), this, SIGNAL(displayMessage(const QString&, int)));
connect(m_button, SIGNAL(clicked(bool)), this, SIGNAL(modified()));
}
signals:
/** @brief Emitted whenever a different color was choosen. */
void modified();
+ void displayMessage(const QString&, int);
};
#endif
int y0 = qMax(0, pos.y() - size / 2);
int x1 = qMin(qApp->desktop()->geometry().width(), pos.x() + size / 2);
int y1 = qMin(qApp->desktop()->geometry().height(), pos.y() + size / 2);
+ int numPixel = (x1 - x0) * (y1 - y0);
int sumR = 0;
int sumG = 0;
int sumB = 0;
+ // only show message for size > 200 because for smaller values it slows down to much
+ if (size > 200)
+ emit displayMessage(i18n("Requesting color information..."), 0);
+
/*
Only getting the image once for the whole rect
results in a vast speed improvement.
m_image = QPixmap::grabWindow(desktop->winId(), x0, y0, x1 - x0, y1 - y0).toImage();
#endif
- for (int i = x0; i < x1; ++i) {
- for (int j = y0; j < y1; ++j) {
+ for (int i = x0; i <= x1; ++i) {
+ for (int j = y0; j <= y1; ++j) {
QColor color;
color = grabColor(QPoint(i - x0, j - y0), false);
sumR += color.red();
sumG += color.green();
sumB += color.blue();
}
+
+ // Warning: slows things down, so don't do it for every pixel (the inner for loop)
+ if (size > 200)
+ emit displayMessage(i18n("Requesting color information..."), (int)(((i - x0) * (y1 - y0)) / (qreal)numPixel * 100));
}
#ifdef Q_WS_X11
#endif
m_image = 0;
- int numPixel = (x1 - x0) * (y1 - y0);
+ if (size > 200)
+ emit displayMessage(i18n("Calculated average color for rectangle."), -1);
+
return QColor(sumR / numPixel, sumG / numPixel, sumB / numPixel);
}
signals:
void colorPicked(QColor);
+ void displayMessage(const QString&, int);
};
#endif
ChooseColorWidget *choosecolor = new ChooseColorWidget(paramName, QColor(value.toUInt(&ok, 16)), this);
m_vbox->addWidget(choosecolor);
m_valueItems[paramName] = choosecolor;
+ connect(choosecolor, SIGNAL(displayMessage(const QString&, int)), this, SIGNAL(displayMessage(const QString&, int)));
connect(choosecolor, SIGNAL(modified()) , this, SLOT(collectAllParameters()));
} else if (type == "position") {
int pos = value.toInt();
signals:
void parameterChanged(const QDomElement, const QDomElement);
void seekTimeline(int);
+ void displayMessage(const QString&, int);
};
#endif
connect(m_ui.checkAll, SIGNAL(stateChanged(int)), this, SLOT(slotCheckAll(int)));
connect(m_effectedit, SIGNAL(parameterChanged(const QDomElement, const QDomElement)), this , SLOT(slotUpdateEffectParams(const QDomElement, const QDomElement)));
connect(m_effectedit, SIGNAL(seekTimeline(int)), this , SLOT(slotSeekTimeline(int)));
+ connect(m_effectedit, SIGNAL(displayMessage(const QString&, int)), this, SIGNAL(displayMessage(const QString&, int)));
m_effectLists["audio"] = &MainWindow::audioEffects;
m_effectLists["video"] = &MainWindow::videoEffects;
m_effectLists["custom"] = &MainWindow::customEffects;
void seekTimeline(int);
/** The region effect for current effect was changed */
void updateClipRegion(ClipItem*, int, QString);
+ void displayMessage(const QString&, int);
};
#endif
disconnect(m_effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, int)), m_activeTimeline->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, int)));
disconnect(m_effectStack, SIGNAL(refreshEffectStack(ClipItem*)), m_activeTimeline->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
disconnect(m_effectStack, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
+ disconnect(m_effectStack, SIGNAL(displayMessage(const QString&, int)), this, SLOT(slotGotProgressInfo(const QString&, int)));
disconnect(m_transitionConfig, SIGNAL(transitionUpdated(Transition *, QDomElement)), m_activeTimeline->projectView() , SLOT(slotTransitionUpdated(Transition *, QDomElement)));
disconnect(m_transitionConfig, SIGNAL(seekTimeline(int)), m_activeTimeline->projectView() , SLOT(setCursorPos(int)));
disconnect(m_activeTimeline->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
connect(m_transitionConfig, SIGNAL(seekTimeline(int)), trackView->projectView() , SLOT(setCursorPos(int)));
connect(m_effectStack, SIGNAL(seekTimeline(int)), trackView->projectView() , SLOT(setCursorPos(int)));
connect(m_effectStack, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
+ connect(m_effectStack, SIGNAL(displayMessage(const QString&, int)), this, SLOT(slotGotProgressInfo(const QString&, int)));
connect(trackView->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
connect(trackView, SIGNAL(zoneMoved(int, int)), this, SLOT(slotZoneMoved(int, int)));