diff --git a/src/Gui/ChooseCyclistDialog.cpp b/src/Gui/ChooseCyclistDialog.cpp index eca8d8d91..d6dda3564 100644 --- a/src/Gui/ChooseCyclistDialog.cpp +++ b/src/Gui/ChooseCyclistDialog.cpp @@ -97,14 +97,7 @@ ChooseCyclistDialog::getList() QStringListIterator i(home.entryList(QDir::Dirs | QDir::NoDotAndDotDot)); while (i.hasNext()) { QString name = i.next(); -#ifdef NOWEBKIT -#ifdef WIN32 - // QtWebEngine puts it's cache into the User directory (only on Windows) - so do not show in list - QStringList webEngineDirs; - webEngineDirs << "QtWebEngine" << "cache"; - if (webEngineDirs.contains(name)) continue; -#endif -#endif + SKIP_QTWE_CACHE // skip Folder Names created by QTWebEngine on Windows QListWidgetItem *newone = new QListWidgetItem(name, listWidget); // get avatar image if it exists diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 2b0f16969..a50c66ba3 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -1766,14 +1766,7 @@ MainWindow::setOpenWindowMenu() while (i.hasNext()) { QString name = i.next(); -#ifdef NOWEBKIT -#ifdef WIN32 - // QtWebEngine puts it's cache into the User directory (only on Windows) - so do not show in list - QStringList webEngineDirs; - webEngineDirs << "QtWebEngine" << "cache"; - if (webEngineDirs.contains(name)) continue; -#endif -#endif + SKIP_QTWE_CACHE // skip Folder Names created by QTWebEngine on Windows // new action QAction *action = new QAction(QString("%1").arg(name), this); @@ -1815,14 +1808,7 @@ MainWindow::setOpenTabMenu() while (i.hasNext()) { QString name = i.next(); -#ifdef NOWEBKIT -#ifdef WIN32 - // QtWebEngine puts it's cache into the User directory (only on Windows) - so do not show in list - QStringList webEngineDirs; - webEngineDirs << "QtWebEngine" << "cache"; - if (webEngineDirs.contains(name)) continue; -#endif -#endif + SKIP_QTWE_CACHE // skip Folder Names created by QTWebEngine on Windows // new action QAction *action = new QAction(QString("%1").arg(name), this); @@ -1864,14 +1850,7 @@ MainWindow::setBackupAthleteMenu() while (i.hasNext()) { QString name = i.next(); -#ifdef NOWEBKIT -#ifdef WIN32 - // QtWebEngine puts it's cache into the User directory (only on Windows) - so do not show in list - QStringList webEngineDirs; - webEngineDirs << "QtWebEngine" << "cache"; - if (webEngineDirs.contains(name)) continue; -#endif -#endif + SKIP_QTWE_CACHE // skip Folder Names created by QTWebEngine on Windows // new action QAction *action = new QAction(QString("%1").arg(name), this); diff --git a/src/Gui/MainWindow.h b/src/Gui/MainWindow.h index f6fc150cd..b5fa1d0f9 100644 --- a/src/Gui/MainWindow.h +++ b/src/Gui/MainWindow.h @@ -40,6 +40,19 @@ #include #endif +#if defined(NOWEBKIT) && defined(WIN32) +// Macro to avoid Code Duplication in multiple files +// QtWebEngine puts it's cache into the User directory (only on Windows) - so do not show in list +# define SKIP_QTWE_CACHE \ + QStringList webEngineDirs; \ + webEngineDirs << "QtWebEngine" << "cache"; \ + if (webEngineDirs.contains(name)) continue; +#else +# define SKIP_QTWE_CACHE +#endif + + + class QTFullScreen; class GcToolBar; class GcScopeBar;