diff --git a/default_settings.h b/default_settings.h index 122500c..bf24142 100644 --- a/default_settings.h +++ b/default_settings.h @@ -28,6 +28,7 @@ static Q_DECL_CONSTEXPR FolderAtStartup DEFAULT_FOLDER_AT_STARTUP_TYPE = FolderA static Q_DECL_CONSTEXPR char DEFAULT_FOLDER_PATH_AT_STARTUP[] = ""; static Q_DECL_CONSTEXPR SectionType DEFAULT_SORT_SECTION_TYPE = SectionType::FileName; +static Q_DECL_CONSTEXPR SectionType DEFAULT_SORT_SECTION_TYPE_2ND = SectionType::NoSpecify; static Q_DECL_CONSTEXPR SortDirsType DEFAULT_SORT_DIRS_TYPE = SortDirsType::NoSpecify; static Q_DECL_CONSTEXPR bool DEFAULT_SORT_DOT_FIRST = true; static Q_DECL_CONSTEXPR Qt::CaseSensitivity DEFAULT_SORT_CASE_SENSITIVITY = Qt::CaseInsensitive; diff --git a/settings.cpp b/settings.cpp index c3b97c4..8ff6f59 100644 --- a/settings.cpp +++ b/settings.cpp @@ -91,6 +91,7 @@ void Settings::initialize() // Left side Sort settings m_leftSortSectionType = getValueSortSectionType("left"); + m_leftSortSectionType2nd = getValueSortSectionType2nd("left"); m_leftSortDirsType = getValueSortDirsType("left"); m_leftSortDotFirst = getValueSortDotFirst("left"); m_leftSortCaseSensitivity = getValueSortCaseSensitivity("left"); @@ -98,6 +99,7 @@ void Settings::initialize() // Right side Sort settings m_rightSortSectionType = getValueSortSectionType("right"); + m_rightSortSectionType2nd = getValueSortSectionType2nd("right"); m_rightSortDirsType = getValueSortDirsType("right"); m_rightSortDotFirst = getValueSortDotFirst("right"); m_rightSortCaseSensitivity = getValueSortCaseSensitivity("right"); @@ -318,6 +320,7 @@ void Settings::flush() // Left side Sort settings setValueSortSectionType(m_leftSortSectionType, "left"); + setValueSortSectionType2nd(m_leftSortSectionType2nd, "left"); setValueSortDirsType(m_leftSortDirsType, "left"); setValueSortDotFirst(m_leftSortDotFirst, "left"); setValueSortCaseSensitivity(m_leftSortCaseSensitivity, "left"); @@ -325,6 +328,7 @@ void Settings::flush() // Right side Sort settings setValueSortSectionType(m_rightSortSectionType, "right"); + setValueSortSectionType2nd(m_rightSortSectionType2nd, "right"); setValueSortDirsType(m_rightSortDirsType, "right"); setValueSortDotFirst(m_rightSortDotFirst, "right"); setValueSortCaseSensitivity(m_rightSortCaseSensitivity, "right"); @@ -595,6 +599,21 @@ SectionType Settings::getValueSortSectionType(const QString& prefix) return ret; } +SectionType Settings::getValueSortSectionType2nd(const QString& prefix) +{ + SectionType ret = DEFAULT_SORT_SECTION_TYPE_2ND; + + QString sortTypeValue = value("main/" + prefix + "SortType2nd").toString(); + ret = (sortTypeValue == "lastModified") ? SectionType::LastModified : + (sortTypeValue == "size") ? SectionType::FileSize : + (sortTypeValue == "type") ? SectionType::FileType : + (sortTypeValue == "name") ? SectionType::FileName : + (sortTypeValue == "none") ? SectionType::NoSpecify : + DEFAULT_SORT_SECTION_TYPE_2ND; + + return ret; +} + SortDirsType Settings::getValueSortDirsType(const QString& prefix) { SortDirsType ret = DEFAULT_SORT_DIRS_TYPE; @@ -646,6 +665,16 @@ void Settings::setValueSortSectionType(SectionType sectionType, const QString& p setValue("main/" + prefix + "SortType", sortTypeValue); } +void Settings::setValueSortSectionType2nd(SectionType sectionType2nd, const QString& prefix) +{ + QString sortTypeValue = (sectionType2nd == SectionType::LastModified) ? "lastModified" : + (sectionType2nd == SectionType::FileSize) ? "size" : + (sectionType2nd == SectionType::FileType) ? "type" : + (sectionType2nd == SectionType::FileName) ? "name" : + "none"; + setValue("main/" + prefix + "SortType2nd", sortTypeValue); +} + void Settings::setValueSortDirsType(SortDirsType dirsType, const QString& prefix) { QString sortDirsValue = (dirsType == SortDirsType::First) ? "first" : diff --git a/settings.h b/settings.h index e27f1c8..fb3f6a5 100644 --- a/settings.h +++ b/settings.h @@ -62,22 +62,26 @@ class Settings : public QSettings void setRightFolderPath(const QString& rightFolderPath) { m_rightFolderPath = rightFolderPath; } SectionType getLeftSortSectionType() { return m_leftSortSectionType; } + SectionType getLeftSortSectionType2nd() { return m_leftSortSectionType2nd; } SortDirsType getLeftSortDirsType() { return m_leftSortDirsType; } bool getLeftSortDotFirst() { return m_leftSortDotFirst; } Qt::CaseSensitivity getLeftSortCaseSensitivity() { return m_leftSortCaseSensitivity; } Qt::SortOrder getLeftSortOrder() { return m_leftSortOrder; } void setLeftSortSectionType(SectionType sectionType) { m_leftSortSectionType = sectionType; } + void setLeftSortSectionType2nd(SectionType sectionType2nd) { m_leftSortSectionType2nd = sectionType2nd; } void setLeftSortDirsType(SortDirsType dirsType) { m_leftSortDirsType = dirsType; } void setLeftSortDotFirst(bool dotFirst) { m_leftSortDotFirst = dotFirst; } void setLeftSortCaseSensitivity(Qt::CaseSensitivity caseSensitivity) { m_leftSortCaseSensitivity = caseSensitivity; } void setLeftSortOrder(Qt::SortOrder order) { m_leftSortOrder = order; } SectionType getRightSortSectionType() { return m_rightSortSectionType; } + SectionType getRightSortSectionType2nd() { return m_rightSortSectionType2nd; } SortDirsType getRightSortDirsType() { return m_rightSortDirsType; } bool getRightSortDotFirst() { return m_rightSortDotFirst; } Qt::CaseSensitivity getRightSortCaseSensitivity() { return m_rightSortCaseSensitivity; } Qt::SortOrder getRightSortOrder() { return m_rightSortOrder; } void setRightSortSectionType(SectionType sectionType) { m_rightSortSectionType = sectionType; } + void setRightSortSectionType2nd(SectionType sectionType2nd) { m_rightSortSectionType2nd = sectionType2nd; } void setRightSortDirsType(SortDirsType dirsType) { m_rightSortDirsType = dirsType; } void setRightSortDotFirst(bool dotFirst) { m_rightSortDotFirst = dotFirst; } void setRightSortCaseSensitivity(Qt::CaseSensitivity caseSensitivity) { m_rightSortCaseSensitivity = caseSensitivity; } @@ -192,11 +196,13 @@ class Settings : public QSettings QColor getValueColorSetting(const QString& key, const QColor& defColor); SectionType getValueSortSectionType(const QString& prefix); + SectionType getValueSortSectionType2nd(const QString& prefix); SortDirsType getValueSortDirsType(const QString& prefix); bool getValueSortDotFirst(const QString& prefix); Qt::CaseSensitivity getValueSortCaseSensitivity(const QString& prefix); Qt::SortOrder getValueSortOrder(const QString& prefix); void setValueSortSectionType(SectionType sectionType, const QString& prefix); + void setValueSortSectionType2nd(SectionType sectionType2nd, const QString& prefix); void setValueSortDirsType(SortDirsType dirsType, const QString& prefix); void setValueSortDotFirst(bool dotFirst, const QString& prefix); void setValueSortCaseSensitivity(Qt::CaseSensitivity caseSensitivity, const QString& prefix); @@ -226,11 +232,13 @@ class Settings : public QSettings QString m_rightFolderPath = DEFAULT_FOLDER_PATH_AT_STARTUP; SectionType m_leftSortSectionType = DEFAULT_SORT_SECTION_TYPE; + SectionType m_leftSortSectionType2nd = DEFAULT_SORT_SECTION_TYPE_2ND; SortDirsType m_leftSortDirsType = DEFAULT_SORT_DIRS_TYPE; bool m_leftSortDotFirst = DEFAULT_SORT_DOT_FIRST; Qt::CaseSensitivity m_leftSortCaseSensitivity = DEFAULT_SORT_CASE_SENSITIVITY; Qt::SortOrder m_leftSortOrder = DEFAULT_SORT_ORDER; SectionType m_rightSortSectionType = DEFAULT_SORT_SECTION_TYPE; + SectionType m_rightSortSectionType2nd = DEFAULT_SORT_SECTION_TYPE_2ND; SortDirsType m_rightSortDirsType = DEFAULT_SORT_DIRS_TYPE; bool m_rightSortDotFirst = DEFAULT_SORT_DOT_FIRST; Qt::CaseSensitivity m_rightSortCaseSensitivity = DEFAULT_SORT_CASE_SENSITIVITY; diff --git a/types.h b/types.h index ea33f11..024a5ab 100644 --- a/types.h +++ b/types.h @@ -61,6 +61,7 @@ enum class SectionType : int FileType, FileSize, LastModified, + NoSpecify, SectionTypeNum };