2 * Copyright (C) 2014 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17#include "croppedimagesizer.h"
19#include "croppedimagesizerasyncworker.h"
21#include <QNetworkAccessManager>
22#include <QNetworkRequest>
26CroppedImageSizer::CroppedImageSizer()
29 m_sourceSize(QSize(-1, -1)),
32 connect(this, &CroppedImageSizer::inputParamsChanged, this, &CroppedImageSizer::calculateSourceSize);
35CroppedImageSizer::~CroppedImageSizer()
42QUrl CroppedImageSizer::source() const
47void CroppedImageSizer::setSource(const QUrl &source)
49 if (source != m_source) {
51 Q_EMIT inputParamsChanged();
55qreal CroppedImageSizer::width() const
60void CroppedImageSizer::setWidth(qreal width)
62 if (width != m_width) {
64 Q_EMIT inputParamsChanged();
68qreal CroppedImageSizer::height() const
73void CroppedImageSizer::setHeight(qreal height)
75 if (height != m_height) {
77 Q_EMIT inputParamsChanged();
81QSize CroppedImageSizer::sourceSize() const
86void CroppedImageSizer::setSourceSize(const QSize &size)
88 if (size != m_sourceSize) {
90 Q_EMIT sourceSizeChanged();
94void CroppedImageSizer::calculateSourceSize()
96 if (m_source.isValid() && m_width > 0 && m_height > 0 && qmlEngine(this) && qmlEngine(this)->networkAccessManager()) {
101 QNetworkRequest request(m_source);
102 QNetworkReply *reply = qmlEngine(this)->networkAccessManager()->get(request);
103 m_worker = new CroppedImageSizerAsyncWorker(this, reply);
104 } else if (m_sourceSize != QSize(-1, -1)) {
105 m_sourceSize = QSize(-1, -1);
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list