Commit 76996673 authored by Silvio Heinrich's avatar Silvio Heinrich Committed by Srikanth Tiyyagura

Created new docker plugin "Image Docker".

This docker plugin provides the functionality to
browse for image files and open them as a references.
parent f330591d
......@@ -7,4 +7,3 @@ add_subdirectory(presetdocker)
add_subdirectory(historydocker)
add_subdirectory(channeldocker)
add_subdirectory(imagedocker)
add_subdirectory(artisticcolorselector)
......@@ -7,9 +7,12 @@
<x>0</x>
<y>0</y>
<width>340</width>
<height>59</height>
<height>63</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
......@@ -97,18 +100,61 @@
</layout>
</item>
<item>
<widget class="KisSliderSpinBox" name="zoomSlider" native="true"/>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSpinBox" name="zoomSpinBox">
<property name="correctionMode">
<enum>QAbstractSpinBox::CorrectToNearestValue</enum>
</property>
<property name="suffix">
<string>%</string>
</property>
<property name="prefix">
<string/>
</property>
<property name="minimum">
<number>5</number>
</property>
<property name="maximum">
<number>500</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="zoomSlider">
<property name="minimum">
<number>5</number>
</property>
<property name="maximum">
<number>500</number>
</property>
<property name="value">
<number>100</number>
</property>
<property name="tracking">
<bool>true</bool>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="invertedAppearance">
<bool>false</bool>
</property>
<property name="invertedControls">
<bool>false</bool>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBothSides</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KisSliderSpinBox</class>
<extends>QWidget</extends>
<header location="global">kis_slider_spin_box.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
......@@ -10,6 +10,9 @@
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="margin">
<number>0</number>
......@@ -42,12 +45,6 @@
<string>Browse</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
......@@ -149,12 +146,6 @@
<string>Images</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="0,1">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1,0,0,0">
<item>
......
......@@ -184,14 +184,11 @@ ImageDockerDock::ImageDockerDock():
m_ui->bnPopup->setIcon(QIcon::fromTheme("zoom-original"));
m_ui->bnPopup->setPopupWidget(m_popupUi);
m_popupUi->zoomSlider->setRange(5, 500);
m_popupUi->zoomSlider->setValue(100);
m_zoomButtons->addButton(m_popupUi->bnZoomFit , KisImageView::VIEW_MODE_FIT);
m_zoomButtons->addButton(m_popupUi->bnZoomAdjust, KisImageView::VIEW_MODE_ADJUST);
m_zoomButtons->addButton(m_popupUi->bnZoom25 , 25);
m_zoomButtons->addButton(m_popupUi->bnZoom50 , 50);
m_zoomButtons->addButton(m_popupUi->bnZoom75 , 75);
m_zoomButtons->addButton(m_popupUi->bnZoom75 , 70);
m_zoomButtons->addButton(m_popupUi->bnZoom100 , 100);
m_model->setRootPath(QDir::rootPath());
......@@ -210,6 +207,7 @@ ImageDockerDock::ImageDockerDock():
connect(m_ui->imgView , SIGNAL(sigColorSelected(const QColor&)) , SLOT(slotColorSelected(const QColor)));
connect(m_ui->imgView , SIGNAL(sigViewModeChanged(int, qreal)) , SLOT(slotViewModeChanged(int, qreal)));
connect(m_popupUi->zoomSlider , SIGNAL(valueChanged(int)) , SLOT(slotZoomChanged(int)));
connect(m_popupUi->zoomSpinBox , SIGNAL(valueChanged(int)) , SLOT(slotZoomChanged(int)));
connect(m_zoomButtons , SIGNAL(buttonClicked(int)) , SLOT(slotZoomChanged(int)));
connect(m_zoomButtons , SIGNAL(buttonClicked(int)) , SLOT(slotCloseZoomPopup()));
connect(this , SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), SLOT(slotDockLocationChanged(Qt::DockWidgetArea)));
......@@ -244,7 +242,6 @@ void ImageDockerDock::addCurrentPathToHistory()
void ImageDockerDock::updatePath(const QString& path)
{
m_ui->cmbPath->lineEdit()->setText(path);
m_ui->bnBack->setDisabled(m_history.empty());
m_thumbModel->setCurrentDirectory(path);
}
......@@ -295,6 +292,9 @@ void ImageDockerDock::setZoom(const ImageInfo& info)
m_popupUi->zoomSlider->blockSignals(true);
m_popupUi->zoomSlider->setValue(zoom);
m_popupUi->zoomSlider->blockSignals(false);
m_popupUi->zoomSpinBox->blockSignals(true);
m_popupUi->zoomSpinBox->setValue(zoom);
m_popupUi->zoomSpinBox->blockSignals(false);
}
......@@ -316,13 +316,11 @@ void ImageDockerDock::slotItemDoubleClicked(const QModelIndex& index)
void ImageDockerDock::slotBackButtonClicked()
{
if(!m_history.empty()) {
QString path = m_history.last();
QModelIndex index = m_proxyModel->mapFromSource(m_model->index(path));
m_ui->treeView->setRootIndex(index);
m_history.pop_back();
updatePath(path);
}
QString path = m_history.last();
QModelIndex index = m_proxyModel->mapFromSource(m_model->index(path));
m_ui->treeView->setRootIndex(index);
m_history.pop_back();
updatePath(path);
}
void ImageDockerDock::slotHomeButtonClicked()
......@@ -477,6 +475,9 @@ void ImageDockerDock::slotViewModeChanged(int viewMode, qreal scale)
m_popupUi->zoomSlider->blockSignals(true);
m_popupUi->zoomSlider->setValue(zoom);
m_popupUi->zoomSlider->blockSignals(false);
m_popupUi->zoomSpinBox->blockSignals(true);
m_popupUi->zoomSpinBox->setValue(zoom);
m_popupUi->zoomSpinBox->blockSignals(false);
}
}
......
......@@ -24,7 +24,6 @@
#include <QGraphicsLinearLayout>
#include <QGraphicsWidget>
#include <QMutexLocker>
#include <QIcon>
/////////////////////////////////////////////////////////////////////////////////////////////
// ------------- KisImageLoader ---------------------------------------------------------- //
......@@ -71,27 +70,13 @@ void KisImageItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* opti
if(m_loader->isImageLoaded(this)) {
QImage image = m_loader->getImage(this);
if(!image.isNull()) {
QPointF offset((m_size-image.width()) / 2.0, (m_size-image.height()) / 2.0);
painter->drawImage(offset, image);
}
else {
QIcon icon = QIcon::fromTheme("image-missing");
QRect rect = boundingRect().toRect();
QPixmap img = icon.pixmap(rect.size());
painter->drawPixmap(rect, img, img.rect());
}
}
else {
QIcon icon = QIcon::fromTheme("image-loading");
QRect rect = boundingRect().toRect();
QPixmap img = icon.pixmap(rect.size());
painter->drawPixmap(rect, img, img.rect());
QPointF offset((m_size-image.width()) / 2.0, (m_size-image.height()) / 2.0);
painter->drawImage(offset, image);
}
if(isSelected())
if(isSelected()) {
painter->fillRect(boundingRect(), Qt::Dense5Pattern);
}
painter->drawRect(boundingRect());
}
......
......@@ -45,14 +45,14 @@ void KisImageViewport::setImage(const QPixmap& pixmap, qreal scale)
{
m_scale = scale;
m_pixmap = pixmap;
m_cachedPixmap = pixmap.scaled(imageRect().size(), Qt::IgnoreAspectRatio, Qt::FastTransformation);
m_cachedPixmap = pixmap.scaled(imageRect().size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
}
void KisImageViewport::setScale(qreal scale)
{
if(!qFuzzyCompare(scale, m_scale)) {
m_scale = scale;
m_cachedPixmap = m_pixmap.scaled(imageRect().size(), Qt::IgnoreAspectRatio, Qt::FastTransformation);
m_cachedPixmap = m_pixmap.scaled(imageRect().size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
}
}
......@@ -247,15 +247,3 @@ void KisImageView::slotRegionSelected(const QRect& rect)
emit sigViewModeChanged(m_viewMode, m_scale);
}
void KisImageView::resizeEvent(QResizeEvent* event)
{
QScrollArea::resizeEvent(event);
m_scale = calcScale(m_scale, m_viewMode, m_imgViewport->imageSize());
m_imgViewport->setScale(m_scale);
m_imgViewport->setMinimumSize(m_imgViewport->sizeHint());
m_imgViewport->adjustSize();
emit sigViewModeChanged(m_viewMode, m_scale);
}
......@@ -81,7 +81,6 @@ private slots:
private:
qreal calcScale(qreal scale, int viewMode, const QSizeF& imgSize) const;
QSize viewportSize(bool withScrollbars) const;
virtual void resizeEvent(QResizeEvent* event);
private:
qreal m_scale;
......
[Desktop Entry]
Name=Image Docker
Name[pt]=Área de Imagens
Name[pt_BR]=Acoplador de imagem
Name[sv]=Bilddockningsfönster
Name[uk]=Панель швартування зображень
Name[x-test]=xxImage Dockerxx
Name[en_GB]=Image Docker
Comment=Docker for reference images
Comment[pt]=Área das imagens de referência
Comment[pt_BR]=Acoplador para imagens de referência
Comment[sv]=Dockningsfönster för referensbilder
Comment[uk]=Панель для еталонних зображень
Comment[x-test]=xxDocker for reference imagesxx
Comment[en_GB]=Docker for reference images
X-KDE-ServiceTypes=Krita/Dock
Type=Service
X-KDE-Library=kritaimagedocker
......
Markdown is supported
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