mirror of https://github.com/procxx/kepka.git
Replace crl::on_main to InvokeQueued in some cases.
If the event loop is reentered from the call it is unsafe to crl::on_main. For example NSOpenPanel lags terribly if it is shown from crl::on_main.
This commit is contained in:
parent
a2a5c30e60
commit
5a5c5782a9
|
@ -92,7 +92,7 @@ void OpenEmailLink(const QString &email) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenWith(const QString &filepath, QPoint menuPosition) {
|
void OpenWith(const QString &filepath, QPoint menuPosition) {
|
||||||
crl::on_main([=] {
|
InvokeQueued(QApplication::instance(), [=] {
|
||||||
if (!Platform::File::UnsafeShowOpenWithDropdown(filepath, menuPosition)) {
|
if (!Platform::File::UnsafeShowOpenWithDropdown(filepath, menuPosition)) {
|
||||||
if (!Platform::File::UnsafeShowOpenWith(filepath)) {
|
if (!Platform::File::UnsafeShowOpenWith(filepath)) {
|
||||||
Platform::File::UnsafeLaunch(filepath);
|
Platform::File::UnsafeLaunch(filepath);
|
||||||
|
@ -134,7 +134,7 @@ void GetOpenPath(
|
||||||
const QString &filter,
|
const QString &filter,
|
||||||
base::lambda<void(OpenResult &&result)> callback,
|
base::lambda<void(OpenResult &&result)> callback,
|
||||||
base::lambda<void()> failed) {
|
base::lambda<void()> failed) {
|
||||||
crl::on_main([=] {
|
InvokeQueued(QApplication::instance(), [=] {
|
||||||
auto files = QStringList();
|
auto files = QStringList();
|
||||||
auto remoteContent = QByteArray();
|
auto remoteContent = QByteArray();
|
||||||
const auto success = Platform::FileDialog::Get(
|
const auto success = Platform::FileDialog::Get(
|
||||||
|
@ -165,7 +165,7 @@ void GetOpenPaths(
|
||||||
const QString &filter,
|
const QString &filter,
|
||||||
base::lambda<void(OpenResult &&result)> callback,
|
base::lambda<void(OpenResult &&result)> callback,
|
||||||
base::lambda<void()> failed) {
|
base::lambda<void()> failed) {
|
||||||
crl::on_main([=] {
|
InvokeQueued(QApplication::instance(), [=] {
|
||||||
auto files = QStringList();
|
auto files = QStringList();
|
||||||
auto remoteContent = QByteArray();
|
auto remoteContent = QByteArray();
|
||||||
const auto success = Platform::FileDialog::Get(
|
const auto success = Platform::FileDialog::Get(
|
||||||
|
@ -193,7 +193,7 @@ void GetWritePath(
|
||||||
const QString &initialPath,
|
const QString &initialPath,
|
||||||
base::lambda<void(QString &&result)> callback,
|
base::lambda<void(QString &&result)> callback,
|
||||||
base::lambda<void()> failed) {
|
base::lambda<void()> failed) {
|
||||||
crl::on_main([=] {
|
InvokeQueued(QApplication::instance(), [=] {
|
||||||
auto file = QString();
|
auto file = QString();
|
||||||
if (filedialogGetSaveFile(file, caption, filter, initialPath)) {
|
if (filedialogGetSaveFile(file, caption, filter, initialPath)) {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
|
@ -210,7 +210,7 @@ void GetFolder(
|
||||||
const QString &initialPath,
|
const QString &initialPath,
|
||||||
base::lambda<void(QString &&result)> callback,
|
base::lambda<void(QString &&result)> callback,
|
||||||
base::lambda<void()> failed) {
|
base::lambda<void()> failed) {
|
||||||
crl::on_main([=] {
|
InvokeQueued(QApplication::instance(), [=] {
|
||||||
auto files = QStringList();
|
auto files = QStringList();
|
||||||
auto remoteContent = QByteArray();
|
auto remoteContent = QByteArray();
|
||||||
const auto success = Platform::FileDialog::Get(
|
const auto success = Platform::FileDialog::Get(
|
||||||
|
|
Loading…
Reference in New Issue