| 1 | #cxx . . $ `<file>/lib/tools.cpp`/include "tools.h"cxx . . $ `<file>/lib/tools.h`/ |
| 2 | |
| 3 | #include <QCoreApplication> |
| 4 | #include <QDir> |
| 5 | #include <QtDebug> |
| 6 | |
| 7 | |
| 8 | Q_LOGGING_CATEGORYcxx . . $ `<external>/13903568758641964362/qloggingcategory.h:114:9`!(qtermwidgetLogger, "qtermwidget", QtWarningMsg) |
| 9 | |
| 10 | /*! Helper function to get possible location of layout files. |
| 11 | By default the KB_LAYOUT_DIR is used (linux/BSD/macports). |
| 12 | But in some cases (apple bundle) there can be more locations). |
| 13 | */ |
| 14 | QStringcxx . . $ QString# get_kb_layout_dircxx . . $ get_kb_layout_dir(4365c3963150523e).() |
| 15 | { |
| 16 | // qDebug() << __FILE__ << __FUNCTION__; |
| 17 | |
| 18 | QStringcxx . . $ QString# rval = QStringcxx . . $ QString#QString(ced63f7c635d850d).(); |
| 19 | QStringcxx . . $ QString# kcxx . . $ QString#QString(45672f3c6961a244).(qgetenvcxx . . $ qgetenv(531409eeffcde449).("KB_LAYOUT_DIR")); |
| 20 | QDircxx . . $ QDir# dcxx . . $ QDir#QDir(3520e46b33348bf6).(k); |
| 21 | |
| 22 | //qDebug() << "default KB_LAYOUT_DIR: " << k; |
| 23 | |
| 24 | if (d.existscxx . . $ QDir#exists(50ce9a9e25b4a850).()) |
| 25 | { |
| 26 | rval =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). k.appendcxx . . $ QString#append(3a2ffbdf8ecc25e2).(QLatin1Charcxx . . $ QChar#QChar(a50889c09eec06d9).('/')); |
| 27 | return rvalcxx . . $ QString#QString(28715ad661ad3cec).; |
| 28 | } |
| 29 | |
| 30 | #ifdef Q_OS_MAC |
| 31 | // subdir in the app location |
| 32 | d.setPath(QCoreApplication::applicationDirPath() + QLatin1String("/kb-layouts/")); |
| 33 | //qDebug() << d.path(); |
| 34 | if (d.exists()) |
| 35 | return QCoreApplication::applicationDirPath() + QLatin1String("/kb-layouts/"); |
| 36 | |
| 37 | d.setPath(QCoreApplication::applicationDirPath() + QLatin1String("/../Resources/kb-layouts/")); |
| 38 | if (d.exists()) |
| 39 | return QCoreApplication::applicationDirPath() + QLatin1String("/../Resources/kb-layouts/"); |
| 40 | #endif |
| 41 | //qDebug() << "Cannot find KB_LAYOUT_DIR. Default:" << k; |
| 42 | return QStringcxx . . $ QString#QString(ced63f7c635d850d).(); |
| 43 | } |
| 44 | |
| 45 | /*! Helper function to add custom location of color schemes. |
| 46 | */ |
| 47 | namespacecxx . . $ `$anonymous_namespace_lib/tools.cpp`/ { |
| 48 | QStringListcxx . . $ QStringList# custom_color_schemes_dirscxx . . $ `$anonymous_namespace_lib/tools.cpp`/custom_color_schemes_dirs.; |
| 49 | } |
| 50 | void add_custom_color_scheme_dircxx . . $ add_custom_color_scheme_dir(3520e46b33348bf6).(const QStringcxx . . $ QString#& custom_dir) |
| 51 | { |
| 52 | if (!custom_color_schemes_dirscxx . . $ `$anonymous_namespace_lib/tools.cpp`/custom_color_schemes_dirs..containscxx . . $ QStringList#contains(8cce4688c16f48f3).(custom_dir)) |
| 53 | custom_color_schemes_dirscxx . . $ `$anonymous_namespace_lib/tools.cpp`/custom_color_schemes_dirs. <<cxx . . $ QStringList#`operator<<`(85116071a693d053). custom_dir; |
| 54 | } |
| 55 | |
| 56 | /*! Helper function to get possible locations of color schemes. |
| 57 | By default the COLORSCHEMES_DIR is used (linux/BSD/macports). |
| 58 | But in some cases (apple bundle) there can be more locations). |
| 59 | */ |
| 60 | const QStringListcxx . . $ QStringList# get_color_schemes_dirscxx . . $ get_color_schemes_dirs(8915157311999748).() |
| 61 | { |
| 62 | // qDebug() << __FILE__ << __FUNCTION__; |
| 63 | |
| 64 | QStringListcxx . . $ QStringList# rvalcxx . . $ QStringList#QStringList(ced63f7c635d850d).; |
| 65 | QStringcxx . . $ QString# kcxx . . $ QString#QString(45672f3c6961a244).(qgetenvcxx . . $ qgetenv(531409eeffcde449).("COLORSCHEMES_DIR")); |
| 66 | QDircxx . . $ QDir# dcxx . . $ QDir#QDir(3520e46b33348bf6).(k); |
| 67 | |
| 68 | // qDebug() << "default COLORSCHEMES_DIR: " << k; |
| 69 | |
| 70 | if (d.existscxx . . $ QDir#exists(50ce9a9e25b4a850).()) |
| 71 | rval <<cxx . . $ QStringList#`operator<<`(85116071a693d053). k.appendcxx . . $ QString#append(3a2ffbdf8ecc25e2).(QLatin1Charcxx . . $ QChar#QChar(a50889c09eec06d9).('/')); |
| 72 | |
| 73 | #ifdef Q_OS_MAC |
| 74 | // subdir in the app location |
| 75 | d.setPath(QCoreApplication::applicationDirPath() + QLatin1String("/color-schemes/")); |
| 76 | //qDebug() << d.path(); |
| 77 | if (d.exists()) |
| 78 | { |
| 79 | if (!rval.isEmpty()) |
| 80 | rval.clear(); |
| 81 | rval << (QCoreApplication::applicationDirPath() + QLatin1String("/color-schemes/")); |
| 82 | } |
| 83 | d.setPath(QCoreApplication::applicationDirPath() + QLatin1String("/../Resources/color-schemes/")); |
| 84 | if (d.exists()) |
| 85 | { |
| 86 | if (!rval.isEmpty()) |
| 87 | rval.clear(); |
| 88 | rval << (QCoreApplication::applicationDirPath() + QLatin1String("/../Resources/color-schemes/")); |
| 89 | } |
| 90 | #endif |
| 91 | |
| 92 | for (const QStringcxx . . $ QString#& custom_dir : qAsConstcxx . . $ qAsConst(1dc117cbefefc300).(custom_color_schemes_dirscxx . . $ `$anonymous_namespace_lib/tools.cpp`/custom_color_schemes_dirs.)) |
| 93 | { |
| 94 | d.setPathcxx . . $ QDir#setPath(3520e46b33348bf6).(custom_dir); |
| 95 | if (d.existscxx . . $ QDir#exists(50ce9a9e25b4a850).()) |
| 96 | rval <<cxx . . $ QStringList#`operator<<`(85116071a693d053). custom_dir; |
| 97 | } |
| 98 | #ifdef QT_DEBUG |
| 99 | if(!rval.isEmpty()) { |
| 100 | qDebug() << "Using color-schemes: " << rval; |
| 101 | } else { |
| 102 | qDebug() << "Cannot find color-schemes in any location!"; |
| 103 | } |
| 104 | #endif |
| 105 | return rval; |
| 106 | } |