Обновление подмодулей
This commit is contained in:
commit
7b0128dfe3
@ -144,7 +144,7 @@ public:
|
||||
* @param container The container to assign from
|
||||
*/
|
||||
template< class ContiguousContainer >
|
||||
typename std::enable_if< is_contiguous_container<
|
||||
typename std::enable_if< is_contiguous_container< //NOLINT
|
||||
ContiguousContainer, T >::value,
|
||||
span& >::type
|
||||
operator=( ContiguousContainer&& container )
|
||||
|
@ -13,7 +13,14 @@ namespace myx {
|
||||
|
||||
namespace filesystem {
|
||||
|
||||
MYXLIB_INLINE Paths::Paths() = default;
|
||||
MYXLIB_INLINE Paths::Paths()
|
||||
{
|
||||
QFileInfo procSelfExe( QStringLiteral( "/proc/self/exe" ) );
|
||||
QFileInfo currentExecutable = procSelfExe.canonicalFilePath();
|
||||
m_executableName = currentExecutable.fileName();
|
||||
m_executableFilePath = currentExecutable.absoluteFilePath();
|
||||
m_executableDirectory = currentExecutable.absolutePath();
|
||||
}
|
||||
|
||||
|
||||
MYXLIB_INLINE void Paths::setupSystemDirectories( const QString& defaultPrefixDirectory,
|
||||
@ -172,20 +179,8 @@ MYXLIB_INLINE Paths::HierarchyType Paths::getHierarchyType()
|
||||
} // Paths::getHierarchyType
|
||||
|
||||
|
||||
MYXLIB_INLINE bool Paths::init( const QString& projectDir, const QString& configFileExtension )
|
||||
MYXLIB_INLINE bool Paths::initCommon()
|
||||
{
|
||||
QFileInfo procSelfExe( QStringLiteral( "/proc/self/exe" ) );
|
||||
QFileInfo currentExecutable = procSelfExe.canonicalFilePath();
|
||||
m_executableName = currentExecutable.fileName();
|
||||
m_executableFilePath = currentExecutable.absoluteFilePath();
|
||||
m_executableDirectory = currentExecutable.absolutePath();
|
||||
|
||||
m_projectName = projectDir.isEmpty() ? m_executableName
|
||||
: projectDir;
|
||||
m_configFileExtension = configFileExtension.isEmpty() ? QStringLiteral( "conf" )
|
||||
: configFileExtension;
|
||||
m_configFileName = m_projectName + "." + m_configFileExtension;
|
||||
|
||||
m_homeDirectory = QDir::homePath();
|
||||
m_tempDirectory = QDir::tempPath();
|
||||
|
||||
@ -214,6 +209,33 @@ MYXLIB_INLINE bool Paths::init( const QString& projectDir, const QString& config
|
||||
} // Paths::updatePaths
|
||||
|
||||
|
||||
MYXLIB_INLINE bool Paths::init()
|
||||
{
|
||||
m_projectName = m_executableName;
|
||||
m_configFileName = m_executableName + ".conf";
|
||||
return( initCommon() );
|
||||
}
|
||||
|
||||
|
||||
MYXLIB_INLINE bool Paths::init( const QString& configFileName )
|
||||
{
|
||||
m_projectName = m_executableName;
|
||||
m_configFileName = configFileName;
|
||||
return( initCommon() );
|
||||
}
|
||||
|
||||
|
||||
MYXLIB_INLINE bool Paths::init( const QString& projectName, const QString& configFileExtension )
|
||||
{
|
||||
m_projectName = projectName.isEmpty() ? m_executableName
|
||||
: projectName;
|
||||
auto ext = configFileExtension.isEmpty() ? QStringLiteral( "conf" )
|
||||
: configFileExtension;
|
||||
m_configFileName = m_projectName + "." + ext;
|
||||
return( initCommon() );
|
||||
}
|
||||
|
||||
|
||||
MYXLIB_INLINE bool Paths::makeDefaultDirectories()
|
||||
{
|
||||
bool status = true;
|
||||
@ -281,12 +303,6 @@ MYXLIB_INLINE const QString& Paths::configFileName() const
|
||||
}
|
||||
|
||||
|
||||
MYXLIB_INLINE const QString& Paths::configFileExtension() const
|
||||
{
|
||||
return( m_configFileExtension );
|
||||
}
|
||||
|
||||
|
||||
MYXLIB_INLINE const QString& Paths::userVarDataDirectory() const
|
||||
{
|
||||
return( m_userVarDataDirectory );
|
||||
|
@ -44,62 +44,6 @@ class Paths
|
||||
kDevelopment = 0x07
|
||||
};
|
||||
|
||||
/// @brief Тип расположения файлов по каталогам
|
||||
HierarchyType m_hierarchyType { HierarchyType::kFlat };
|
||||
|
||||
/// @brief Имя проекта, которое используется при формировании имён файлов и каталогов
|
||||
QString m_projectName;
|
||||
|
||||
QString m_executableName;
|
||||
QString m_executableFilePath;
|
||||
QString m_executableDirectory;
|
||||
|
||||
/// @brief Общий префикс для файлов проекта
|
||||
QString m_prefixDirectory;
|
||||
|
||||
/// @brief Путь к каталогу с временными файлами
|
||||
QString m_tempDirectory;
|
||||
/// @brief Путь к домашнему каталогу текущего пользователя
|
||||
QString m_homeDirectory;
|
||||
|
||||
/// @brief Путь к пользовательскому каталогу с изменяемыми файлами
|
||||
QString m_userVarDataDirectory;
|
||||
/// @brief Путь к системному каталогу с изменяемыми файлами
|
||||
QString m_systemVarDataDirectory;
|
||||
|
||||
/// @brief Путь к пользовательскому каталогу с неизменяемыми файлами
|
||||
QString m_userConstDataDirectory;
|
||||
/// @brief Путь к системному каталогу с неизменяемыми файлами
|
||||
QString m_systemConstDataDirectory;
|
||||
|
||||
/// @brief Путь к пользовательскому каталогу с журналами работы
|
||||
QString m_userLogDirectory;
|
||||
/// @brief Путь к системному каталогу с журналами работы
|
||||
QString m_systemLogDirectory;
|
||||
|
||||
/// @brief Путь к пользовательскому каталогу с файлами настройки
|
||||
QString m_userConfigDirectory;
|
||||
/// @brief Путь к системному каталогу с файлами настройки
|
||||
QString m_systemConfigDirectory;
|
||||
|
||||
/// @brief Полный путь к файлу настройки
|
||||
QString m_configFilePath;
|
||||
/// @brief Имя файла настройки
|
||||
QString m_configFileName;
|
||||
/// @brief Расширение для файла настройки
|
||||
QString m_configFileExtension;
|
||||
|
||||
void setupSystemDirectories( const QString& defaultPrefixDirectory,
|
||||
const QString& defaultEtcDirectory,
|
||||
const QString& defaultConstDataDirectory,
|
||||
const QString& defaultVarDataDirectory,
|
||||
const QString& defaultLogDirectory );
|
||||
HierarchyType getHierarchyType();
|
||||
|
||||
protected:
|
||||
Paths();
|
||||
~Paths() = default;
|
||||
|
||||
public:
|
||||
Paths( const Paths& ) = delete;
|
||||
Paths& operator=( const Paths& ) = delete;
|
||||
@ -120,7 +64,20 @@ public:
|
||||
/**
|
||||
* @brief Обновление путей с учётом расположения исполняемого файла
|
||||
*/
|
||||
bool init( const QString& projectDir, const QString& configFileExtension = QStringLiteral("conf") );
|
||||
bool init();
|
||||
|
||||
/**
|
||||
* @brief Обновление путей с учётом расположения исполняемого файла
|
||||
* @param configFileName Имя файла настроек
|
||||
*/
|
||||
bool init( const QString& configFileName );
|
||||
|
||||
/**
|
||||
* @brief Обновление путей с учётом расположения исполняемого файла
|
||||
* @param projectName Имя проекта
|
||||
* @param configFileExtension Расширение для файла настроек
|
||||
*/
|
||||
bool init( const QString& projectName, const QString& configFileExtension );
|
||||
|
||||
/**
|
||||
* @brief Создание стандартных каталогов
|
||||
@ -226,6 +183,62 @@ public:
|
||||
* @brief Имя подкаталога для проекта
|
||||
*/
|
||||
const QString& projectName() const;
|
||||
|
||||
protected:
|
||||
Paths();
|
||||
~Paths() = default;
|
||||
|
||||
private:
|
||||
/// @brief Тип расположения файлов по каталогам
|
||||
HierarchyType m_hierarchyType { HierarchyType::kFlat };
|
||||
|
||||
/// @brief Имя проекта, которое используется при формировании имён файлов и каталогов
|
||||
QString m_projectName;
|
||||
|
||||
QString m_executableName;
|
||||
QString m_executableFilePath;
|
||||
QString m_executableDirectory;
|
||||
|
||||
/// @brief Общий префикс для файлов проекта
|
||||
QString m_prefixDirectory;
|
||||
|
||||
/// @brief Путь к каталогу с временными файлами
|
||||
QString m_tempDirectory;
|
||||
/// @brief Путь к домашнему каталогу текущего пользователя
|
||||
QString m_homeDirectory;
|
||||
|
||||
/// @brief Путь к пользовательскому каталогу с изменяемыми файлами
|
||||
QString m_userVarDataDirectory;
|
||||
/// @brief Путь к системному каталогу с изменяемыми файлами
|
||||
QString m_systemVarDataDirectory;
|
||||
|
||||
/// @brief Путь к пользовательскому каталогу с неизменяемыми файлами
|
||||
QString m_userConstDataDirectory;
|
||||
/// @brief Путь к системному каталогу с неизменяемыми файлами
|
||||
QString m_systemConstDataDirectory;
|
||||
|
||||
/// @brief Путь к пользовательскому каталогу с журналами работы
|
||||
QString m_userLogDirectory;
|
||||
/// @brief Путь к системному каталогу с журналами работы
|
||||
QString m_systemLogDirectory;
|
||||
|
||||
/// @brief Путь к пользовательскому каталогу с файлами настройки
|
||||
QString m_userConfigDirectory;
|
||||
/// @brief Путь к системному каталогу с файлами настройки
|
||||
QString m_systemConfigDirectory;
|
||||
|
||||
/// @brief Полный путь к файлу настройки
|
||||
QString m_configFilePath;
|
||||
/// @brief Имя файла настройки
|
||||
QString m_configFileName;
|
||||
|
||||
void setupSystemDirectories( const QString& defaultPrefixDirectory,
|
||||
const QString& defaultEtcDirectory,
|
||||
const QString& defaultConstDataDirectory,
|
||||
const QString& defaultVarDataDirectory,
|
||||
const QString& defaultLogDirectory );
|
||||
bool initCommon();
|
||||
HierarchyType getHierarchyType();
|
||||
}; // class Paths
|
||||
|
||||
} // namespace filesystem
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef MYX_QT_POSIX_SIGNAL_WATCHER_CPP_
|
||||
#define MYX_QT_POSIX_SIGNAL_WATCHER_CPP_
|
||||
|
||||
#include <myx/core/config.hpp>
|
||||
#include <myx/backports/cpp/helpers.hpp>
|
||||
#include <myx/core/config.hpp>
|
||||
|
||||
#include <myx/qt/posix_signal_watcher.hpp>
|
||||
#include <myx/qt/posix_signal_watcher_p.hpp>
|
||||
@ -16,16 +16,16 @@ std::array< int, 2 > PosixSignalWatcherPrivate::mSockpair { { 0, 0 } };
|
||||
PosixSignalWatcherPrivate::~PosixSignalWatcherPrivate() = default;
|
||||
|
||||
PosixSignalWatcherPrivate::PosixSignalWatcherPrivate( PosixSignalWatcher* q ) :
|
||||
q_ptr( q )
|
||||
q_ptr( q )
|
||||
{
|
||||
#if MYX_QT_HAS_POSIX_SIGNALS
|
||||
#if MYX_QT_HAS_POSIX_SIGNALS
|
||||
// Create socket pair
|
||||
if ( ::socketpair( AF_UNIX, SOCK_STREAM, 0, mSockpair.data() ) != 0 )
|
||||
{
|
||||
qDebug() << "PosixSignalWatcher: socketpair: " << ::strerror( errno );
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Create a notifier for the read end of the pair
|
||||
// m_notifier.reset( new QSocketNotifier( mSockpair[1], QSocketNotifier::Read ) );
|
||||
@ -37,7 +37,7 @@ PosixSignalWatcherPrivate::PosixSignalWatcherPrivate( PosixSignalWatcher* q ) :
|
||||
Q_Q( PosixSignalWatcher );
|
||||
|
||||
int signal = 0;
|
||||
(void)!::read( sockfd, &signal, sizeof( signal ) );
|
||||
Q_UNUSED( !::read( sockfd, &signal, sizeof( signal ) ) );
|
||||
qDebug() << "Caught signal: " << ::strsignal( signal );
|
||||
Q_EMIT q->posixSignal( signal );
|
||||
} );
|
||||
@ -61,19 +61,20 @@ MYXLIB_INLINE void PosixSignalWatcherPrivate::watchForSignal( int signal )
|
||||
return;
|
||||
}
|
||||
|
||||
#if MYX_QT_HAS_POSIX_SIGNALS
|
||||
#if MYX_QT_HAS_POSIX_SIGNALS
|
||||
// Register a sigaction which will write to the socket pair
|
||||
struct sigaction sigact;
|
||||
struct sigaction sigact; //NOLINT
|
||||
sigact.sa_handler = PosixSignalWatcherPrivate::signalHandler; //NOLINT
|
||||
sigact.sa_flags = 0;
|
||||
sigemptyset( &sigact.sa_mask );
|
||||
sigact.sa_flags |= SA_RESTART;
|
||||
sigact.sa_flags |= SA_RESTART;
|
||||
sigact.sa_restorer = nullptr;
|
||||
if ( ::sigaction( signal, &sigact, nullptr ) != 0 )
|
||||
{
|
||||
qDebug() << "PosixSignalWatcher: sigaction: " << ::strerror( errno );
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
m_watchedSignals.append( signal );
|
||||
} // PosixSignalWatcherPrivate::watchForSignal
|
||||
@ -85,7 +86,7 @@ MYXLIB_INLINE void PosixSignalWatcherPrivate::watchForSignal( int signal )
|
||||
*/
|
||||
MYXLIB_INLINE void PosixSignalWatcherPrivate::signalHandler( int signal )
|
||||
{
|
||||
(void)!::write( mSockpair[0], &signal, sizeof( signal ) );
|
||||
Q_UNUSED( !::write( mSockpair[0], &signal, sizeof( signal ) ) );
|
||||
}
|
||||
|
||||
|
||||
@ -93,8 +94,8 @@ MYXLIB_INLINE void PosixSignalWatcherPrivate::signalHandler( int signal )
|
||||
* Create a new PosixSignalWatcher as a child of the given \a parent.
|
||||
*/
|
||||
MYXLIB_INLINE PosixSignalWatcher::PosixSignalWatcher( QObject* parent ) :
|
||||
QObject( parent ),
|
||||
d_ptr ( new PosixSignalWatcherPrivate( this ) )
|
||||
QObject( parent ),
|
||||
d_ptr ( new PosixSignalWatcherPrivate( this ) )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef MYX_QT_TRANSLATORS_CPP_
|
||||
#define MYX_QT_TRANSLATORS_CPP_
|
||||
|
||||
#include <myx/core/config.hpp>
|
||||
#include <myx/backports/qt/common.hpp>
|
||||
#include <myx/core/config.hpp>
|
||||
|
||||
#include <myx/qt/translators.hpp>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user