mirror of https://github.com/procxx/kepka.git
photos overview blur, multimonitor photoview fix, os x file dialog default path
This commit is contained in:
parent
af9117e084
commit
40641133bc
|
@ -157,7 +157,9 @@ void DownloadPathBox::onEditPath() {
|
||||||
|
|
||||||
filedialogInit();
|
filedialogInit();
|
||||||
QString path, lastPath = cDialogLastPath();
|
QString path, lastPath = cDialogLastPath();
|
||||||
if (!cDownloadPath().isEmpty()) cSetDialogLastPath(cDownloadPath());
|
if (!cDownloadPath().isEmpty()) {
|
||||||
|
cSetDialogLastPath(cDownloadPath());
|
||||||
|
}
|
||||||
if (filedialogGetDir(path, lang(lng_download_path_choose))) {
|
if (filedialogGetDir(path, lang(lng_download_path_choose))) {
|
||||||
if (!path.isEmpty()) {
|
if (!path.isEmpty()) {
|
||||||
_path = path + '/';
|
_path = path + '/';
|
||||||
|
|
|
@ -22,8 +22,9 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
|
|
||||||
void filedialogInit() {
|
void filedialogInit() {
|
||||||
// hack to restore previous dir without hurting performance
|
|
||||||
if (cDialogLastPath().isEmpty()) {
|
if (cDialogLastPath().isEmpty()) {
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
// hack to restore previous dir without hurting performance
|
||||||
QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
|
QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
|
||||||
settings.beginGroup(QLatin1String("Qt"));
|
settings.beginGroup(QLatin1String("Qt"));
|
||||||
QByteArray sd = settings.value(QLatin1String("filedialog")).toByteArray();
|
QByteArray sd = settings.value(QLatin1String("filedialog")).toByteArray();
|
||||||
|
@ -59,16 +60,21 @@ void filedialogInit() {
|
||||||
cSetDialogHelperPath(temppath.absolutePath());
|
cSetDialogHelperPath(temppath.absolutePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
cSetDialogLastPath(QStandardPaths::writableLocation(QStandardPaths::DownloadLocation));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// multipleFiles: 1 - multi open, 0 - single open, -1 - single save, -2 - select dir
|
// multipleFiles: 1 - multi open, 0 - single open, -1 - single save, -2 - select dir
|
||||||
bool _filedialogGetFiles(QStringList &files, QByteArray &remoteContent, const QString &caption, const QString &filter, int multipleFiles, const QString &startFile = QString()) {
|
bool _filedialogGetFiles(QStringList &files, QByteArray &remoteContent, const QString &caption, const QString &filter, int multipleFiles, QString startFile = QString()) {
|
||||||
#if defined Q_OS_LINUX || defined Q_OS_MAC // use native
|
#if defined Q_OS_LINUX || defined Q_OS_MAC // use native
|
||||||
remoteContent = QByteArray();
|
remoteContent = QByteArray();
|
||||||
QString file;
|
QString file;
|
||||||
if (multipleFiles >= 0) {
|
if (multipleFiles >= 0) {
|
||||||
files = QFileDialog::getOpenFileNames(App::wnd() ? App::wnd()->filedialogParent() : 0, caption, startFile, filter);
|
files = QFileDialog::getOpenFileNames(App::wnd() ? App::wnd()->filedialogParent() : 0, caption, startFile, filter);
|
||||||
|
QString path = files.isEmpty() ? QString() : QFileInfo(files.back()).absoluteDir().absolutePath();
|
||||||
|
if (!path.isEmpty()) cSetDialogLastPath(path);
|
||||||
return !files.isEmpty();
|
return !files.isEmpty();
|
||||||
} else if (multipleFiles < -1) {
|
} else if (multipleFiles < -1) {
|
||||||
file = QFileDialog::getExistingDirectory(App::wnd() ? App::wnd()->filedialogParent() : 0, caption);
|
file = QFileDialog::getExistingDirectory(App::wnd() ? App::wnd()->filedialogParent() : 0, caption);
|
||||||
|
@ -81,6 +87,8 @@ bool _filedialogGetFiles(QStringList &files, QByteArray &remoteContent, const QS
|
||||||
files = QStringList();
|
files = QStringList();
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
QString path = QFileInfo(file).absoluteDir().absolutePath();
|
||||||
|
if (!path.isEmpty()) cSetDialogLastPath(path);
|
||||||
files = QStringList(file);
|
files = QStringList(file);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,14 +107,7 @@ namespace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap Image::pixBlurredNoCache(int32 w, int32 h) const {
|
QImage imageBlur(QImage img) {
|
||||||
restore();
|
|
||||||
loaded();
|
|
||||||
|
|
||||||
const QPixmap &p(pixData());
|
|
||||||
if (p.isNull()) return blank()->pix();
|
|
||||||
|
|
||||||
QImage img = p.toImage();
|
|
||||||
QImage::Format fmt = img.format();
|
QImage::Format fmt = img.format();
|
||||||
if (fmt != QImage::Format_RGB32 && fmt != QImage::Format_ARGB32 && fmt != QImage::Format_ARGB32_Premultiplied) {
|
if (fmt != QImage::Format_RGB32 && fmt != QImage::Format_ARGB32 && fmt != QImage::Format_ARGB32_Premultiplied) {
|
||||||
QImage tmp(img.width(), img.height(), QImage::Format_ARGB32);
|
QImage tmp(img.width(), img.height(), QImage::Format_ARGB32);
|
||||||
|
@ -211,7 +204,17 @@ QPixmap Image::pixBlurredNoCache(int32 w, int32 h) const {
|
||||||
delete[] rgb;
|
delete[] rgb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPixmap Image::pixBlurredNoCache(int32 w, int32 h) const {
|
||||||
|
restore();
|
||||||
|
loaded();
|
||||||
|
|
||||||
|
const QPixmap &p(pixData());
|
||||||
|
if (p.isNull()) return blank()->pix();
|
||||||
|
|
||||||
|
QImage img = imageBlur(p.toImage());
|
||||||
if (h <= 0) {
|
if (h <= 0) {
|
||||||
img = img.scaledToWidth(w, Qt::SmoothTransformation);
|
img = img.scaledToWidth(w, Qt::SmoothTransformation);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -19,6 +19,8 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||||
|
|
||||||
#include <QtGui/QPixmap>
|
#include <QtGui/QPixmap>
|
||||||
|
|
||||||
|
QImage imageBlur(QImage img);
|
||||||
|
|
||||||
class Image {
|
class Image {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -2287,7 +2287,7 @@ void HistoryAudio::draw(QPainter &p, const HistoryItem *parent, bool selected, i
|
||||||
p.setPen(status->p);
|
p.setPen(status->p);
|
||||||
if (already || hasdata) {
|
if (already || hasdata) {
|
||||||
if (playing == data && playingState != VoiceMessageStopped) {
|
if (playing == data && playingState != VoiceMessageStopped) {
|
||||||
statusText = formatDurationText(playingPosition / AudioVoiceMsgFrequency);
|
statusText = formatDurationText(playingPosition / AudioVoiceMsgFrequency) + qsl(" / ") + formatDurationText(playingDuration / AudioVoiceMsgFrequency);
|
||||||
} else {
|
} else {
|
||||||
statusText = formatDurationText(data->duration);
|
statusText = formatDurationText(data->duration);
|
||||||
}
|
}
|
||||||
|
|
|
@ -870,7 +870,7 @@ QString HistoryList::getSelectedText() const {
|
||||||
void HistoryList::keyPressEvent(QKeyEvent *e) {
|
void HistoryList::keyPressEvent(QKeyEvent *e) {
|
||||||
if (e->key() == Qt::Key_Escape) {
|
if (e->key() == Qt::Key_Escape) {
|
||||||
historyWidget->onClearSelected();
|
historyWidget->onClearSelected();
|
||||||
} else if (e == QKeySequence::Copy && !_selected.isEmpty() && _selected.cbegin().value() != FullItemSel) {
|
} else if (e == QKeySequence::Copy && !_selected.isEmpty()) {
|
||||||
copySelectedText();
|
copySelectedText();
|
||||||
} else if (e == QKeySequence::Delete) {
|
} else if (e == QKeySequence::Delete) {
|
||||||
historyWidget->onDeleteSelected();
|
historyWidget->onDeleteSelected();
|
||||||
|
|
|
@ -970,9 +970,15 @@ void MainWidget::setInnerFocus() {
|
||||||
if (hider || !history.peer()) {
|
if (hider || !history.peer()) {
|
||||||
if (hider && hider->wasOffered()) {
|
if (hider && hider->wasOffered()) {
|
||||||
hider->setFocus();
|
hider->setFocus();
|
||||||
|
} else if (overview) {
|
||||||
|
overview->activate();
|
||||||
|
} else if (profile) {
|
||||||
|
profile->activate();
|
||||||
} else {
|
} else {
|
||||||
dialogs.setInnerFocus();
|
dialogs.setInnerFocus();
|
||||||
}
|
}
|
||||||
|
} else if (profile) {
|
||||||
|
profile->setFocus();
|
||||||
} else {
|
} else {
|
||||||
history.activate();
|
history.activate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,8 +60,8 @@ void MediaView::moveToScreen() {
|
||||||
}
|
}
|
||||||
if (!geom.contains(_avail)) {
|
if (!geom.contains(_avail)) {
|
||||||
_avail = geom;
|
_avail = geom;
|
||||||
_avail.moveTo(0, 0);
|
|
||||||
}
|
}
|
||||||
|
_avail.moveTo(_avail.x() - geom.x(), _avail.y() - geom.y());
|
||||||
_maxWidth = _avail.width() - 2 * st::medviewNavBarWidth;
|
_maxWidth = _avail.width() - 2 * st::medviewNavBarWidth;
|
||||||
_maxHeight = _avail.height() - st::medviewTopSkip - st::medviewBottomSkip;
|
_maxHeight = _avail.height() - st::medviewTopSkip - st::medviewBottomSkip;
|
||||||
_leftNav = QRect(0, 0, st::medviewNavBarWidth, height());
|
_leftNav = QRect(0, 0, st::medviewNavBarWidth, height());
|
||||||
|
|
|
@ -547,6 +547,9 @@ void OverviewInner::clear() {
|
||||||
QPixmap OverviewInner::genPix(PhotoData *photo, int32 size) {
|
QPixmap OverviewInner::genPix(PhotoData *photo, int32 size) {
|
||||||
size *= cIntRetinaFactor();
|
size *= cIntRetinaFactor();
|
||||||
QImage img = (photo->full->loaded() ? photo->full : (photo->medium->loaded() ? photo->medium : photo->thumb))->pix().toImage();
|
QImage img = (photo->full->loaded() ? photo->full : (photo->medium->loaded() ? photo->medium : photo->thumb))->pix().toImage();
|
||||||
|
if (!photo->full->loaded() && !photo->medium->loaded()) {
|
||||||
|
img = imageBlur(img);
|
||||||
|
}
|
||||||
if (img.width() > img.height()) {
|
if (img.width() > img.height()) {
|
||||||
img = img.scaled(img.width() * size / img.height(), size, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
|
img = img.scaled(img.width() * size / img.height(), size, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -19,7 +19,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||||
|
|
||||||
extern bool gDebug;
|
extern bool gDebug;
|
||||||
inline bool cDebug() {
|
inline bool cDebug() {
|
||||||
#ifdef _DEBUG
|
#if defined _DEBUG && !defined Q_OS_MAC
|
||||||
return true;
|
return true;
|
||||||
#elif defined _WITH_DEBUG
|
#elif defined _WITH_DEBUG
|
||||||
return gDebug;
|
return gDebug;
|
||||||
|
|
Loading…
Reference in New Issue