diff --git a/.gitignore b/.gitignore index ddeb82d..fccb48b 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,7 @@ libProjectManager/release/ /u_test/debug /SplitView/debug /u_test/release +/GenericConsole/debug +/x64/Debug +/x64/Release +/GenericConsole/debug/qmake/temp diff --git a/GenericConsole/GenericConsole.vcxproj b/GenericConsole/GenericConsole.vcxproj deleted file mode 100644 index ea3f97a..0000000 --- a/GenericConsole/GenericConsole.vcxproj +++ /dev/null @@ -1,159 +0,0 @@ - - - - - Release - x64 - - - Debug - x64 - - - - {5BB4976A-6252-3E36-851D-7F17F16DF17D} - GenericConsole - QtVS_v304 - 10.0.22621.0 - 10.0.22621.0 - $(MSBuildProjectDirectory)\QtMsBuild - - - v141 - release\ - false - NotSet - DynamicLibrary - release\ - GenericConsole - - - v141 - debug\ - false - NotSet - DynamicLibrary - debug\ - GenericConsole - - - - - - - - - - debug\debug\GenericConsoletruerelease\release\GenericConsoletruefalse5.12.11_msvc2017_64core5.12.11_msvc2017_64core - - - - GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;release;%(AdditionalIncludeDirectories) - -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus /utf-8 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) - release\ - false - None - 4577;4467;%(DisableSpecificWarnings) - Sync - release\ - MaxSpeed - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;GENERICCONSOLE_LIBRARY;QT_NO_DEBUG;NDEBUG;%(PreprocessorDefinitions) - false - - MultiThreadedDLL - true - true - Level3 - true - - %(AdditionalDependencies) - %(AdditionalLibraryDirectories) - true - false - true - true - false - $(OutDir)\GenericConsole.dll - true - Windows - true - - - Unsigned - None - 0 - - - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;GENERICCONSOLE_LIBRARY;QT_NO_DEBUG;%(PreprocessorDefinitions) - - - - - GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;debug;%(AdditionalIncludeDirectories) - -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus /utf-8 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) - debug\ - false - ProgramDatabase - 4577;4467;%(DisableSpecificWarnings) - Sync - debug\ - Disabled - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;GENERICCONSOLE_LIBRARY;%(PreprocessorDefinitions) - false - MultiThreadedDebugDLL - true - true - Level3 - true - - %(AdditionalDependencies) - %(AdditionalLibraryDirectories) - true - true - true - true - $(OutDir)\GenericConsole.dll - true - Windows - true - - - Unsigned - None - 0 - - - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;GENERICCONSOLE_LIBRARY;_DEBUG;%(PreprocessorDefinitions) - - - - - - - - - - - - Document - true - $(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs) - cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus /utf-8 -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2>NUL >debug\moc_predefs.h - Generate moc_predefs.h - debug\moc_predefs.h;%(Outputs) - - - Document - $(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs) - cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus /utf-8 -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2>NUL >release\moc_predefs.h - Generate moc_predefs.h - release\moc_predefs.h;%(Outputs) - true - - - - - - - - \ No newline at end of file diff --git a/GenericConsole/GenericConsole.vcxproj.filters b/GenericConsole/GenericConsole.vcxproj.filters deleted file mode 100644 index 807f519..0000000 --- a/GenericConsole/GenericConsole.vcxproj.filters +++ /dev/null @@ -1,65 +0,0 @@ - - - - - {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} - cpp;c;cxx;moc;h;def;odl;idl;res; - - - {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} - cpp;c;cxx;moc;h;def;odl;idl;res; - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} - ts;xlf - false - - - {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} - ts;xlf - false - - - - - Source Files - - - - - Header Files - - - Header Files - - - - - Generated Files - - - Generated Files - - - - - Translation Files - - - \ No newline at end of file diff --git a/GenericConsole/GenericConsole.vcxproj.user b/GenericConsole/GenericConsole.vcxproj.user deleted file mode 100644 index be25078..0000000 --- a/GenericConsole/GenericConsole.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/GenericConsole/debug/GenericConsole.Build.CppClean.log b/GenericConsole/debug/GenericConsole.Build.CppClean.log deleted file mode 100644 index d0a6039..0000000 --- a/GenericConsole/debug/GenericConsole.Build.CppClean.log +++ /dev/null @@ -1,18 +0,0 @@ -d:\projects\cpp\qtnoveldesc\genericconsole\debug\vc141.pdb -d:\projects\cpp\qtnoveldesc\genericconsole\debug\commandsdispatcher.obj -d:\projects\cpp\qtnoveldesc\genericconsole\debug\moc_predefs.h -d:\projects\cpp\qtnoveldesc\genericconsole\debug\genericconsole.lib -d:\projects\cpp\qtnoveldesc\genericconsole\debug\genericconsole.exp -d:\projects\cpp\qtnoveldesc\genericconsole\debug\genericconsole.ilk -d:\projects\cpp\qtnoveldesc\genericconsole\debug\genericconsole.dll -d:\projects\cpp\qtnoveldesc\genericconsole\debug\genericconsole.pdb -d:\projects\cpp\qtnoveldesc\genericconsole\debug\genericconsole.tlog\cl.command.1.tlog -d:\projects\cpp\qtnoveldesc\genericconsole\debug\genericconsole.tlog\cl.read.1.tlog -d:\projects\cpp\qtnoveldesc\genericconsole\debug\genericconsole.tlog\cl.write.1.tlog -d:\projects\cpp\qtnoveldesc\genericconsole\debug\genericconsole.tlog\custombuild.command.1.tlog -d:\projects\cpp\qtnoveldesc\genericconsole\debug\genericconsole.tlog\custombuild.read.1.tlog -d:\projects\cpp\qtnoveldesc\genericconsole\debug\genericconsole.tlog\custombuild.write.1.tlog -d:\projects\cpp\qtnoveldesc\genericconsole\debug\genericconsole.tlog\genericconsole.write.1u.tlog -d:\projects\cpp\qtnoveldesc\genericconsole\debug\genericconsole.tlog\link.command.1.tlog -d:\projects\cpp\qtnoveldesc\genericconsole\debug\genericconsole.tlog\link.read.1.tlog -d:\projects\cpp\qtnoveldesc\genericconsole\debug\genericconsole.tlog\link.write.1.tlog diff --git a/GenericConsole/debug/GenericConsole.tlog/CL.read.1.tlog b/GenericConsole/debug/GenericConsole.tlog/CL.read.1.tlog deleted file mode 100644 index 73aee61..0000000 Binary files a/GenericConsole/debug/GenericConsole.tlog/CL.read.1.tlog and /dev/null differ diff --git a/GenericConsole/debug/GenericConsole.tlog/CL.write.1.tlog b/GenericConsole/debug/GenericConsole.tlog/CL.write.1.tlog deleted file mode 100644 index 93273e4..0000000 Binary files a/GenericConsole/debug/GenericConsole.tlog/CL.write.1.tlog and /dev/null differ diff --git a/GenericConsole/debug/GenericConsole.tlog/GenericConsole.lastbuildstate b/GenericConsole/debug/GenericConsole.tlog/GenericConsole.lastbuildstate deleted file mode 100644 index 881cd64..0000000 --- a/GenericConsole/debug/GenericConsole.tlog/GenericConsole.lastbuildstate +++ /dev/null @@ -1,2 +0,0 @@ -#TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.22621.0 -Debug|x64|D:\Projects\Cpp\QtNovelDesc\| diff --git a/GenericConsole/debug/GenericConsole.tlog/custombuild.command.1.tlog b/GenericConsole/debug/GenericConsole.tlog/custombuild.command.1.tlog deleted file mode 100644 index 5808441..0000000 Binary files a/GenericConsole/debug/GenericConsole.tlog/custombuild.command.1.tlog and /dev/null differ diff --git a/GenericConsole/debug/GenericConsole.tlog/custombuild.read.1.tlog b/GenericConsole/debug/GenericConsole.tlog/custombuild.read.1.tlog deleted file mode 100644 index eba3a5f..0000000 Binary files a/GenericConsole/debug/GenericConsole.tlog/custombuild.read.1.tlog and /dev/null differ diff --git a/GenericConsole/debug/GenericConsole.tlog/custombuild.write.1.tlog b/GenericConsole/debug/GenericConsole.tlog/custombuild.write.1.tlog deleted file mode 100644 index 4028220..0000000 Binary files a/GenericConsole/debug/GenericConsole.tlog/custombuild.write.1.tlog and /dev/null differ diff --git a/GenericConsole/debug/GenericConsole.tlog/link.read.1.tlog b/GenericConsole/debug/GenericConsole.tlog/link.read.1.tlog deleted file mode 100644 index 4c714eb..0000000 Binary files a/GenericConsole/debug/GenericConsole.tlog/link.read.1.tlog and /dev/null differ diff --git a/GenericConsole/debug/moc_predefs.h.cbt b/GenericConsole/debug/moc_predefs.h.cbt deleted file mode 100644 index 66dd8e7..0000000 --- a/GenericConsole/debug/moc_predefs.h.cbt +++ /dev/null @@ -1 +0,0 @@ -This is a dummy file needed to create debug/moc_predefs.h diff --git a/GenericConsole/debug/qmake/temp/moc_predefs.h.cbt b/GenericConsole/debug/qmake/temp/moc_predefs.h.cbt deleted file mode 100644 index 693383c..0000000 --- a/GenericConsole/debug/qmake/temp/moc_predefs.h.cbt +++ /dev/null @@ -1 +0,0 @@ -This is a dummy file needed to create ./moc_predefs.h diff --git a/GenericConsole/debug/qmake/temp/props.txt b/GenericConsole/debug/qmake/temp/props.txt deleted file mode 100644 index 927788a..0000000 --- a/GenericConsole/debug/qmake/temp/props.txt +++ /dev/null @@ -1,25 +0,0 @@ -QT_SYSROOT: -QT_INSTALL_PREFIX:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64 -QT_INSTALL_ARCHDATA:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64 -QT_INSTALL_DATA:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64 -QT_INSTALL_DOCS:C:/Qt/Qt5.12.11/Docs/Qt-5.12.11 -QT_INSTALL_HEADERS:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/include -QT_INSTALL_LIBS:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/lib -QT_INSTALL_LIBEXECS:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/bin -QT_INSTALL_BINS:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/bin -QT_INSTALL_TESTS:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/tests -QT_INSTALL_PLUGINS:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/plugins -QT_INSTALL_IMPORTS:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/imports -QT_INSTALL_QML:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/qml -QT_INSTALL_TRANSLATIONS:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/translations -QT_INSTALL_CONFIGURATION: -QT_INSTALL_EXAMPLES:C:/Qt/Qt5.12.11/Examples/Qt-5.12.11 -QT_INSTALL_DEMOS:C:/Qt/Qt5.12.11/Examples/Qt-5.12.11 -QT_HOST_PREFIX:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64 -QT_HOST_DATA:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64 -QT_HOST_BINS:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/bin -QT_HOST_LIBS:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/lib -QMAKE_SPEC:win32-msvc -QMAKE_XSPEC:win32-msvc -QMAKE_VERSION:3.1 -QT_VERSION:5.12.11 diff --git a/GenericConsole/debug/qmake/temp/qtvars.pro b/GenericConsole/debug/qmake/temp/qtvars.pro deleted file mode 100644 index 35a36b7..0000000 --- a/GenericConsole/debug/qmake/temp/qtvars.pro +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG += no_fixpath -QT += core diff --git a/GenericConsole/debug/qmake/temp/qtvars.vcxproj.filters b/GenericConsole/debug/qmake/temp/qtvars.vcxproj.filters deleted file mode 100644 index a5e61b7..0000000 --- a/GenericConsole/debug/qmake/temp/qtvars.vcxproj.filters +++ /dev/null @@ -1,14 +0,0 @@ - - - - - {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} - cpp;c;cxx;moc;h;def;odl;idl;res; - - - - - Generated Files - - - \ No newline at end of file diff --git a/GenericConsole/debug/qt.natvis b/GenericConsole/debug/qt.natvis deleted file mode 100644 index 1c57947..0000000 --- a/GenericConsole/debug/qt.natvis +++ /dev/null @@ -1,839 +0,0 @@ - - - - - - - {{{data1,Xb}-{data2,Xb}-{data3,Xb}-{(data4[0]),nvoXb}{(data4[1]),nvoXb}-{(data4[2]),nvoXb}{(data4[3]),nvoXb}{(data4[4]),nvoXb}{(data4[5]),nvoXb}{(data4[6]),nvoXb}{(data4[7]),nvoXb}}} - - - - - {{ x = {xp}, y = {yp} }} - - xp - yp - - - - - {{ x = {x1}, y = {y1}, width = {x2 - x1 + 1}, height = {y2 - y1 + 1} }} - - x1 - y1 - x2 - x1 + 1 - y2 - y1 + 1 - - - - - {{ x = {xp}, y = {yp}, width = {w}, height = {h} }} - - xp - yp - w - h - - - - - - {{ width = {wd}, height = {ht} }} - - wd - ht - - - - - - {{ start point = {pt1}, end point = {pt2} }} - - - {pt1} - - pt1 - - - - {pt2} - - pt2 - - - - - - - - {{ size = {d->size} }} - - d->ref.atomic._q_value - - d->size - (QPoint*)((reinterpret_cast<char*>(d)) + d->offset) - - - - - - {{ size = {d->size} }} - - - d->size > 0 - && ((((QPointF*)((reinterpret_cast<char*>(d)) + d->offset)[0]).xp - == (((QPointF*)((reinterpret_cast<char*>(d)) + d->offset)[d->size - 1]).xp) - && ((((QPointF*)((reinterpret_cast<char*>(d)) + d->offset)[0]).yp - == (((QPointF*)((reinterpret_cast<char*>(d)) + d->offset)[d->size - 1]).yp) - - d->ref.atomic._q_value - - d->size - (QPointF*)((reinterpret_cast<char*>(d)) + d->offset) - - - - - - {{ x = {xp}, y = {yp} }} - - xp - yp - - - - - {{ x = {xp}, y = {yp}, z = {zp} }} - - xp - yp - zp - - - - - {{ x = {xp}, y = {yp}, z = {zp}, w = {wp} }} - - xp - yp - zp - wp - - - - - - {{ m11 = {_m11}, m12 = {_m12}, m21 = {_m21}, m22 = {_m22}, ... }} - - - _m11 - _m12 - _m21 - _m22 - _dx - _dy - - - - - - {{ m11 = {m[0][0]}, m12 = {m[1][0]}, m13 = {m[2][0]}, m14 = {m[3][0]}, ... }} - - - m[0][0] - m[1][0] - m[2][0] - m[3][0] - m[0][1] - m[1][1] - m[2][1] - m[3][1] - m[0][2] - m[1][2] - m[2][2] - m[3][2] - m[0][3] - m[1][3] - m[2][3] - m[3][3] - - - - - - {{ horizontal = {static_cast<Policy>(bits.horPolicy)}, vertical = {static_cast<Policy>(bits.verPolicy)}, type = {ControlType(1 << bits.ctype)} }} - - - - QSizePolicy::Policy::{static_cast<Policy>(bits.verPolicy)} - - - QSizePolicy::Policy::{static_cast<Policy>(bits.horPolicy)} - - - QSizePolicy::ControlType::{ControlType(1 << bits.ctype)} - - - - Qt::Vertical (2) - - - Qt::Horizontal (1) - - - static_cast<int>(bits.verStretch) - static_cast<int>(bits.horStretch) - bits.hfw == 1 - bits.wfh == 1 - - - - - {ucs,c} - ucs,c - - ucs > 0xff ? '\0' : char(ucs),c - ucs,c - - - - - {((reinterpret_cast<unsigned short*>(d)) + d->offset / 2),sub} - ((reinterpret_cast<unsigned short*>(d)) + d->offset / 2),sub - - d->size - d->ref.atomic._q_value - - d->size - ((reinterpret_cast<unsigned short*>(d)) + d->offset / 2),c - - - - - - - {m_string,[m_size]} u"" - {offset() + m_position,[m_size]} - - m_position - m_size - - m_size - offset()+m_position - - - - - - {m_data,[m_size]} - m_data,[m_size] - - m_size - - m_size - m_data - - - - - - {((reinterpret_cast<char*>(d)) + d->offset),sb} - ((reinterpret_cast<char*>(d)) + d->offset),sb - - d->size - d->ref.atomic._q_value - - d->size - ((reinterpret_cast<char*>(d)) + d->offset),c - - - - - - - - - - - - - - - - - - - - {scheme()}://{host()}{path()} - {path()} - - scheme() - username() - password() - host() - path() - query() - fragment() - - - - - {{ size = {(d.d->size << 3) - *((reinterpret_cast<char*>(d.d)) + d.d->offset)} }} - - d.d->ref.atomic._q_value - - (d.d->size << 3) - *((reinterpret_cast<char*>(d.d)) + d.d->offset) - - (*(reinterpret_cast<const unsigned char*>((reinterpret_cast<char*>(d.d)) + d.d->offset) + 1 - + ($i >> 3)) & (1 << ($i & 7))) != 0 - - - - - - - - {{ size = {s} }} - - a - - s - ptr - - - - - - {{ julian day = {jd} }} - - - - - {{ millisecond = {mds} }} - {{ milliseconds = {mds} }} - - mds / 3600000, d - mds / 3600000, d - (mds % 3600000) / 60000, d - (mds % 3600000) / 60000, d - (mds / 1000) % 60, d - (mds / 1000) % 60, d - mds % 1000, d - mds % 1000, d - - - - - {d.pattern} - - - - - ref._q_value - - - - - strong reference to shared pointer of type {"$T1"} - - value == 0 - d->weakref._q_value - d->strongref._q_value - - - - - pointer to implicit shared object of type {"$T1"} - - d - - - - - pointer to explicit shared object of type {"$T1"} - - d - - - - - guarded pointer to subclass of QObject of type {"$T1"} - - wp.d == 0 || wp.d->strongref._q_value == 0 || wp.value == 0 - - - - - weak reference to shared pointer of type {"$T1"} - - d == 0 || d->strongref._q_value == 0 || value == 0 - d->weakref._q_value - d->strongref._q_value - - - - - scoped pointer to a dynamically allocated object of type {"$T1"} - - !d - - - - - scoped pointer to dynamically allocated array of objects of type {"$T1"} - - !d - - - - - ({first}, {second}) - - first - second - - - - - - {{ size = {d->size} }} - - d->ref.atomic._q_value - - d->size - ($T1*)((reinterpret_cast<char*>(d)) + d->offset) - - - - - - - {{ size = {d->end - d->begin} }} - - d->ref.atomic._q_value - - d->end - d->begin - *reinterpret_cast<$T1*>((sizeof($T1) > sizeof(void*)) - ? reinterpret_cast<Node*>(d->array + d->begin + $i)->v - : reinterpret_cast<$T1*>(d->array + d->begin + $i)) - - - - - - - {{ size = {d->end - d->begin} }} - - d->ref.atomic._q_value - - d->end - d->begin - - *reinterpret_cast<QString*>((sizeof(QString) > sizeof(void*)) - ? reinterpret_cast<Node*>(d->array + d->begin + $i)->v - : reinterpret_cast<QString*>(d->array + d->begin + $i)) - - - - - - - {{ size = {d->end - d->begin} }} - - d->ref.atomic._q_value - - d->end - d->begin - - *reinterpret_cast<QVariant*>((sizeof(QVariant) > sizeof(void*)) - ? reinterpret_cast<Node*>(d->array + d->begin + $i)->v - : reinterpret_cast<QVariant*>(d->array + d->begin + $i)) - - - - - - - {{ size = {d->size} }} - - d->ref.atomic._q_value - - d->size - d->n - n - (*(QLinkedListNode<$T1>*)this).t - - - - - - ({key}, {value}) - - key - value - - - - - - {{ size = {d->size} }} - - d->ref.atomic._q_value - - d->size - d->header.left - left - right - *((QMapNode<$T1,$T2>*)this) - - - - - - (empty) - ({key}, {value}) - - key - value - next - - - - - - {{ size = {d->size} }} - - - d->numBuckets - reinterpret_cast<Node **>(d->buckets) - - - - - - - d->size - - - node = *(bucket++) - --n - - - keyValuePair = reinterpret_cast<Node *>(node) - keyValuePair->value - node = node->next - - - - - - - - (empty) - ({key}) - - key - - - - - {{ size = {q_hash.d->size} }} - - q_hash - - - - - ({*keyPtr}, {*t}) - - *keyPtr - *t - - - - - {{ size = {hash.d->size} }} - - mx - total - hash.d->ref.atomic._q_value - - hash.d->size - f - n - *((Node*)this) - - - - - - - - - - - - - - {{ row count = {(*d_ptr.d).rows()}, column count = {(*d_ptr.d).columns()} }} - - d_ptr.d,! - (*d_ptr.d).rows() - (*d_ptr.d).columns() - - - - - - - Invalid - {d.data.b} - {d.data.i} - {d.data.u} - {d.data.ll} - {d.data.ull} - {d.data.d} - {d.data.c} - - {*((QMap<QString,QVariant>*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr)))} - - - {*((QList<QVariant>*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr)))} - - - {*((QString*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr)))} - - - {*((QStringList*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr)))} - - - {*((QByteArray*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr)))} - - - {*((QBitArray*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr)))} - - - {*((QDate*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr)))} - - - {*((QTime*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr)))} - - DateTime - Url - Locale - - {*((QRect*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr)))} - - - {*((QRectF*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr)))} - - - {*((QSize*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr)))} - - - {*((QSizeF*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr)))} - - - {*((QLine*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr)))} - - - {*((QLineF*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr)))} - - - {*((QPoint*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr)))} - - - {*((QPointF*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr)))} - - RegExp - RegularExpression - - {*((QHash<QString,QVariant>*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr)))} - - EasingCurve - Uuid - ModelIndex - LastCoreType - Font - Pixmap - Brush - Color - Palette - Image - Polygon - Region - Bitmap - Cursor - KeySequence - Pen - TextLength - TextFormat - Matrix - Transform - Matrix4x4 - Vector2D - Vector3D - Vector4D - Quaternion - PolygonF - Icon - LastGuiType - SizePolicy - UserType - LastType - - - - - - d.data.c - - - *((QString*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr))) - - - - *((QByteArray*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr))) - - - - - - - - - *((QMap<QString,QVariant>*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr))) - - - *((QList<QVariant>*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr))) - - - *((QString*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr))) - - - *((QStringList*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr))) - - - *((QByteArray*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr))) - - - *((QBitArray*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr))) - - - *((QDate*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr))) - - - *((QTime*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr))) - - - *((QRect*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr))) - - - *((QRectF*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr))) - - - *((QSize*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr))) - - - *((QSizeF*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr))) - - - *((QLine*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr))) - - - *((QLineF*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr))) - - - *((QPoint*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr))) - - - *((QPointF*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr))) - - - *((QHash<QString,QVariant>*)(d.is_shared ? d.data.shared->ptr - : reinterpret_cast<const void *>(&d.data.ptr))) - - - - - - - diff --git a/GenericConsole/release/moc_predefs.h.cbt b/GenericConsole/release/moc_predefs.h.cbt deleted file mode 100644 index 92a8741..0000000 --- a/GenericConsole/release/moc_predefs.h.cbt +++ /dev/null @@ -1 +0,0 @@ -This is a dummy file needed to create release/moc_predefs.h diff --git a/GenericConsole/release/qmake/temp/moc_predefs.h.cbt b/GenericConsole/release/qmake/temp/moc_predefs.h.cbt deleted file mode 100644 index 693383c..0000000 --- a/GenericConsole/release/qmake/temp/moc_predefs.h.cbt +++ /dev/null @@ -1 +0,0 @@ -This is a dummy file needed to create ./moc_predefs.h diff --git a/GenericConsole/release/qmake/temp/props.txt b/GenericConsole/release/qmake/temp/props.txt deleted file mode 100644 index 927788a..0000000 --- a/GenericConsole/release/qmake/temp/props.txt +++ /dev/null @@ -1,25 +0,0 @@ -QT_SYSROOT: -QT_INSTALL_PREFIX:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64 -QT_INSTALL_ARCHDATA:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64 -QT_INSTALL_DATA:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64 -QT_INSTALL_DOCS:C:/Qt/Qt5.12.11/Docs/Qt-5.12.11 -QT_INSTALL_HEADERS:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/include -QT_INSTALL_LIBS:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/lib -QT_INSTALL_LIBEXECS:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/bin -QT_INSTALL_BINS:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/bin -QT_INSTALL_TESTS:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/tests -QT_INSTALL_PLUGINS:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/plugins -QT_INSTALL_IMPORTS:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/imports -QT_INSTALL_QML:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/qml -QT_INSTALL_TRANSLATIONS:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/translations -QT_INSTALL_CONFIGURATION: -QT_INSTALL_EXAMPLES:C:/Qt/Qt5.12.11/Examples/Qt-5.12.11 -QT_INSTALL_DEMOS:C:/Qt/Qt5.12.11/Examples/Qt-5.12.11 -QT_HOST_PREFIX:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64 -QT_HOST_DATA:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64 -QT_HOST_BINS:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/bin -QT_HOST_LIBS:C:/Qt/Qt5.12.11/5.12.11/msvc2017_64/lib -QMAKE_SPEC:win32-msvc -QMAKE_XSPEC:win32-msvc -QMAKE_VERSION:3.1 -QT_VERSION:5.12.11 diff --git a/GenericConsole/release/qmake/temp/qtvars.pro b/GenericConsole/release/qmake/temp/qtvars.pro deleted file mode 100644 index 35a36b7..0000000 --- a/GenericConsole/release/qmake/temp/qtvars.pro +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG += no_fixpath -QT += core diff --git a/GenericConsole/release/qmake/temp/qtvars.vcxproj.filters b/GenericConsole/release/qmake/temp/qtvars.vcxproj.filters deleted file mode 100644 index a5e61b7..0000000 --- a/GenericConsole/release/qmake/temp/qtvars.vcxproj.filters +++ /dev/null @@ -1,14 +0,0 @@ - - - - - {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} - cpp;c;cxx;moc;h;def;odl;idl;res; - - - - - Generated Files - - - \ No newline at end of file diff --git a/QtNovelDesc.pro b/QtNovelDesc.pro index 0ff9c4d..3fcaeb5 100644 --- a/QtNovelDesc.pro +++ b/QtNovelDesc.pro @@ -2,7 +2,7 @@ TEMPLATE = subdirs SUBDIRS += \ GenericConsole \ - SplitView \ + libSplitView \ WordsIDE \ libConfig \ libProjectManager \ diff --git a/QtNovelDesc.pro.user b/QtNovelDesc.pro.user index ed62b3e..d43ac30 100644 --- a/QtNovelDesc.pro.user +++ b/QtNovelDesc.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -85,9 +85,6 @@ true - - true - @@ -219,47 +216,7 @@ 0 0 - - 0 - D:\Projects\Cpp\build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug2 - D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug2 - - - true - QtProjectManager.QMakeBuildStep - "DEFINES+=UNIT_TEST" - false - - - - true - Qt4ProjectManager.MakeStep - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - clean - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - - UnitTest - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - 4 + 3 0 diff --git a/QtNovelDesc.sln b/QtNovelDesc.sln deleted file mode 100644 index c5366be..0000000 --- a/QtNovelDesc.sln +++ /dev/null @@ -1,70 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.33801.198 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GenericConsole", "GenericConsole\GenericConsole.vcxproj", "{5BB4976A-6252-3E36-851D-7F17F16DF17D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SplitView", "SplitView\SplitView.vcxproj", "{DB7B1794-6682-38A2-B142-117D0E9F66E4}" - ProjectSection(ProjectDependencies) = postProject - {584ACAFD-87A5-3B62-B96B-4CE19B6FD6C9} = {584ACAFD-87A5-3B62-B96B-4CE19B6FD6C9} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WordsIDE", "WordsIDE\WordsIDE.vcxproj", "{E0995577-1AB9-3B93-9990-97E99093D597}" - ProjectSection(ProjectDependencies) = postProject - {584ACAFD-87A5-3B62-B96B-4CE19B6FD6C9} = {584ACAFD-87A5-3B62-B96B-4CE19B6FD6C9} - {5CBE83F9-2019-33DC-8327-32F7A2AC9EF6} = {5CBE83F9-2019-33DC-8327-32F7A2AC9EF6} - {5BB4976A-6252-3E36-851D-7F17F16DF17D} = {5BB4976A-6252-3E36-851D-7F17F16DF17D} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libConfig", "libConfig\libConfig.vcxproj", "{584ACAFD-87A5-3B62-B96B-4CE19B6FD6C9}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libProjectManager", "libProjectManager\libProjectManager.vcxproj", "{5CBE83F9-2019-33DC-8327-32F7A2AC9EF6}" - ProjectSection(ProjectDependencies) = postProject - {584ACAFD-87A5-3B62-B96B-4CE19B6FD6C9} = {584ACAFD-87A5-3B62-B96B-4CE19B6FD6C9} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "u_test", "u_test\u_test.vcxproj", "{2A348B24-97E4-3DE1-84FD-5A95F92CEADE}" - ProjectSection(ProjectDependencies) = postProject - {DB7B1794-6682-38A2-B142-117D0E9F66E4} = {DB7B1794-6682-38A2-B142-117D0E9F66E4} - {5BB4976A-6252-3E36-851D-7F17F16DF17D} = {5BB4976A-6252-3E36-851D-7F17F16DF17D} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5BB4976A-6252-3E36-851D-7F17F16DF17D}.Debug|x64.ActiveCfg = Debug|x64 - {5BB4976A-6252-3E36-851D-7F17F16DF17D}.Debug|x64.Build.0 = Debug|x64 - {5BB4976A-6252-3E36-851D-7F17F16DF17D}.Release|x64.ActiveCfg = Release|x64 - {5BB4976A-6252-3E36-851D-7F17F16DF17D}.Release|x64.Build.0 = Release|x64 - {DB7B1794-6682-38A2-B142-117D0E9F66E4}.Debug|x64.ActiveCfg = Debug|x64 - {DB7B1794-6682-38A2-B142-117D0E9F66E4}.Debug|x64.Build.0 = Debug|x64 - {DB7B1794-6682-38A2-B142-117D0E9F66E4}.Release|x64.ActiveCfg = Release|x64 - {DB7B1794-6682-38A2-B142-117D0E9F66E4}.Release|x64.Build.0 = Release|x64 - {E0995577-1AB9-3B93-9990-97E99093D597}.Debug|x64.ActiveCfg = Debug|x64 - {E0995577-1AB9-3B93-9990-97E99093D597}.Debug|x64.Build.0 = Debug|x64 - {E0995577-1AB9-3B93-9990-97E99093D597}.Release|x64.ActiveCfg = Release|x64 - {E0995577-1AB9-3B93-9990-97E99093D597}.Release|x64.Build.0 = Release|x64 - {584ACAFD-87A5-3B62-B96B-4CE19B6FD6C9}.Debug|x64.ActiveCfg = Debug|x64 - {584ACAFD-87A5-3B62-B96B-4CE19B6FD6C9}.Debug|x64.Build.0 = Debug|x64 - {584ACAFD-87A5-3B62-B96B-4CE19B6FD6C9}.Release|x64.ActiveCfg = Release|x64 - {584ACAFD-87A5-3B62-B96B-4CE19B6FD6C9}.Release|x64.Build.0 = Release|x64 - {5CBE83F9-2019-33DC-8327-32F7A2AC9EF6}.Debug|x64.ActiveCfg = Debug|x64 - {5CBE83F9-2019-33DC-8327-32F7A2AC9EF6}.Debug|x64.Build.0 = Debug|x64 - {5CBE83F9-2019-33DC-8327-32F7A2AC9EF6}.Release|x64.ActiveCfg = Release|x64 - {5CBE83F9-2019-33DC-8327-32F7A2AC9EF6}.Release|x64.Build.0 = Release|x64 - {2A348B24-97E4-3DE1-84FD-5A95F92CEADE}.Debug|x64.ActiveCfg = Debug|x64 - {2A348B24-97E4-3DE1-84FD-5A95F92CEADE}.Debug|x64.Build.0 = Debug|x64 - {2A348B24-97E4-3DE1-84FD-5A95F92CEADE}.Release|x64.ActiveCfg = Release|x64 - {2A348B24-97E4-3DE1-84FD-5A95F92CEADE}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - Qt5Version = 5.12.11_msvc2017_64 - SolutionGuid = {55A4EA1C-4AF5-49EC-A1EF-A3CE53C97A13} - EndGlobalSection -EndGlobal diff --git a/SplitView/SplitView.vcxproj b/SplitView/SplitView.vcxproj deleted file mode 100644 index 9ec8cac..0000000 --- a/SplitView/SplitView.vcxproj +++ /dev/null @@ -1,192 +0,0 @@ - - - - - Release - x64 - - - Debug - x64 - - - - {DB7B1794-6682-38A2-B142-117D0E9F66E4} - SplitView - QtVS_v304 - 10.0.22621.0 - 10.0.22621.0 - $(MSBuildProjectDirectory)\QtMsBuild - - - - v141 - release\ - false - NotSet - DynamicLibrary - release\ - SplitView - - - v141 - debug\ - false - NotSet - DynamicLibrary - debug\ - SplitView - - - - - - - - - - - - - - - - - - $(SolutionDir)x64\Debug - debug\ - SplitView - true - - - release\ - release\ - SplitView - true - false - - - 5.12.11_msvc2017_64 - core;gui;widgets - - - 5.12.11_msvc2017_64 - core;gui;widgets - - - - - - - GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;..\libConfig;release;/include;%(AdditionalIncludeDirectories) - -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus /utf-8 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) - release\ - false - None - 4577;4467;%(DisableSpecificWarnings) - Sync - release\ - MaxSpeed - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;SPLITVIEW_LIBRARY;QT_NO_DEBUG;NDEBUG;%(PreprocessorDefinitions) - false - - - MultiThreadedDLL - true - true - Level3 - true - - - libConfig.lib;%(AdditionalDependencies) - D:\Projects\Cpp\QtNovelDesc\libConfig\release;%(AdditionalLibraryDirectories) - true - false - true - true - false - $(OutDir)\SplitView.dll - true - Windows - true - - - Unsigned - None - 0 - - - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;SPLITVIEW_LIBRARY;QT_NO_DEBUG;%(PreprocessorDefinitions) - - - - - GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;..\libConfig;debug;/include;%(AdditionalIncludeDirectories) - -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus /utf-8 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) - debug\ - false - ProgramDatabase - 4577;4467;%(DisableSpecificWarnings) - Sync - debug\ - Disabled - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;SPLITVIEW_LIBRARY;%(PreprocessorDefinitions) - false - MultiThreadedDebugDLL - true - true - Level3 - true - - - D:\Projects\Cpp\QtNovelDesc\libConfig\debug\libConfig.lib;%(AdditionalDependencies) - D:\Projects\Cpp\QtNovelDesc\libConfig\debug;%(AdditionalLibraryDirectories) - true - true - true - true - $(OutDir)\SplitView.dll - true - Windows - true - - - Unsigned - None - 0 - - - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;SPLITVIEW_LIBRARY;_DEBUG;%(PreprocessorDefinitions) - - - - - - - - - - - - Document - true - $(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs) - cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus /utf-8 -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2>NUL >debug\moc_predefs.h - Generate moc_predefs.h - debug\moc_predefs.h;%(Outputs) - - - Document - $(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs) - cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus /utf-8 -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2>NUL >release\moc_predefs.h - Generate moc_predefs.h - release\moc_predefs.h;%(Outputs) - true - - - - - - - - \ No newline at end of file diff --git a/SplitView/SplitView.vcxproj.filters b/SplitView/SplitView.vcxproj.filters deleted file mode 100644 index 28a0989..0000000 --- a/SplitView/SplitView.vcxproj.filters +++ /dev/null @@ -1,50 +0,0 @@ - - - - - {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} - cpp;c;cxx;moc;h;def;odl;idl;res; - - - {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} - cpp;c;cxx;moc;h;def;odl;idl;res; - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Source Files - - - - - Header Files - - - Header Files - - - - - Generated Files - - - Generated Files - - - \ No newline at end of file diff --git a/SplitView/SplitView.vcxproj.user b/SplitView/SplitView.vcxproj.user deleted file mode 100644 index be25078..0000000 --- a/SplitView/SplitView.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/SplitView/splitview.cpp b/SplitView/splitview.cpp deleted file mode 100644 index fd4b63c..0000000 --- a/SplitView/splitview.cpp +++ /dev/null @@ -1,902 +0,0 @@ -#include "splitview.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace SplitFrame; -using namespace Config; - -BaseView::BaseView(const QString &title, QWidget *view, bool empty, QWidget *parent) : QWidget(parent), title_header(nullptr), parent_store(nullptr) { - auto layout = new QVBoxLayout(this); - layout->setMargin(0); - layout->setSpacing(0); - - registComp(this); - - if (!empty) { - title_header = new DragHeader(this); - title_header->setText(title); - title_header->setMaximumHeight(22); - - layout->addWidget(title_header, 0); - registComp(title_header); - } - - registComp(view); - layout->addWidget(view, 1); - setMouseTracking(true); -} - -void BaseView::setTitle(const QString &title) { - QWidget::setWindowTitle(title); - title_header->setText(title); -} - -QString BaseView::title() const { - return this->title_header->text(); -} - -void BaseView::setIcon(const QIcon &icon) { - this->title_header->setIcon(icon); -} - -QIcon BaseView::viewIcon() const { - return title_header->icon(); -} - -void BaseView::registComp(QWidget *child) { - if (this->comps_list.contains(child)) - return; - - comps_list << child; - - if (child != this) - child->setParent(this); -} - -ViewPresent *BaseView::viewPanel() const { return parentRect()->viewPanel(); } - -void BaseView::closeView() { -} - -bool BaseView::contains(QWidget *ptr) const { - return comps_list.contains(ptr); -} - -QWidget *BaseView::bind() const { - return const_cast(this); -} - -SplitRect *BaseView::parentRect() const { - return parent_store; -} - -void BaseView::setParentRect(SplitRect *pinst) { - this->parent_store = pinst; - - this->setParent(pinst->bind()); -} - -QRectF BaseView::outline() const { - return this->rect(); -} - -void BaseView::relayout(const QRectF &outline) { - this->setGeometry(outline.toRect()); - update(); -} - -void BaseView::installPerceptionHandle(ViewPresent *obj) { - for (auto &it : comps_list) { - it->setAcceptDrops(true); - it->removeEventFilter(obj); - it->installEventFilter(obj); - } -} - -void BaseView::paintEvent(QPaintEvent *ev) { - QWidget::paintEvent(ev); -} - -AttachPanel::AttachPanel(ViewPresent *host) : QWidget(host->bind()), adjust_host(host) { - setWindowOpacity(50); - setAcceptDrops(true); -} - -void AttachPanel::bindAttachment(BaseView *widget) { this->current_target = widget; } - -BaseView *AttachPanel::attachmentTarget() const { return this->current_target; } - -void AttachPanel::paintEvent(QPaintEvent *event) { - QWidget::paintEvent(event); - - QPainter p(this); - p.setBrush(Qt::lightGray); - p.fillRect(this->rect(), Qt::lightGray); - - auto rect = this->rect(); - p.setPen(QPen(Qt::black, 4)); - switch (active_comp) { - case ActiveArea::LEFT: - p.fillRect(QRectF(rect.topLeft(), QSizeF(rect.width() / 2, rect.height())), Qt::gray); - break; - case ActiveArea::RIGHT: - p.fillRect(QRectF(rect.center() - QPointF(0, rect.height() / 2), QSizeF(rect.width() / 2, rect.height())), Qt::gray); - break; - case ActiveArea::TOP: - p.fillRect(QRectF(rect.topLeft(), QSizeF(rect.width(), rect.height() / 2)), Qt::gray); - break; - case ActiveArea::BOTTOM: - p.fillRect(QRectF(rect.center() - QPointF(rect.width() / 2, 0), QSizeF(rect.width(), rect.height() / 2)), Qt::gray); - break; - case ActiveArea::CENTER: - p.fillRect(rect, Qt::gray); - break; - default: - break; - } - - p.setBrush(Qt::transparent); - - auto lt0 = rect.center() - QPoint(50, 150); - p.drawRoundRect(QRectF(lt0, QSizeF(100, 300))); - - auto lt1 = rect.center() - QPoint(150, 50); - p.drawRoundRect(QRectF(lt1, QSizeF(300, 100))); -} - -void AttachPanel::dragMoveEvent(QDragMoveEvent *event) { - QWidget::dragMoveEvent(event); - - auto tuple_list = view_rects(); - if (std::get<0>(tuple_list).contains(event->pos())) { - this->active_comp = ActiveArea::LEFT; - } - else if (std::get<1>(tuple_list).contains(event->pos())) { - this->active_comp = ActiveArea::RIGHT; - - } - else if (std::get<2>(tuple_list).contains(event->pos())) { - this->active_comp = ActiveArea::TOP; - - } - else if (std::get<3>(tuple_list).contains(event->pos())) { - this->active_comp = ActiveArea::BOTTOM; - - } - else if (std::get<4>(tuple_list).contains(event->pos())) { - this->active_comp = ActiveArea::CENTER; - } - else { - this->active_comp = ActiveArea::NONE; - } - - this->update(); -} - -void AttachPanel::dragEnterEvent(QDragEnterEvent *event) { - QWidget::dragEnterEvent(event); - - if (adjust_host->adjustState()) - event->acceptProposedAction(); -} - -void AttachPanel::dropEvent(QDropEvent *event) { - QWidget::dropEvent(event); - event->acceptProposedAction(); - - auto xfrom = adjust_host->adjustView(); - auto target = this->attachmentTarget(); - - if (target != xfrom && active_comp != ActiveArea::NONE) { - RectCom *newsplit = nullptr; - - xfrom->parentRect()->removeComp(xfrom); - adjust_host->objsRelateRebuild(); - - auto ptarget = target->parentRect(); - auto target_rect = target->outline(); - - switch (this->active_comp) { - case ActiveArea::LEFT: { - newsplit = new SplitView(xfrom, target, adjust_host); - newsplit->relayout(target_rect); - static_cast(newsplit)->setSplitInfo(SplitType::SPLIT_H, target_rect.width() / 2, adjust_host->splitterWidth(), true); - } break; - case ActiveArea::RIGHT: { - newsplit = new SplitView(target, xfrom, adjust_host); - newsplit->relayout(target_rect); - static_cast(newsplit)->setSplitInfo(SplitType::SPLIT_H, target_rect.width() / 2, adjust_host->splitterWidth(), true); - } break; - case ActiveArea::TOP: { - newsplit = new SplitView(xfrom, target, adjust_host); - newsplit->relayout(target_rect); - static_cast(newsplit)->setSplitInfo(SplitType::SPLIT_V, target_rect.height() / 2, adjust_host->splitterWidth(), true); - } break; - case ActiveArea::BOTTOM: { - newsplit = new SplitView(target, xfrom, adjust_host); - newsplit->relayout(target_rect); - static_cast(newsplit)->setSplitInfo(SplitType::SPLIT_V, target_rect.height() / 2, adjust_host->splitterWidth(), true); - } break; - case ActiveArea::CENTER: { - newsplit = xfrom; - } break; - default: - return; - } - - ptarget->replaceComp(newsplit, target); - adjust_host->objsRelateRebuild(); - adjust_host->unusedResRelease(); - } - - adjust_host->setViewAdjust(); - this->setVisible(false); -} - -std::tuple AttachPanel::view_rects() const { - auto rect = this->rect(); - auto lt0 = rect.center() - QPoint(50, 150); - auto lt1 = rect.center() - QPoint(150, 50); - - return std::make_tuple(QRectF(lt1, QSizeF(100, 100)), QRectF(lt1 + QPoint(200, 0), QSizeF(100, 100)), QRectF(lt0, QSizeF(100, 100)), - QRectF(lt0 + QPointF(0, 200), QSizeF(100, 100)), QRectF(lt1 + QPointF(100, 0), QSizeF(100, 100))); -} - -ViewPresent::ViewPresent(QWidget *parent) : QWidget(parent), accept_panel(new AttachPanel(this)) { - accept_panel->hide(); - setMouseTracking(true); -} - -ViewPresent::~ViewPresent() { - accept_panel->deleteLater(); -} - -void ViewPresent::addListener(FreedomViewsListener *lsn) { - if (lsn_list.contains(lsn)) - return; - lsn_list << lsn; -} - -void ViewPresent::removeListener(FreedomViewsListener *lsn) { - lsn_list.removeAll(lsn); -} - -void ViewPresent::registViewComp(BaseView *it) { - if (this->all_sep_views.contains(it)) - return; - - it->installPerceptionHandle(this); - all_sep_views << it; -} - -void ViewPresent::markFreedom(BaseView *view) { - if (!freedom_views.contains(view)) - freedom_views << view; -} - -// void ViewPresent::collectFreedomView(BaseView *invisible) { -// if (!freedom_views.contains(invisible)) { -// freedom_views << invisible; - -// for (auto &it : lsn_list) -// it->freedomAppended(invisible); -// } - -// invisible->setParentRect(nullptr); -// invisible->bind()->setVisible(false); -//} - -void ViewPresent::setTempVisible(BaseView *target) { - if (target != nullptr && !this->freedom_views.contains(target)) - throw new SimpleException("参数异常", "非闲置视图不可以设置为临时视图"); - - if (this->temp_visible_view) { - // collectFreedomView(temp_visible_view); - } - - temp_visible_view = target; - if (temp_visible_view) { - temp_visible_view->setParentRect(this); - temp_visible_view->bind()->setVisible(true); - temp_visible_view->bind()->raise(); - } - - relayout(); -} - -void ViewPresent::setViewAdjust(BaseView *one) { - this->adjust_view_temp = one; -} - -bool ViewPresent::adjustState() const { - return this->adjust_view_temp != nullptr; -} - -BaseView *ViewPresent::adjustView() const { - return this->adjust_view_temp; -} - -void ViewPresent::resetViews(RectCom *center, RectCom *extend) { - view_anchors << center; - - if (extend) { - view_anchors << extend; - } - - this->objsRelateRebuild(); - this->relayout(); -} - -bool ViewPresent::eventFilter(QObject *watched, QEvent *event) { - auto adjust_state = adjustState(); - - if (adjust_state && event->type() == QEvent::DragEnter) { - for (auto &v : all_sep_views) { - if (v->contains((QWidget *)watched)) { - auto outline = v->outline(); - QPoint gpos(v->bind()->mapToGlobal(outline.topLeft().toPoint())); - QPoint localpos(mapFromGlobal(gpos)); - - accept_panel->raise(); - accept_panel->setGeometry(QRect(localpos, outline.size().toSize())); - accept_panel->setVisible(true); - - accept_panel->bindAttachment(v); - event->accept(); - return true; - } - } - } - - if (event->type() == QEvent::Drop) { - accept_panel->hide(); - accept_panel->lower(); - } - - if (this->temp_visible_view && event->type() == QEvent::MouseButtonPress) { - if (!temp_visible_view->contains((QWidget *)watched)) { - setTempVisible(nullptr); - } - } - - return QWidget::eventFilter(watched, event); -} - -QWidget *ViewPresent::bind() const { return const_cast(this); } - -bool ViewPresent::contains(QWidget *ptr) const { return false; } - -ViewPresent *ViewPresent::viewPanel() const { - return const_cast(this); -} - -SplitRect *ViewPresent::parentRect() const { return nullptr; } - -void ViewPresent::objsRelateRebuild() { setParentRect(nullptr); } - -void ViewPresent::markUnused(SplitRect *item) { - if (!this->unused_splits.contains(item)) - unused_splits << item; -} - -void ViewPresent::unusedResRelease() { - for (auto &it : unused_splits) - delete it; - unused_splits.clear(); -} - -void ViewPresent::setParentRect(SplitRect *) { - auto pair = child(); - pair.first->setParentRect(this); - if (pair.second) - pair.second->setParentRect(this); -} - -std::pair ViewPresent::child() const { - RectCom *inst0 = nullptr, *inst1 = nullptr; - if (view_anchors.size() > 1) - inst1 = view_anchors[1]; - if (view_anchors.size() > 0) - inst0 = view_anchors[0]; - - return std::make_pair(inst0, inst1); -} - -void ViewPresent::replaceComp(RectCom *view, RectCom *old) { - if (!view_anchors.contains(old)) - throw new SimpleException("参数错误", "指定替换的界面不属于此界面"); - - if (view_anchors.contains(view)) - return; - - view_anchors.replace(view_anchors.indexOf(old), view); - objsRelateRebuild(); - update(); -} - -float ViewPresent::splitterWidth() const { - return std::get<2>(split_info_store); -} - -float ViewPresent::splitterPos() const { - return std::get<1>(split_info_store); -} - -SplitType ViewPresent::splitType() const { - return std::get<0>(split_info_store); -} - -void ViewPresent::setSplitInfo(SplitType type, float pos, float width, bool relayout) { - this->split_info_store = std::make_tuple(type, pos, width); - if (relayout) - this->relayout(); -} - -QRectF ViewPresent::outline() const { - return this->rect(); -} - -void ViewPresent::relayout(const QRectF &outline) { - setGeometry(outline.toRect()); -} - -void ViewPresent::paintEvent(QPaintEvent *ev) { - QWidget::paintEvent(ev); - - if (view_anchors.size() == 2) { - QPainter p(this); - auto handle_rect = handleRect(); - p.fillRect(handle_rect, QBrush(Qt::gray)); - } - - for (auto &it : view_anchors) { - it->bind()->setVisible(true); - it->bind()->update(); - } - - if (temp_visible_view) { - temp_visible_view->bind()->setVisible(true); - temp_visible_view->bind()->update(); - } - - for (auto &it : freedom_views) { - it->bind()->setVisible(false); - it->bind()->update(); - } -} - -void ViewPresent::removeComp(BaseView *child_inst) { - if (temp_visible_view == child_inst) { - temp_visible_view = nullptr; - - freedom_views.removeAll(child_inst); - for (auto &lsn : lsn_list) - lsn->freedomRemoved(static_cast(child_inst)); - } else { - if (!view_anchors.contains(child_inst)) - throw new SimpleException("参数非法", "回收的指定视图不属于本ViewPresent"); - - markFreedom(child_inst); - view_anchors.removeAll(child_inst); - } - - viewPanel()->objsRelateRebuild(); - viewPanel()->unusedResRelease(); - - update(); -} - -void ViewPresent::resizeEvent(QResizeEvent *ev) { - QWidget::resizeEvent(ev); - relayout(); -} -void ViewPresent::mousePressEvent(QMouseEvent *event) { - QWidget::mousePressEvent(event); - - if (event->button() == Qt::MouseButton::LeftButton) { - if (handleRect().contains(event->pos())) - this->press_flags = true; - } -} -void ViewPresent::mouseReleaseEvent(QMouseEvent *event) { - QWidget::mouseReleaseEvent(event); - - if (event->button() == Qt::MouseButton::LeftButton) { - this->press_flags = false; - } -} -void ViewPresent::mouseMoveEvent(QMouseEvent *event) { - QWidget::mouseMoveEvent(event); - - auto drag_rect = handleRect(); - if (drag_rect.contains(event->pos())) { - if (splitType() == SplitType::SPLIT_H) - setCursor(QCursor(Qt::CursorShape::SplitHCursor)); - else - setCursor(QCursor(Qt::CursorShape::SplitVCursor)); - } - else { - setCursor(QCursor(Qt::CursorShape::ArrowCursor)); - } - - if (this->press_flags) { - auto pos = this->mapFromGlobal(event->globalPos()); - auto split_margin = splitterWidth(); - if (std::get<0>(split_info_store) == SplitType::SPLIT_H) { - setSplitInfo(splitType(), pos.x() - split_margin / 2, split_margin, true); - } - else { - setSplitInfo(splitType(), pos.y() - split_margin / 2, split_margin, true); - } - - update(); - } -} - -void ViewPresent::relayout() { - auto rects = viewRects(); - - if (view_anchors.size() == 2) { - view_anchors[0]->relayout(rects.first.toRect()); - view_anchors[1]->relayout(rects.second.toRect()); - } else if (view_anchors.size() == 1) { - view_anchors[0]->relayout(this->rect()); - } - - if (temp_visible_view) { - temp_visible_view->relayout(QRectF(QPointF(), QSizeF(300, this->height()))); - } - - update(); -} -std::pair ViewPresent::viewRects() { - auto xrect = this->rect(); - - auto type = (int)splitType(); - if (!type) { - auto width0 = splitterPos(); - if (width0 + splitterWidth() > xrect.width()) - width0 = xrect.width() - splitterWidth(); - if (width0 < 0) - width0 = 0; - - setSplitInfo(splitType(), width0, splitterWidth(), false); - - auto rect0 = QRectF(xrect.topLeft(), QSizeF(width0, xrect.height())); - auto rect1 = QRectF(xrect.topLeft() + QPointF(rect0.width() + splitterWidth(), 0), - QSizeF(xrect.width() - rect0.width() - splitterWidth(), xrect.height())); - return std::make_pair(rect0, rect1); - } - else { - auto height0 = splitterPos(); - if (height0 + splitterWidth() > xrect.height()) - height0 = xrect.height() - splitterWidth(); - if (height0 < 0) - height0 = 0; - - setSplitInfo(splitType(), height0, splitterWidth(), false); - - auto rect0 = QRectF(xrect.topLeft(), QSizeF(xrect.width(), height0)); - auto rect1 = QRectF(xrect.topLeft() + QPointF(0, rect0.height() + splitterWidth()), - QSizeF(xrect.width(), xrect.height() - splitterWidth() - rect0.height())); - return std::make_pair(rect0, rect1); - } -} -QRectF ViewPresent::handleRect() const { - QRectF rect; - - auto width_middle = splitterWidth() - 2; - if (splitType() == SplitType::SPLIT_H) { - rect = QRectF(splitterPos() + 1, 0, width_middle, outline().height()); - } - else { - rect = QRectF(0, splitterPos() + 1, outline().width(), width_middle); - } - - return rect; -} - -SplitView::SplitView(RectCom *first, RectCom *next, QWidget *parent) : QWidget(parent) { - this->split_info_value = std::make_tuple(SplitType::SPLIT_H, 100, 7); - this->child_store << first; - this->child_store << next; - setMouseTracking(true); -} - -SplitFrame::SplitView::~SplitView() { -} - -QWidget *SplitView::bind() const { - return const_cast(this); -} - -ViewPresent *SplitView::viewPanel() const { return parentRect()->viewPanel(); } - -SplitRect *SplitView::parentRect() const { - return parent_inst; -} - -void SplitView::setParentRect(SplitRect *pinst) { - QWidget::setParent(pinst->bind()); - - auto pair = child(); - pair.first->setParentRect(this); - pair.second->setParentRect(this); -} - -std::pair SplitView::child() const { return std::make_pair(child_store[0], child_store[1]); } - -float SplitView::splitterWidth() const { - return std::get<2>(split_info_value); -} - -float SplitView::splitterPos() const { - return std::get<1>(split_info_value); -} - -SplitType SplitView::splitType() const { - return std::get<0>(split_info_value); -} - -void SplitView::setSplitInfo(SplitType type, float pos, float width, bool relayout) { - this->split_info_value = std::make_tuple(type, pos, width); - if (relayout) - this->relayout(); -} - -void SplitView::replaceComp(RectCom *view, RectCom *old) { - if (!child_store.contains(old) || child_store.contains(view)) { - throw new SimpleException("参数非法", "要替换的视图不属于本构件,或者新视图本就属于本构件"); - } - - auto index = child_store.indexOf(old); - child_store.replace(index, view); - - viewPanel()->objsRelateRebuild(); -} - -QRectF SplitView::outline() const { - return this->rect(); -} - -void SplitView::relayout(const QRectF &outlinex) { - this->setGeometry(outlinex.toRect()); - update(); -} - -void SplitView::removeComp(BaseView *child_inst) { - auto pinst = parentRect(); - - auto sib = this->child().first; - if (child_inst == sib) - sib = this->child().second; - - pinst->replaceComp(sib, this); - - viewPanel()->markUnused(this); - viewPanel()->markFreedom(child_inst); - - viewPanel()->objsRelateRebuild(); - viewPanel()->unusedResRelease(); -} - -void SplitView::paintEvent(QPaintEvent *ev) { - QWidget::paintEvent(ev); - - QPainter p(this); - QRectF rect = handleRect(); - p.fillRect(rect, QBrush(Qt::gray, Qt::BrushStyle::SolidPattern)); - - for (auto &it : child_store) - it->bind()->update(); -} - -bool SplitView::contains(QWidget *ptr) const { return false; } - -void SplitView::resizeEvent(QResizeEvent *ev) { - QWidget::resizeEvent(ev); - relayout(); -} - -void SplitView::mousePressEvent(QMouseEvent *event) { - QWidget::mousePressEvent(event); - - if (event->button() == Qt::MouseButton::LeftButton) { - if (handleRect().contains(event->pos())) - this->press_flags = true; - } -} - -void SplitView::mouseReleaseEvent(QMouseEvent *event) { - QWidget::mouseReleaseEvent(event); - - if (event->button() == Qt::MouseButton::LeftButton) { - this->press_flags = false; - } -} - -void SplitView::mouseMoveEvent(QMouseEvent *event) { - QWidget::mouseMoveEvent(event); - - auto drag_rect = handleRect() + QMargins(2, 2, 2, 2); - if (drag_rect.contains(event->pos())) { - if (splitType() == SplitType::SPLIT_H) - setCursor(QCursor(Qt::CursorShape::SplitHCursor)); - else - setCursor(QCursor(Qt::CursorShape::SplitVCursor)); - - drags_flag = true; - } else { - setCursor(QCursor(Qt::CursorShape::ArrowCursor)); - } - - if (this->press_flags) { - auto pos = this->mapFromGlobal(event->globalPos()); - auto split_margin = splitterWidth(); - if (std::get<0>(split_info_value) == SplitType::SPLIT_H) { - setSplitInfo(splitType(), pos.x() - split_margin / 2, split_margin, true); - } else { - setSplitInfo(splitType(), pos.y() - split_margin / 2, split_margin, true); - } - update(); - } -} - -bool SplitView::eventFilter(QObject *watched, QEvent *event) { - if (watched != this && this->drags_flag && event->type() == QEvent::MouseMove) { - auto x = static_cast(event); - auto pos = mapFromGlobal(x->globalPos()); - if (!handleRect().contains(pos)) { - setCursor(QCursor(Qt::CursorShape::ArrowCursor)); - this->drags_flag = false; - } - return true; - } - - return QWidget::eventFilter(watched, event); -} - -void SplitView::relayout() { - auto rects = viewRects(); - auto pair = child(); - - pair.first->relayout(std::get<0>(rects)); - pair.second->relayout(std::get<1>(rects)); - - update(); -} - -std::pair SplitView::viewRects() { - auto xrect = this->rect(); - - auto type = (int)splitType(); - if (!type) { - auto width0 = splitterPos(); - if (width0 + splitterWidth() > xrect.width()) - width0 = xrect.width() - splitterWidth(); - if (width0 < 0) - width0 = 0; - - setSplitInfo(splitType(), width0, splitterWidth(), false); - - auto rect0 = QRectF(xrect.topLeft(), QSizeF(width0, xrect.height())); - auto rect1 = QRectF(xrect.topLeft() + QPointF(rect0.width() + splitterWidth(), 0), - QSizeF(xrect.width() - rect0.width() - splitterWidth(), xrect.height())); - return std::make_pair(rect0, rect1); - } - else { - auto height0 = splitterPos(); - if (height0 + splitterWidth() > xrect.height()) - height0 = xrect.height() - splitterWidth(); - if (height0 < 0) - height0 = 0; - - setSplitInfo(splitType(), height0, splitterWidth(), false); - - auto rect0 = QRectF(xrect.topLeft(), QSizeF(xrect.width(), height0)); - auto rect1 = QRectF(xrect.topLeft() + QPointF(0, rect0.height() + splitterWidth()), - QSizeF(xrect.width(), xrect.height() - splitterWidth() - rect0.height())); - return std::make_pair(rect0, rect1); - } -} - -QRectF SplitView::handleRect() const { - QRectF rect; - - auto width_middle = splitterWidth() - 2; - if (splitType() == SplitType::SPLIT_H) { - rect = QRectF(splitterPos() + 1, 0, width_middle, outline().height()); - } - else { - rect = QRectF(0, splitterPos() + 1, outline().width(), width_middle); - } - - return rect; -} - -DragHeader::DragHeader(BaseView *bind) : QFrame(bind->bind()), icon_store(new QLabel(this)), title_store(new QLabel(this)), view_core(bind) { - setFrameShadow(QFrame::Shadow::Raised); - setFrameShape(QFrame::Shape::Box); - setStyleSheet("background-color: rgb(200, 200, 255);"); - - auto layout = new QHBoxLayout(this); - layout->setMargin(1); - layout->setSpacing(2); - layout->addWidget(icon_store, 0); - layout->addWidget(title_store, 1); - - auto hide = new QPushButton("-", this); - layout->addWidget(hide, 0); - hide->setMaximumSize(20, 20); - auto close = new QPushButton("X", this); - layout->addWidget(close, 0); - close->setMaximumSize(20, 20); - - connect(hide, &QPushButton::clicked, [=]() { - auto con = this->view_core->parentRect(); - con->removeComp(view_core); - }); - - connect(close, &QPushButton::clicked, [=]() { - hide->click(); - view_core->closeView(); - }); -} - -void DragHeader::setIcon(const QIcon &icon) { - icon_inst = icon; - auto len = this->height() - 2; - this->icon_store->setPixmap(icon.pixmap(QSize(len, len))); -} - -QIcon DragHeader::icon() const { - return this->icon_inst; -} - -void DragHeader::setText(const QString &title) { - this->title_store->setText(title); -} - -QString DragHeader::text() const { - return title_store->text(); -} - -void DragHeader::mousePressEvent(QMouseEvent *event) { - if (event->button() == Qt::LeftButton && !std::get<0>(press_flag)) { - this->press_flag = std::make_tuple(true, event->pos()); - } -} - -void DragHeader::mouseReleaseEvent(QMouseEvent *event) { - if (event->button() == Qt::LeftButton) { - this->press_flag = std::make_tuple(false, QPointF()); - } -} - -void DragHeader::mouseMoveEvent(QMouseEvent *event) { - auto distance = QLineF(std::get<1>(press_flag), event->pos()).length(); - if (std::get<0>(press_flag) && distance > QApplication::startDragDistance()) { - auto panel = view_core->viewPanel(); - panel->setViewAdjust(view_core); - - QDrag *drag = new QDrag(this); - auto pix = view_core->grab(); - drag->setPixmap(pix); - drag->setHotSpot(QPoint(20, 20)); - - QMimeData *mimeData = new QMimeData; - mimeData->setText("移动视图:" + view_core->title()); - drag->setMimeData(mimeData); - - drag->exec(); - } -} diff --git a/SplitView/splitview.h b/SplitView/splitview.h deleted file mode 100644 index 535d997..0000000 --- a/SplitView/splitview.h +++ /dev/null @@ -1,301 +0,0 @@ -#ifndef SPLITVIEW_H -#define SPLITVIEW_H - -#include "SplitView_global.h" -#include -#include -#include -#include - -namespace SplitFrame { - class SplitRect; - class ViewPresent; - class BaseView; - - /** - * @brief 承接堆放操作及设定摆放位置 - */ - class SPLITVIEW_EXPORT AttachPanel : public QWidget { - enum class ActiveArea { LEFT, RIGHT, TOP, BOTTOM, CENTER, NONE }; - - public: - AttachPanel(ViewPresent *host); - - void bindAttachment(BaseView *widget); - BaseView *attachmentTarget() const; - - virtual void paintEvent(QPaintEvent *event) override; - virtual void dragMoveEvent(QDragMoveEvent *event) override; - virtual void dragEnterEvent(QDragEnterEvent *event) override; - virtual void dropEvent(QDropEvent *event) override; - - private: - ViewPresent *const adjust_host; - BaseView *current_target; - ActiveArea active_comp; - - std::tuple view_rects() const; - }; - - enum class SplitType { SPLIT_H = 0, SPLIT_V = 1 }; - - class RectCom { - public: - virtual ~RectCom() = default; - - virtual ViewPresent *viewPanel() const = 0; - virtual QWidget *bind() const = 0; - virtual bool contains(QWidget *ptr) const = 0; - - virtual QRectF outline() const = 0; - virtual void relayout(const QRectF &outline) = 0; - - virtual void setParentRect(SplitRect *inst) = 0; - virtual SplitRect *parentRect() const = 0; - - virtual void paintEvent(QPaintEvent *ev) = 0; - }; - - class ResManager { - public: - virtual ~ResManager() = default; - - virtual void objsRelateRebuild() = 0; - - virtual void markFreedom(BaseView *view) = 0; - virtual void markUnused(SplitRect *item) = 0; - virtual void unusedResRelease() = 0; - }; - - /** - * @brief 分裂视图规划和约束组件 - */ - class SplitRect : public RectCom { - public: - virtual ~SplitRect() = default; - - virtual std::pair child() const = 0; - virtual void removeComp(BaseView *child) = 0; - virtual void replaceComp(RectCom *view, RectCom *old) = 0; - virtual float splitterWidth() const = 0; - virtual float splitterPos() const = 0; - virtual SplitType splitType() const = 0; - virtual void setSplitInfo(SplitType type, float pos, float width, bool relayout = true) = 0; - }; - - /** - * @brief 分割视图 - */ - class SPLITVIEW_EXPORT SplitView : public QWidget, public SplitRect { - - public: - SplitView(RectCom *first, RectCom *next, QWidget *parent = nullptr); - virtual ~SplitView(); - - // RectCom interface - public: - virtual QWidget *bind() const override; - virtual ViewPresent *viewPanel() const override; - virtual QRectF outline() const override; - virtual void relayout(const QRectF &outline) override; - virtual void setParentRect(SplitRect *inst) override; - virtual SplitRect *parentRect() const override; - virtual void paintEvent(QPaintEvent *ev) override; - virtual bool contains(QWidget *ptr) const override; - - // SplitRect interface - public: - virtual std::pair child() const override; - virtual void removeComp(BaseView *child) override; - virtual void replaceComp(RectCom *view, RectCom *old) override; - virtual float splitterWidth() const override; - virtual float splitterPos() const override; - virtual SplitType splitType() const override; - virtual void setSplitInfo(SplitType type, float pos, float width, bool relayout) override; - - // QObject interface - public: - virtual bool eventFilter(QObject *watched, QEvent *event) override; - - // QWidget interface - protected: - virtual void mousePressEvent(QMouseEvent *event) override; - virtual void mouseReleaseEvent(QMouseEvent *event) override; - virtual void mouseMoveEvent(QMouseEvent *event) override; - virtual void resizeEvent(QResizeEvent *event) override; - - private: - SplitRect *parent_inst; - QList child_store; - // type, pos, width - std::tuple split_info_value; - bool press_flags = false, drags_flag = false; - - virtual void relayout(); - std::pair viewRects(); - QRectF handleRect() const; - }; - - class DragHeader : public QFrame { - public: - DragHeader(BaseView *bind); - - void setIcon(const QIcon &icon); - QIcon icon() const; - void setText(const QString &title); - QString text() const; - - private: - QIcon icon_inst; - QLabel *const icon_store, *const title_store; - BaseView *const view_core; - std::tuple press_flag = std::make_tuple(false, QPointF()); - - // QWidget interface - protected: - virtual void mousePressEvent(QMouseEvent *event) override; - virtual void mouseReleaseEvent(QMouseEvent *event) override; - virtual void mouseMoveEvent(QMouseEvent *event) override; - }; - - /** - * @brief 基础内容视图组件 - */ - class SPLITVIEW_EXPORT BaseView : public QWidget, public RectCom { - friend class ViewPresent; - - public: - BaseView(const QString &title, QWidget *view, bool empty = false, QWidget *parent = nullptr); - - virtual void setTitle(const QString &title); - virtual QString title() const; - - virtual void setIcon(const QIcon &icon); - virtual QIcon viewIcon() const; - - virtual void closeView(); - virtual bool contains(QWidget *inst) const override; - - // RectCom interface - public: - virtual QWidget *bind() const override; - virtual ViewPresent *viewPanel() const override; - virtual QRectF outline() const override; - virtual void relayout(const QRectF &outline) override; - virtual void setParentRect(SplitRect *inst) override; - virtual SplitRect *parentRect() const override; - virtual void paintEvent(QPaintEvent *ev) override; - - private: - DragHeader *title_header; - SplitRect *parent_store; - QList comps_list; - - protected: - virtual void installPerceptionHandle(ViewPresent *obj); - virtual void registComp(QWidget *child); - }; - - class FreedomViewsListener { - public: - virtual ~FreedomViewsListener() = default; - /** - * @brief 闲置视图增加 - * @param ins - */ - virtual void freedomAppended(RectCom *ins) = 0; - /** - * @brief 闲置视图减少 - * @param ins - */ - virtual void freedomRemoved(RectCom *ins) = 0; - }; - - /** - * @brief 分裂视图呈现组件 - */ - class SPLITVIEW_EXPORT ViewPresent : public QWidget, public SplitRect, public ResManager { - public: - ViewPresent(QWidget *parent = nullptr); - virtual ~ViewPresent(); - - void addListener(FreedomViewsListener *lsn); - void removeListener(FreedomViewsListener *lsn); - //====================================================== - void registViewComp(BaseView *it); - //====================================================== - virtual void markFreedom(BaseView *view) override; - void setTempVisible(BaseView *target = nullptr); - - /** - * @brief 切换视图调整状态 - * @param state 状态开关 - */ - void setViewAdjust(BaseView *one = nullptr); - bool adjustState() const; - BaseView *adjustView() const; - - void resetViews(RectCom *center, RectCom *extend = nullptr); - - // RectCom interface - public: - virtual ViewPresent *viewPanel() const override; - virtual QWidget *bind() const override; - virtual bool contains(QWidget *ptr) const override; - virtual QRectF outline() const override; - virtual void relayout(const QRectF &outline) override; - virtual void setParentRect(SplitRect *) override; - virtual SplitRect *parentRect() const override; - - // ResManager interface - public: - virtual void objsRelateRebuild() override; - virtual void markUnused(SplitRect *item) override; - virtual void unusedResRelease() override; - - // SplitRect interface - public: - virtual std::pair child() const override; - virtual void removeComp(BaseView *child) override; - virtual void replaceComp(RectCom *view, RectCom *old) override; - virtual float splitterWidth() const override; - virtual float splitterPos() const override; - virtual SplitType splitType() const override; - virtual void setSplitInfo(SplitType type, float pos, float width, bool relayout) override; - - // QObject interface - public: - virtual bool eventFilter(QObject *watched, QEvent *event) override; - - // QWidget interface - protected: - virtual void paintEvent(QPaintEvent *ev) override; - virtual void resizeEvent(QResizeEvent *ev) override; - virtual void mousePressEvent(QMouseEvent *event) override; - virtual void mouseReleaseEvent(QMouseEvent *event) override; - virtual void mouseMoveEvent(QMouseEvent *event) override; - - private: - AttachPanel *const accept_panel; - QList unused_splits; - - BaseView *adjust_view_temp; // 拖拽中转 - bool press_flags = false; // 空间调整标志 - // 方向,splitter位置,splitter宽度 - std::tuple split_info_store = std::make_tuple(SplitType::SPLIT_H, 200, 8); - - QList view_anchors; - QList all_sep_views; - - QList lsn_list; - QList freedom_views; - RectCom *temp_visible_view = nullptr; - - virtual void relayout(); - std::pair viewRects(); - QRectF handleRect() const; - }; - -} // namespace SplitFrame - -#endif // SPLITVIEW_H diff --git a/WordsIDE/WordsIDE.vcxproj b/WordsIDE/WordsIDE.vcxproj deleted file mode 100644 index 022e979..0000000 --- a/WordsIDE/WordsIDE.vcxproj +++ /dev/null @@ -1,270 +0,0 @@ - - - - - Release - x64 - - - Debug - x64 - - - - {E0995577-1AB9-3B93-9990-97E99093D597} - WordsIDE - QtVS_v304 - 10.0.22621.0 - 10.0.22621.0 - $(MSBuildProjectDirectory)\QtMsBuild - - - v141 - release\ - false - NotSet - Application - release\ - WordsIDE - - - v141 - debug\ - false - NotSet - Application - debug\ - WordsIDE - - - - - - - - - - debug\debug\WordsIDEtruerelease\release\WordsIDEtruefalse5.12.11_msvc2017_64core;xml;gui;testlib;widgets5.12.11_msvc2017_64core;xml;gui;testlib;widgets - - - - GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;..\libConfig;..\libProjectManager;..\GenericConsole;release;/include;%(AdditionalIncludeDirectories) - -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus /utf-8 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) - release\ - false - None - 4577;4467;%(DisableSpecificWarnings) - Sync - release\ - MaxSpeed - _CONSOLE;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_NO_DEBUG;QT_TESTCASE_BUILDDIR=".";NDEBUG;%(PreprocessorDefinitions) - false - - MultiThreadedDLL - true - true - Level3 - true - - libConfig.lib;libProjectManager.lib;GenericConsole.lib;%(AdditionalDependencies) - D:\Projects\Cpp\QtNovelDesc\libConfig\release;D:\Projects\Cpp\QtNovelDesc\libProjectManager\release;D:\Projects\Cpp\QtNovelDesc\GenericConsole\release;%(AdditionalLibraryDirectories) - "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions) - true - false - true - false - $(OutDir)\WordsIDE.exe - true - Console - true - - - Unsigned - None - 0 - - - _CONSOLE;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_NO_DEBUG;QT_TESTCASE_BUILDDIR=".";%(PreprocessorDefinitions) - - msvc./$(Configuration)/moc_predefs.hMoc'ing %(Identity)...output$(Configuration)moc_%(Filename).cppqmake_qmake_qm_filesdefaultRcc'ing %(Identity)...$(Configuration)qrc_%(Filename).cpp - - - GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;..\libConfig;..\libProjectManager;..\GenericConsole;debug;/include;%(AdditionalIncludeDirectories) - -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus /utf-8 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) - debug\ - false - ProgramDatabase - 4577;4467;%(DisableSpecificWarnings) - Sync - debug\ - Disabled - _CONSOLE;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_TESTCASE_BUILDDIR=".";%(PreprocessorDefinitions) - false - MultiThreadedDebugDLL - true - true - Level3 - true - - D:\Projects\Cpp\QtNovelDesc\libConfig\debug\libConfig.lib;D:\Projects\Cpp\QtNovelDesc\libProjectManager\debug\libProjectManager.lib;D:\Projects\Cpp\QtNovelDesc\GenericConsole\debug\GenericConsole.lib;%(AdditionalDependencies) - D:\Projects\Cpp\QtNovelDesc\libConfig\debug;D:\Projects\Cpp\QtNovelDesc\libProjectManager\debug;D:\Projects\Cpp\QtNovelDesc\GenericConsole\debug;%(AdditionalLibraryDirectories) - "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions) - true - true - true - $(OutDir)\WordsIDE.exe - true - Console - true - - - Unsigned - None - 0 - - - _CONSOLE;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_TESTCASE_BUILDDIR=".";_DEBUG;%(PreprocessorDefinitions) - - qmake_qmake_qm_filesdefaultRcc'ing %(Identity)...$(Configuration)qrc_%(Filename).cppmsvc./$(Configuration)/moc_predefs.hMoc'ing %(Identity)...output$(Configuration)moc_%(Filename).cpp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Document - true - $(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs) - cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus /utf-8 -Zi -MDd -EHsc -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2>NUL >debug\moc_predefs.h - Generate moc_predefs.h - debug\moc_predefs.h;%(Outputs) - - - Document - $(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs) - cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus /utf-8 -O2 -MD -EHsc -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2>NUL >release\moc_predefs.h - Generate moc_predefs.h - release\moc_predefs.h;%(Outputs) - true - - - - - - - - - - - WordsIDE_zh_CN.ts;%(AdditionalInputs) - $(QTDIR)\bin\lrelease.exe WordsIDE_zh_CN.ts -qm release\WordsIDE_zh_CN.qm - lrelease - release\WordsIDE_zh_CN.qm;%(Outputs) - WordsIDE_zh_CN.ts;%(AdditionalInputs) - $(QTDIR)\bin\lrelease.exe WordsIDE_zh_CN.ts -qm debug\WordsIDE_zh_CN.qm - lrelease - debug\WordsIDE_zh_CN.qm;%(Outputs) - - - - - true - - - true - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/WordsIDE/WordsIDE.vcxproj.filters b/WordsIDE/WordsIDE.vcxproj.filters deleted file mode 100644 index 0b10928..0000000 --- a/WordsIDE/WordsIDE.vcxproj.filters +++ /dev/null @@ -1,201 +0,0 @@ - - - - - {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} - cpp;c;cxx;moc;h;def;odl;idl;res; - - - {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} - cpp;c;cxx;moc;h;def;odl;idl;res; - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} - qrc;* - false - - - {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} - qrc;* - false - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} - ts;xlf - false - - - {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} - ts;xlf - false - - - {B83CAF91-C7BF-462F-B76C-EA11631F866C} - * - false - - - {B83CAF91-C7BF-462F-B76C-EA11631F866C} - * - false - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - - - - - Generated Files - - - Generated Files - - - - - - - - - - - Translation Files - - - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - - - Distribution Files - - - \ No newline at end of file diff --git a/WordsIDE/WordsIDE.vcxproj.user b/WordsIDE/WordsIDE.vcxproj.user deleted file mode 100644 index be25078..0000000 --- a/WordsIDE/WordsIDE.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/libConfig/libConfig.vcxproj b/libConfig/libConfig.vcxproj deleted file mode 100644 index f466975..0000000 --- a/libConfig/libConfig.vcxproj +++ /dev/null @@ -1,160 +0,0 @@ - - - - - Release - x64 - - - Debug - x64 - - - - {584ACAFD-87A5-3B62-B96B-4CE19B6FD6C9} - libConfig - QtVS_v304 - 10.0.22621.0 - 10.0.22621.0 - $(MSBuildProjectDirectory)\QtMsBuild - - - v141 - release\ - false - NotSet - DynamicLibrary - release\ - libConfig - - - v141 - debug\ - false - NotSet - DynamicLibrary - debug\ - libConfig - - - - - - - - - - debug\debug\libConfigtruerelease\release\libConfigtruefalse5.12.11_msvc2017_64core;xml5.12.11_msvc2017_64core;xml - - - - GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;release;%(AdditionalIncludeDirectories) - -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus /utf-8 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) - release\ - false - None - 4577;4467;%(DisableSpecificWarnings) - Sync - release\ - MaxSpeed - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;LIBCONFIG_LIBRARY;QT_NO_DEBUG;NDEBUG;%(PreprocessorDefinitions) - false - - MultiThreadedDLL - true - true - Level3 - true - - %(AdditionalDependencies) - %(AdditionalLibraryDirectories) - true - false - true - true - false - $(OutDir)\libConfig.dll - true - Windows - true - - - Unsigned - None - 0 - - - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;LIBCONFIG_LIBRARY;QT_NO_DEBUG;%(PreprocessorDefinitions) - - - - - GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;debug;%(AdditionalIncludeDirectories) - -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus /utf-8 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) - debug\ - false - ProgramDatabase - 4577;4467;%(DisableSpecificWarnings) - Sync - debug\ - Disabled - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;LIBCONFIG_LIBRARY;%(PreprocessorDefinitions) - false - MultiThreadedDebugDLL - true - true - Level3 - true - - %(AdditionalDependencies) - %(AdditionalLibraryDirectories) - true - true - true - true - $(OutDir)\libConfig.dll - true - Windows - true - - - Unsigned - None - 0 - - - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;LIBCONFIG_LIBRARY;_DEBUG;%(PreprocessorDefinitions) - - - - - - - - - - - - - Document - true - $(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs) - cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus /utf-8 -Zi -MDd -EHsc -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2>NUL >debug\moc_predefs.h - Generate moc_predefs.h - debug\moc_predefs.h;%(Outputs) - - - Document - $(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs) - cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus /utf-8 -O2 -MD -EHsc -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2>NUL >release\moc_predefs.h - Generate moc_predefs.h - release\moc_predefs.h;%(Outputs) - true - - - - - - - - \ No newline at end of file diff --git a/libConfig/libConfig.vcxproj.filters b/libConfig/libConfig.vcxproj.filters deleted file mode 100644 index 5fc2cf9..0000000 --- a/libConfig/libConfig.vcxproj.filters +++ /dev/null @@ -1,68 +0,0 @@ - - - - - {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} - cpp;c;cxx;moc;h;def;odl;idl;res; - - - {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} - cpp;c;cxx;moc;h;def;odl;idl;res; - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} - ts;xlf - false - - - {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} - ts;xlf - false - - - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - - - Generated Files - - - Generated Files - - - - - Translation Files - - - \ No newline at end of file diff --git a/libConfig/libConfig.vcxproj.user b/libConfig/libConfig.vcxproj.user deleted file mode 100644 index be25078..0000000 --- a/libConfig/libConfig.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/libProjectManager/libProjectManager.vcxproj b/libProjectManager/libProjectManager.vcxproj deleted file mode 100644 index 0960c95..0000000 --- a/libProjectManager/libProjectManager.vcxproj +++ /dev/null @@ -1,177 +0,0 @@ - - - - - Release - x64 - - - Debug - x64 - - - - {5CBE83F9-2019-33DC-8327-32F7A2AC9EF6} - libProjectManager - QtVS_v304 - 10.0.22621.0 - 10.0.22621.0 - $(MSBuildProjectDirectory)\QtMsBuild - - - v141 - release\ - false - NotSet - DynamicLibrary - release\ - libProjectManager - - - v141 - debug\ - false - NotSet - DynamicLibrary - debug\ - libProjectManager - - - - - - - - - - debug\debug\libProjectManagertruerelease\release\libProjectManagertruefalse5.12.11_msvc2017_64core;xml;gui5.12.11_msvc2017_64core;xml;gui - - - - GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;..\libConfig;release;/include;%(AdditionalIncludeDirectories) - -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus /utf-8 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) - release\ - false - None - 4577;4467;%(DisableSpecificWarnings) - Sync - release\ - MaxSpeed - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;LIBPROJECTMANAGER_LIBRARY;QT_NO_DEBUG;NDEBUG;%(PreprocessorDefinitions) - false - - MultiThreadedDLL - true - true - Level3 - true - - libConfig.lib;%(AdditionalDependencies) - D:\Projects\Cpp\QtNovelDesc\libConfig\release;%(AdditionalLibraryDirectories) - true - false - true - true - false - $(OutDir)\libProjectManager.dll - true - Windows - true - - - Unsigned - None - 0 - - - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;LIBPROJECTMANAGER_LIBRARY;QT_NO_DEBUG;%(PreprocessorDefinitions) - - iconsdefaultRcc'ing %(Identity)...$(Configuration)qrc_%(Filename).cpp - - - GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;..\libConfig;debug;/include;%(AdditionalIncludeDirectories) - -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus /utf-8 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) - debug\ - false - ProgramDatabase - 4577;4467;%(DisableSpecificWarnings) - Sync - debug\ - Disabled - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;LIBPROJECTMANAGER_LIBRARY;%(PreprocessorDefinitions) - false - MultiThreadedDebugDLL - true - true - Level3 - true - - D:\Projects\Cpp\QtNovelDesc\libConfig\debug\libConfig.lib;%(AdditionalDependencies) - D:\Projects\Cpp\QtNovelDesc\libConfig\debug;%(AdditionalLibraryDirectories) - true - true - true - true - $(OutDir)\libProjectManager.dll - true - Windows - true - - - Unsigned - None - 0 - - - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;LIBPROJECTMANAGER_LIBRARY;_DEBUG;%(PreprocessorDefinitions) - - iconsdefaultRcc'ing %(Identity)...$(Configuration)qrc_%(Filename).cpp - - - - - - - - - - - Document - true - $(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs) - cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus /utf-8 -Zi -MDd -EHsc -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2>NUL >debug\moc_predefs.h - Generate moc_predefs.h - debug\moc_predefs.h;%(Outputs) - - - Document - $(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs) - cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus /utf-8 -O2 -MD -EHsc -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2>NUL >release\moc_predefs.h - Generate moc_predefs.h - release\moc_predefs.h;%(Outputs) - true - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/libProjectManager/libProjectManager.vcxproj.filters b/libProjectManager/libProjectManager.vcxproj.filters deleted file mode 100644 index a2129ca..0000000 --- a/libProjectManager/libProjectManager.vcxproj.filters +++ /dev/null @@ -1,91 +0,0 @@ - - - - - {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} - cpp;c;cxx;moc;h;def;odl;idl;res; - - - {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} - cpp;c;cxx;moc;h;def;odl;idl;res; - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} - qrc;* - false - - - {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} - qrc;* - false - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} - ts;xlf - false - - - {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} - ts;xlf - false - - - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - - - Generated Files - - - Generated Files - - - - - - - Translation Files - - - - - Resource Files - - - Resource Files - - - Resource Files - - - \ No newline at end of file diff --git a/libProjectManager/libProjectManager.vcxproj.user b/libProjectManager/libProjectManager.vcxproj.user deleted file mode 100644 index be25078..0000000 --- a/libProjectManager/libProjectManager.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/libSplitView/baseview.cpp b/libSplitView/baseview.cpp new file mode 100644 index 0000000..bbcceb1 --- /dev/null +++ b/libSplitView/baseview.cpp @@ -0,0 +1,169 @@ +#include "baseview.h" + +#include +#include +#include +#include +#include +#include +#include + +using namespace SplitFrame; + +DragHeader::DragHeader(BaseView *bind) : QFrame(bind->bind()), icon_store(new QLabel(this)), title_store(new QLabel(this)), view_core(bind) { + setFrameShadow(QFrame::Shadow::Raised); + setFrameShape(QFrame::Shape::Box); + setStyleSheet("background-color: rgb(200, 200, 255);"); + + auto layout = new QHBoxLayout(this); + layout->setMargin(1); + layout->setSpacing(2); + layout->addWidget(icon_store, 0); + layout->addWidget(title_store, 1); + + auto hide = new QPushButton("-", this); + layout->addWidget(hide, 0); + hide->setMaximumSize(20, 20); + auto close = new QPushButton("X", this); + layout->addWidget(close, 0); + close->setMaximumSize(20, 20); + + connect(hide, &QPushButton::clicked, [=]() { view_core->pRelease(); }); + connect(close, &QPushButton::clicked, [=]() { view_core->pClose(); }); +} + +void DragHeader::setIcon(const QIcon &icon) { + icon_inst = icon; + auto len = this->height() - 2; + this->icon_store->setPixmap(icon.pixmap(QSize(len, len))); +} + +QIcon DragHeader::icon() const { return this->icon_inst; } + +void DragHeader::setText(const QString &title) { this->title_store->setText(title); } + +QString DragHeader::text() const { return title_store->text(); } + +void DragHeader::mousePressEvent(QMouseEvent *event) { + if (event->button() == Qt::LeftButton && !std::get<0>(press_flag)) { + this->press_flag = std::make_tuple(true, event->pos()); + } +} + +void DragHeader::mouseReleaseEvent(QMouseEvent *event) { + if (event->button() == Qt::LeftButton) { + this->press_flag = std::make_tuple(false, QPointF()); + } +} + +void DragHeader::mouseMoveEvent(QMouseEvent *event) { + auto distance = QLineF(std::get<1>(press_flag), event->pos()).length(); + if (std::get<0>(press_flag) && distance > QApplication::startDragDistance()) { + auto panel = view_core->viewPanel(); + panel->setAdjustView(view_core); + + QDrag *drag = new QDrag(this); + auto pix = view_core->bind()->grab(); + drag->setPixmap(pix); + drag->setHotSpot(QPoint(20, 20)); + + QMimeData *mimeData = new QMimeData; + mimeData->setText("移动视图:" + view_core->title()); + drag->setMimeData(mimeData); + + drag->exec(); + } +} + +BaseView::BaseView(const QString &title, QWidget *view, bool empty, QWidget *parent) : QWidget(parent), title_header(nullptr), parent_store(nullptr) { + auto layout = new QVBoxLayout(this); + layout->setMargin(0); + layout->setSpacing(0); + + registElement(this); + + if (!empty) { + title_header = new DragHeader(this); + title_header->setText(title); + title_header->setMaximumHeight(22); + + layout->addWidget(title_header, 0); + registElement(title_header); + } + + registElement(view); + layout->addWidget(view, 1); + setMouseTracking(true); +} + +BaseView::~BaseView() { qDebug() << "view-delete" << title() << endl; } + +void BaseView::setTitle(const QString &title) { + QWidget::setWindowTitle(title); + title_header->setText(title); +} + +QString BaseView::title() const { return this->title_header->text(); } + +void BaseView::setIcon(const QIcon &icon) { this->title_header->setIcon(icon); } + +QIcon BaseView::viewIcon() const { return title_header->icon(); } + +void BaseView::registElement(QWidget *child) { + if (this->comps_list.contains(child)) + return; + + comps_list << child; + + if (child != this) + child->setParent(this); +} + +ViewPresent *BaseView::viewPanel() const { + auto parent_inst = parentRes(); + return parent_inst->viewPanel(); +} + +bool BaseView::contains(QWidget *ptr) const { return comps_list.contains(ptr); } + +QWidget *BaseView::bind() const { return const_cast(this); } + +ViewRes *BaseView::parentRes() const { return parent_store; } + +void BaseView::pRelease() { + auto parent = parentRes(); + if (parent) { + auto host_ptr = viewPanel(); + dynamic_cast(parent)->removeComp(this); + host_ptr->markFreedom(this); + } +} + +void BaseView::pClose() { + auto ptr = viewPanel(); + pRelease(); + ptr->purge(this); +} + +void BaseView::setParentRes(ViewRes *pinst) { + this->parent_store = pinst; + + this->setParent(pinst != nullptr ? pinst->bind() : nullptr); +} + +QRectF BaseView::outline() const { return this->rect(); } + +void BaseView::relayout(const QRectF &outline) { + this->setGeometry(outline.toRect()); + update(); +} + +void BaseView::installPerceptionHandle(ViewPresent *obj) { + for (auto &it : comps_list) { + it->setAcceptDrops(true); + it->removeEventFilter(obj->globalEventFilter()); + it->installEventFilter(obj->globalEventFilter()); + } +} + +void BaseView::paintEvent(QPaintEvent *ev) { QWidget::paintEvent(ev); } diff --git a/libSplitView/baseview.h b/libSplitView/baseview.h new file mode 100644 index 0000000..15f0072 --- /dev/null +++ b/libSplitView/baseview.h @@ -0,0 +1,82 @@ +#ifndef BASEVIEW_H +#define BASEVIEW_H + +#include "splitpanel.h" +#include +#include +#include +#include + +namespace SplitFrame { + class BaseView; + + /** + * @brief 视图拖拽标题栏 + */ + class DragHeader : public QFrame { + public: + DragHeader(BaseView *bind); + + void setIcon(const QIcon &icon); + QIcon icon() const; + void setText(const QString &title); + QString text() const; + + private: + QIcon icon_inst; + QLabel *const icon_store, *const title_store; + BaseView *const view_core; + std::tuple press_flag = std::make_tuple(false, QPointF()); + + // QWidget interface + protected: + virtual void mousePressEvent(QMouseEvent *event) override; + virtual void mouseReleaseEvent(QMouseEvent *event) override; + virtual void mouseMoveEvent(QMouseEvent *event) override; + }; + + /** + * @brief 基础内容视图组件 + */ + class SPLITVIEW_EXPORT BaseView : private QWidget, public RectCom { + friend class ViewPresent; + + public: + BaseView(const QString &title, QWidget *view, bool empty = false, QWidget *parent = nullptr); + virtual ~BaseView(); + + virtual void setTitle(const QString &title); + virtual QString title() const; + + virtual void setIcon(const QIcon &icon); + virtual QIcon viewIcon() const; + + virtual bool contains(QWidget *inst) const override; + + // ViewRes interface + public: + virtual ViewPresent *viewPanel() const override; + virtual void setParentRes(ViewRes *inst) override; + virtual ViewRes *parentRes() const override; + virtual void pRelease() override; + virtual void pClose() override; + virtual void registElement(QWidget *child) override; + + // RectCom interface + public: + virtual QWidget *bind() const override; + virtual QRectF outline() const override; + virtual void relayout(const QRectF &outline) override; + virtual void paintEvent(QPaintEvent *ev) override; + + private: + DragHeader *title_header; + ViewRes *parent_store; + QList comps_list; + + protected: + virtual void installPerceptionHandle(ViewPresent *obj); + }; +} // namespace SplitFrame + +#endif // BASEVIEW_H diff --git a/SplitView/SplitView.pro b/libSplitView/libSplitView.pro similarity index 89% rename from SplitView/SplitView.pro rename to libSplitView/libSplitView.pro index c96da4e..28afd55 100644 --- a/SplitView/SplitView.pro +++ b/libSplitView/libSplitView.pro @@ -15,10 +15,14 @@ msvc{ } SOURCES += \ + baseview.cpp \ + splitpanel.cpp \ splitview.cpp HEADERS += \ - SplitView_global.h \ + baseview.h \ + splitpanel.h \ + splitpanel_global.h \ splitview.h # Default rules for deployment. diff --git a/libSplitView/splitpanel.cpp b/libSplitView/splitpanel.cpp new file mode 100644 index 0000000..1dea5f1 --- /dev/null +++ b/libSplitView/splitpanel.cpp @@ -0,0 +1,586 @@ +#include "splitpanel.h" +#include "baseview.h" +#include "splitview.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace SplitFrame { + + /** + * @brief 承接堆放操作及设定摆放位置 + */ + class SPLITVIEW_EXPORT AttachPanel : public QWidget { + enum class ActiveArea { LEFT, RIGHT, TOP, BOTTOM, CENTER, NONE }; + + public: + AttachPanel(ViewPresent *host); + + void bindAttachment(RectCom *widget); + RectCom *attachmentTarget() const; + + virtual void paintEvent(QPaintEvent *event) override; + virtual void dragMoveEvent(QDragMoveEvent *event) override; + virtual void dragEnterEvent(QDragEnterEvent *event) override; + virtual void dropEvent(QDropEvent *event) override; + + private: + ViewPresent *const adjust_host; + RectCom *current_target; + ActiveArea active_comp; + + std::tuple view_rects() const; + }; + +} // namespace SplitFrame + +using namespace SplitFrame; +using namespace Config; + +AttachPanel::AttachPanel(ViewPresent *host) : QWidget(host->bind()), adjust_host(host) { + setWindowOpacity(50); + setAcceptDrops(true); +} + +void AttachPanel::bindAttachment(RectCom *widget) { this->current_target = widget; } + +RectCom *AttachPanel::attachmentTarget() const { return this->current_target; } + +void AttachPanel::paintEvent(QPaintEvent *event) { + QWidget::paintEvent(event); + + QPainter p(this); + p.setBrush(Qt::lightGray); + p.fillRect(this->rect(), Qt::lightGray); + + auto rect = this->rect(); + p.setPen(QPen(Qt::black, 4)); + switch (active_comp) { + case ActiveArea::LEFT: + p.fillRect(QRectF(rect.topLeft(), QSizeF(rect.width() / 2, rect.height())), Qt::gray); + break; + case ActiveArea::RIGHT: + p.fillRect(QRectF(rect.center() - QPointF(0, rect.height() / 2), QSizeF(rect.width() / 2, rect.height())), Qt::gray); + break; + case ActiveArea::TOP: + p.fillRect(QRectF(rect.topLeft(), QSizeF(rect.width(), rect.height() / 2)), Qt::gray); + break; + case ActiveArea::BOTTOM: + p.fillRect(QRectF(rect.center() - QPointF(rect.width() / 2, 0), QSizeF(rect.width(), rect.height() / 2)), Qt::gray); + break; + case ActiveArea::CENTER: + p.fillRect(rect, Qt::gray); + break; + default: + break; + } + + p.setBrush(Qt::transparent); + p.setPen(QPen(Qt::black, 1)); + + auto x_views = view_rects(); + QVector rects; + rects << std::get<0>(x_views); + rects << std::get<1>(x_views); + rects << std::get<2>(x_views); + rects << std::get<3>(x_views); + rects << std::get<4>(x_views); + p.drawRects(rects); +} + +void AttachPanel::dragMoveEvent(QDragMoveEvent *event) { + QWidget::dragMoveEvent(event); + + auto tuple_list = view_rects(); + if (std::get<0>(tuple_list).contains(event->pos())) { + this->active_comp = ActiveArea::LEFT; + } else if (std::get<1>(tuple_list).contains(event->pos())) { + this->active_comp = ActiveArea::RIGHT; + + } else if (std::get<2>(tuple_list).contains(event->pos())) { + this->active_comp = ActiveArea::TOP; + + } else if (std::get<3>(tuple_list).contains(event->pos())) { + this->active_comp = ActiveArea::BOTTOM; + + } else if (std::get<4>(tuple_list).contains(event->pos())) { + this->active_comp = ActiveArea::CENTER; + } else { + this->active_comp = ActiveArea::NONE; + } + + this->update(); +} + +void AttachPanel::dragEnterEvent(QDragEnterEvent *event) { + QWidget::dragEnterEvent(event); + + if (adjust_host->adjustState()) + event->acceptProposedAction(); +} + +void AttachPanel::dropEvent(QDropEvent *event) { + QWidget::dropEvent(event); + event->acceptProposedAction(); + + auto xfrom = adjust_host->adjustView(); + auto target = this->attachmentTarget(); + + if (target != xfrom && active_comp != ActiveArea::NONE) { + static_cast(xfrom->parentRes())->removeComp(xfrom); + adjust_host->objsRelateRebuild(); + + auto ptarget = static_cast(target->parentRes()); + auto target_rect = target->outline(); + + RectCom *new_split = nullptr; + switch (this->active_comp) { + case ActiveArea::LEFT: { + new_split = new SplitView(xfrom, target, adjust_host->bind()); + static_cast(new_split)->setSplitInfo(SplitType::SPLIT_H, target_rect.width() / 2, adjust_host->splitterWidth(), false); + } break; + case ActiveArea::RIGHT: { + new_split = new SplitView(target, xfrom, adjust_host->bind()); + static_cast(new_split)->setSplitInfo(SplitType::SPLIT_H, target_rect.width() / 2, adjust_host->splitterWidth(), false); + } break; + case ActiveArea::TOP: { + new_split = new SplitView(xfrom, target, adjust_host->bind()); + static_cast(new_split)->setSplitInfo(SplitType::SPLIT_V, target_rect.height() / 2, adjust_host->splitterWidth(), false); + } break; + case ActiveArea::BOTTOM: { + new_split = new SplitView(target, xfrom, adjust_host->bind()); + static_cast(new_split)->setSplitInfo(SplitType::SPLIT_V, target_rect.height() / 2, adjust_host->splitterWidth(), false); + } break; + case ActiveArea::CENTER: { + new_split = xfrom; + adjust_host->markFreedom(target); + } break; + default: + return; + } + + ptarget->replaceComp(new_split, target); + new_split->relayout(target_rect); + adjust_host->objsRelateRebuild(); + } + + adjust_host->setAdjustView(); + this->setVisible(false); +} + +std::tuple AttachPanel::view_rects() const { + auto rect = this->rect(); + + auto boder_len = std::min(rect.width() - 4, rect.height() - 4); + auto rect_length = std::min(boder_len * 4 / 5, 300); + auto rect_height = rect_length / 3; + + auto lt0 = rect.center() - QPoint(rect_height / 2, rect_length / 2); + auto lt1 = rect.center() - QPoint(rect_length / 2, rect_height / 2); + + return std::make_tuple(QRectF(lt1 - QPointF(3, 0), QSizeF(rect_height, rect_height)), + QRectF(lt1 + QPoint(rect_height * 2 + 3, 0), QSizeF(rect_height, rect_height)), + QRectF(lt0 - QPointF(0, 3), QSizeF(rect_height, rect_height)), + QRectF(lt0 + QPointF(0, rect_height * 2 + 3), QSizeF(rect_height, rect_height)), + QRectF(lt1 + QPointF(rect_height, 0), QSizeF(rect_height, rect_height))); +} + +ViewPresent::ViewPresent(QWidget *parent) : QWidget(parent), accept_panel(new AttachPanel(this)) { + accept_panel->hide(); + setMouseTracking(true); +} + +ViewPresent::~ViewPresent() { accept_panel->deleteLater(); } + +void ViewPresent::addListener(FreedomViewsListener *lsn) { + if (lsn_list.contains(lsn)) + return; + lsn_list << lsn; +} + +void ViewPresent::removeListener(FreedomViewsListener *lsn) { lsn_list.removeAll(lsn); } + +void ViewPresent::regist_basepanel(RectCom *it) { + if (this->all_func_views.contains(it)) + return; + + dynamic_cast(it)->installPerceptionHandle(this); + all_func_views << it; +} + +void ViewPresent::markFreedom(ViewRes *view) { + if (!view) + return; + + auto cinst = static_cast(view); + if (!freedom_views.contains(cinst)) + freedom_views << cinst; + + cinst->bind()->setVisible(false); + cinst->setParentRes(nullptr); +} + +void ViewPresent::purge(ViewRes *target) { + if (!target) + return; + + auto cinst = static_cast(target); + if (!all_func_views.contains(cinst)) + throw new SimpleException("参数非法", "目标实例不属于本ViewPresent"); + + cinst->bind()->setVisible(false); + target->setParentRes(nullptr); + if (temp_visible_view == cinst) + temp_visible_view = nullptr; + + all_func_views.removeAll(cinst); + freedom_views.removeAll(cinst); + display_members.removeAll(cinst); + objsRelateRebuild(); + + delete cinst; +} + +void ViewPresent::temporaryVisible(RectCom *target) { + if (target != nullptr && !this->freedom_views.contains(target)) + throw new SimpleException("参数异常", "非闲置视图不可以设置为临时视图"); + + if (this->temp_visible_view) { + markFreedom(temp_visible_view); + } + + temp_visible_view = target; + if (temp_visible_view) { + temp_visible_view->setParentRes(this); + temp_visible_view->bind()->setVisible(true); + objsRelateRebuild(); + } else + relayout(); +} + +void ViewPresent::setAdjustView(RectCom *one) { + if (one) { + this->adjust_view_temp = one; + dynamic_cast(adjust_view_temp)->bind()->setVisible(false); + dynamic_cast(adjust_view_temp)->bind()->repaint(); + } else { + dynamic_cast(adjust_view_temp)->bind()->setVisible(true); + dynamic_cast(adjust_view_temp)->bind()->repaint(); + this->adjust_view_temp = one; + } +} + +bool ViewPresent::adjustState() const { return this->adjust_view_temp != nullptr; } + +RectCom *ViewPresent::adjustView() const { return this->adjust_view_temp; } + +QObject *ViewPresent::globalEventFilter() const { return dynamic_cast(const_cast(this)); } + +SplitRect *ViewPresent::createSplit(RectCom *first, RectCom *next, SplitType sp, float pos, float split_width) { + auto inst = new SplitView(first, next, this); + inst->setSplitInfo(sp, pos, split_width, false); + return inst; +} + +const QList ViewPresent::freedomViews() const { + QList ret_list; + for (auto &vit : freedom_views) + ret_list << vit; + + return ret_list; +} + +void ViewPresent::resetEngross(RectCom *view) { + for (auto &vit : all_func_views) + vit->pRelease(); + + temp_visible_view = nullptr; + if (display_members.size()) + display_members.clear(); + + if (freedom_views.contains(view)) + freedom_views.removeAll(view); + + view->setParentRes(this); + view->bind()->setVisible(true); + display_members << view; + + objsRelateRebuild(); +} + +bool ViewPresent::eventFilter(QObject *watched, QEvent *event) { + auto adjust_state = adjustState(); + + if (adjust_state && event->type() == QEvent::DragEnter) { + for (auto &v : all_func_views) { + if (v->contains((QWidget *)watched)) { + auto outline = v->outline(); + QPoint gpos(v->bind()->mapToGlobal(outline.topLeft().toPoint())); + QPoint localpos(mapFromGlobal(gpos)); + + accept_panel->raise(); + accept_panel->setGeometry(QRect(localpos, outline.size().toSize())); + accept_panel->setVisible(true); + + accept_panel->bindAttachment(v); + event->accept(); + return true; + } + } + } + + if (event->type() == QEvent::Drop) { + accept_panel->hide(); + accept_panel->lower(); + } + + if (this->temp_visible_view && event->type() == QEvent::MouseButtonPress) { + if (!temp_visible_view->contains((QWidget *)watched)) { + temporaryVisible(nullptr); + } + } + + return QWidget::eventFilter(watched, event); +} + +QWidget *ViewPresent::bind() const { return const_cast(this); } + +bool ViewPresent::contains(QWidget *) const { return false; } + +ViewPresent *ViewPresent::viewPanel() const { return const_cast(this); } + +void ViewPresent::objsRelateRebuild() { + setParentRes(); + + relayout(); + update(); +} + +std::pair ViewPresent::child() const { + RectCom *inst0 = nullptr, *inst1 = nullptr; + if (display_members.size() > 1) + inst1 = display_members[1]; + if (display_members.size() > 0) + inst0 = display_members[0]; + + return std::make_pair(inst0, inst1); +} + +void ViewPresent::replaceComp(RectCom *view, RectCom *old) { + if (!display_members.contains(old)) + throw new SimpleException("参数错误", "指定替换的界面不属于此界面"); + + if (display_members.contains(view)) + return; + + view->setParentRes(this); + display_members.replace(display_members.indexOf(old), view); + + objsRelateRebuild(); +} + +float ViewPresent::splitterWidth() const { return std::get<2>(split_info_store); } + +float ViewPresent::splitterPos() const { return std::get<1>(split_info_store); } + +SplitType ViewPresent::splitType() const { return std::get<0>(split_info_store); } + +void ViewPresent::setSplitInfo(SplitType type, float pos, float width, bool relayout) { + this->split_info_store = std::make_tuple(type, pos, width); + if (relayout) + this->relayout(); +} + +QRectF ViewPresent::outline() const { return this->rect(); } + +void ViewPresent::relayout(const QRectF &outline) { + setGeometry(outline.toRect()); + relayout(); +} + +void ViewPresent::pRelease() { throw new SimpleException("非法操作", "不允许对ViewPanel调用pRelease"); } + +void ViewPresent::pClose() { throw new SimpleException("非法操作", "不允许对ViewPanel调用pClose"); } + +void ViewPresent::registElement(QWidget *) { throw new SimpleException("非法操作", "不允许对ViewPanel调用registElement"); } + +void ViewPresent::setParentRes(ViewRes *) { + auto pair = child(); + + if (pair.first) { + pair.first->setParentRes(this); + } + if (pair.second) { + pair.second->setParentRes(this); + } + if (temp_visible_view) { + temp_visible_view->setParentRes(this); + } +} + +ViewRes *ViewPresent::parentRes() const { return nullptr; } + +void ViewPresent::paintEvent(QPaintEvent *ev) { + QWidget::paintEvent(ev); + + if (display_members.size() == 2) { + QPainter p(this); + auto handle_rect = this->handle_rect(); + p.fillRect(handle_rect, QBrush(Qt::gray)); + } + + for (auto &it : display_members) { + it->bind()->setVisible(true); + it->bind()->update(); + } + + if (temp_visible_view) { + temp_visible_view->bind()->setVisible(true); + temp_visible_view->bind()->update(); + } + + for (auto &it : freedom_views) { + if (it == temp_visible_view) + return; + + it->bind()->setVisible(false); + it->bind()->update(); + } +} + +void ViewPresent::removeComp(RectCom *child_inst) { + if (!child_inst) + return; + + if (temp_visible_view == child_inst) { + temp_visible_view = nullptr; + + freedom_views.removeAll(child_inst); + for (auto &lsn : lsn_list) + lsn->freedomRemoved(child_inst); + } else { + if (!display_members.contains(child_inst)) + throw new SimpleException("参数非法", "不允许移除隐藏的自由视图"); + + display_members.removeAll(child_inst); + } + + child_inst->setParentRes(nullptr); + objsRelateRebuild(); +} + +void ViewPresent::resizeEvent(QResizeEvent *ev) { + QWidget::resizeEvent(ev); + relayout(); +} +void ViewPresent::mousePressEvent(QMouseEvent *event) { + QWidget::mousePressEvent(event); + + if (event->button() == Qt::MouseButton::LeftButton) { + if (handle_rect().contains(event->pos())) + this->press_flags = true; + } +} +void ViewPresent::mouseReleaseEvent(QMouseEvent *event) { + QWidget::mouseReleaseEvent(event); + + if (event->button() == Qt::MouseButton::LeftButton) { + this->press_flags = false; + } +} +void ViewPresent::mouseMoveEvent(QMouseEvent *event) { + QWidget::mouseMoveEvent(event); + + auto drag_rect = handle_rect(); + if (drag_rect.contains(event->pos())) { + if (splitType() == SplitType::SPLIT_H) + setCursor(QCursor(Qt::CursorShape::SplitHCursor)); + else + setCursor(QCursor(Qt::CursorShape::SplitVCursor)); + } else { + setCursor(QCursor(Qt::CursorShape::ArrowCursor)); + } + + if (this->press_flags) { + auto pos = this->mapFromGlobal(event->globalPos()); + auto split_margin = splitterWidth(); + if (std::get<0>(split_info_store) == SplitType::SPLIT_H) { + setSplitInfo(splitType(), pos.x() - split_margin / 2, split_margin, true); + } else { + setSplitInfo(splitType(), pos.y() - split_margin / 2, split_margin, true); + } + + update(); + } +} + +void ViewPresent::relayout() { + auto rects = view_rects(); + + if (display_members.size() == 2) { + display_members[0]->relayout(rects.first.toRect()); + display_members[1]->relayout(rects.second.toRect()); + } else if (display_members.size() == 1) { + display_members[0]->relayout(this->rect()); + } + + if (temp_visible_view) { + temp_visible_view->relayout(QRectF(QPointF(), QSizeF(300, this->height()))); + } + + update(); +} +std::pair ViewPresent::view_rects() { + auto xrect = this->rect(); + + auto type = (int)splitType(); + if (!type) { + auto width0 = splitterPos(); + if (width0 + splitterWidth() > xrect.width()) + width0 = xrect.width() - splitterWidth(); + if (width0 < 0) + width0 = 0; + + setSplitInfo(splitType(), width0, splitterWidth(), false); + + auto rect0 = QRectF(xrect.topLeft(), QSizeF(width0, xrect.height())); + auto rect1 = QRectF(xrect.topLeft() + QPointF(rect0.width() + splitterWidth(), 0), + QSizeF(xrect.width() - rect0.width() - splitterWidth(), xrect.height())); + return std::make_pair(rect0, rect1); + } else { + auto height0 = splitterPos(); + if (height0 + splitterWidth() > xrect.height()) + height0 = xrect.height() - splitterWidth(); + if (height0 < 0) + height0 = 0; + + setSplitInfo(splitType(), height0, splitterWidth(), false); + + auto rect0 = QRectF(xrect.topLeft(), QSizeF(xrect.width(), height0)); + auto rect1 = QRectF(xrect.topLeft() + QPointF(0, rect0.height() + splitterWidth()), + QSizeF(xrect.width(), xrect.height() - splitterWidth() - rect0.height())); + return std::make_pair(rect0, rect1); + } +} +QRectF ViewPresent::handle_rect() const { + QRectF rect; + + auto width_middle = splitterWidth() - 2; + if (splitType() == SplitType::SPLIT_H) { + rect = QRectF(splitterPos() + 1, 0, width_middle, outline().height()); + } else { + rect = QRectF(0, splitterPos() + 1, outline().width(), width_middle); + } + + return rect; +} + +RectCom *ViewPresent::create_base_panel(QWidget *bview, const QString &title, bool empty_flag) { return new BaseView(title, bview, empty_flag); } diff --git a/libSplitView/splitpanel.h b/libSplitView/splitpanel.h new file mode 100644 index 0000000..9577ee8 --- /dev/null +++ b/libSplitView/splitpanel.h @@ -0,0 +1,227 @@ +#ifndef SPLITPANEL_H +#define SPLITPANEL_H + +#include "splitpanel_global.h" + +#include +#include + +namespace SplitFrame { + class ViewPresent; + class AttachPanel; + + /** + * @brief 面板分割方向 + */ + enum class SplitType { SPLIT_H = 0, SPLIT_V = 1 }; + /** + * @brief 临时视图贴附方位 + */ + enum class DockType { LEFT = 0, RIGHT, TOP, BOTTOM }; + + class ViewRes { + public: + virtual ~ViewRes() = default; + + virtual void registElement(QWidget *child) = 0; + + virtual QWidget *bind() const = 0; + virtual ViewPresent *viewPanel() const = 0; + /** + * @brief 关闭视图显示,转换视图为自由(闲置)状态 + */ + virtual void pRelease() = 0; + /** + * @brief 回收视图,清除内存实例 + */ + virtual void pClose() = 0; + + virtual void setParentRes(ViewRes *inst) = 0; + virtual ViewRes *parentRes() const = 0; + }; + + /** + * @brief 资源管理接口 + */ + class ResManager { + public: + virtual ~ResManager() = default; + + virtual ViewPresent *viewPanel() const = 0; + virtual void objsRelateRebuild() = 0; + virtual void markFreedom(ViewRes *view) = 0; + virtual void purge(ViewRes *target) = 0; + }; + + /** + * @brief 视图展示接口 + */ + class RectCom : public ViewRes { + public: + virtual ~RectCom() = default; + + virtual bool contains(QWidget *ptr) const = 0; + + virtual QRectF outline() const = 0; + virtual void relayout(const QRectF &outline) = 0; + + virtual void paintEvent(QPaintEvent *ev) = 0; + }; + + /** + * @brief 功能视图基板 + */ + template class FnWrap : public QWidget { + private: + static bool type_blank_blank; + ViewPresent *const host_store; + + public: + explicit FnWrap(ViewPresent *bind, QWidget *parent = nullptr) : QWidget(parent), host_store(bind) {} + virtual ~FnWrap() { this->closeProcess(); } + + ViewPresent *bindHost() const { return host_store; } + + virtual void closeProcess(){}; + }; + + /** + * @brief 分裂视图规划和约束组件 + */ + class SplitRect : public RectCom { + public: + virtual ~SplitRect() = default; + + virtual std::pair child() const = 0; + virtual void removeComp(RectCom *child) = 0; + virtual void replaceComp(RectCom *view, RectCom *old) = 0; + virtual float splitterWidth() const = 0; + virtual float splitterPos() const = 0; + virtual SplitType splitType() const = 0; + virtual void setSplitInfo(SplitType type, float pos, float width, bool relayout = true) = 0; + }; + + class FreedomViewsListener { + public: + virtual ~FreedomViewsListener() = default; + /** + * @brief 闲置视图增加 + * @param ins + */ + virtual void freedomAppended(RectCom *ins, const QIcon &icon, const QString &title) = 0; + /** + * @brief 闲置视图减少 + * @param ins + */ + virtual void freedomRemoved(RectCom *ins) = 0; + }; + + /** + * @brief 分裂视图呈现组件 + */ + class SPLITVIEW_EXPORT ViewPresent : private QWidget, public SplitRect, public ResManager { + public: + ViewPresent(QWidget *parent = nullptr); + virtual ~ViewPresent(); + + void addListener(FreedomViewsListener *lsn); + void removeListener(FreedomViewsListener *lsn); + //====================================================== + const QList freedomViews() const; + void resetEngross(RectCom *view = nullptr); + void temporaryVisible(RectCom *target = nullptr); + + QObject *globalEventFilter() const; + + /** + * @brief 切换视图调整状态 + * @param state 状态开关 + */ + void setAdjustView(RectCom *one = nullptr); + bool adjustState() const; + RectCom *adjustView() const; + + SplitRect *createSplit(RectCom *first, RectCom *next, SplitType sp, float pos = 20, float split_width = 8); + + template RectCom *appendView(FnWrap *view_inst, const QString &title) { + if (view_inst->bindHost() != this) + throw new Config::SimpleException("非法操作", "不允许混用不同ViewPresent的成员"); + + auto panel = create_base_panel(view_inst, title, _blank); + regist_basepanel(panel); + + return panel; + } + + // RectCom interface + public: + virtual QWidget *bind() const override; + virtual bool contains(QWidget *) const override; + virtual QRectF outline() const override; + virtual void relayout(const QRectF &outline) override; + + // ViewRes interface + public: + virtual ViewPresent *viewPanel() const override; + virtual void setParentRes(ViewRes *p = nullptr) override; + virtual ViewRes *parentRes() const override; + virtual void pRelease() override; + virtual void pClose() override; + virtual void registElement(QWidget *) override; + + // ResManager interface + public: + virtual void objsRelateRebuild() override; + virtual void markFreedom(ViewRes *view) override; + virtual void purge(ViewRes *target) override; + + // SplitRect interface + public: + virtual std::pair child() const override; + virtual void removeComp(RectCom *child) override; + virtual void replaceComp(RectCom *view, RectCom *old) override; + virtual float splitterWidth() const override; + virtual float splitterPos() const override; + virtual SplitType splitType() const override; + virtual void setSplitInfo(SplitType type, float pos, float width, bool relayout) override; + + // QObject interface + public: + virtual bool eventFilter(QObject *watched, QEvent *event) override; + + // QWidget interface + protected: + virtual void paintEvent(QPaintEvent *ev) override; + virtual void resizeEvent(QResizeEvent *ev) override; + virtual void mousePressEvent(QMouseEvent *event) override; + virtual void mouseReleaseEvent(QMouseEvent *event) override; + virtual void mouseMoveEvent(QMouseEvent *event) override; + + private: + QList lsn_list; + AttachPanel *const accept_panel; + + // 拖拽属性=================================== + RectCom *adjust_view_temp; // 拖拽中转 + bool press_flags = false; // 空间调整标志 + // 方向,splitter位置,splitter宽度 + std::tuple split_info_store = std::make_tuple(SplitType::SPLIT_H, 200, 8); + + // 视图展现堆栈=============================== + QList all_func_views; + QList freedom_views; + QList display_members; + + RectCom *temp_visible_view = nullptr; + + std::pair view_rects(); + QRectF handle_rect() const; + + virtual void relayout(); + RectCom *create_base_panel(QWidget *bview, const QString &title, bool empty_flag = false); + void regist_basepanel(RectCom *it); + }; + +} // namespace SplitFrame + +#endif // SPLITPANEL_H diff --git a/SplitView/SplitView_global.h b/libSplitView/splitpanel_global.h similarity index 64% rename from SplitView/SplitView_global.h rename to libSplitView/splitpanel_global.h index 469158a..be8686c 100644 --- a/SplitView/SplitView_global.h +++ b/libSplitView/splitpanel_global.h @@ -1,5 +1,5 @@ -#ifndef SPLITVIEW_GLOBAL_H -#define SPLITVIEW_GLOBAL_H +#ifndef SPLITPANEL_GLOBAL_H +#define SPLITPANEL_GLOBAL_H #include @@ -9,4 +9,4 @@ # define SPLITVIEW_EXPORT Q_DECL_IMPORT #endif -#endif // SPLITVIEW_GLOBAL_H +#endif // SPLITPANEL_GLOBAL_H diff --git a/libSplitView/splitview.cpp b/libSplitView/splitview.cpp new file mode 100644 index 0000000..61f7d5b --- /dev/null +++ b/libSplitView/splitview.cpp @@ -0,0 +1,231 @@ +#include "splitview.h" +#include "baseview.h" +#include +#include + +using namespace SplitFrame; +using namespace Config; + +SplitView::SplitView(RectCom *first, RectCom *next, QWidget *parent) : QWidget(parent) { + this->split_info_value = std::make_tuple(SplitType::SPLIT_H, 100, 7); + this->child_store << first; + this->child_store << next; + + first->setParentRes(this); + next->setParentRes(this); + + setMouseTracking(true); +} + +SplitFrame::SplitView::~SplitView() { + for (auto &it : children()) { + auto widget = qobject_cast(it); + if (widget) { + widget->setParent(nullptr); + } + } +} + +QWidget *SplitView::bind() const { return const_cast(this); } + +ViewPresent *SplitView::viewPanel() const { return parentRes()->viewPanel(); } + +ViewRes *SplitView::parentRes() const { return parent_inst; } + +void SplitView::setParentRes(ViewRes *pinst) { + this->parent_inst = pinst; + QWidget::setParent(pinst != nullptr ? pinst->bind() : nullptr); + + for (auto &c : child_store) + c->setParentRes(this); +} + +void SplitView::registElement(QWidget *) { throw new SimpleException("非法操作", "SplitView当前不支持registElement操作"); } + +void SplitView::pRelease() { throw new SimpleException("非法操作", "SplitView当前不支持pRelease操作"); } + +void SplitView::pClose() { throw new SimpleException("非法操作", "SplitView当前不支持pClose操作"); } + +std::pair SplitView::child() const { return std::make_pair(child_store[0], child_store[1]); } + +float SplitView::splitterWidth() const { return std::get<2>(split_info_value); } + +float SplitView::splitterPos() const { return std::get<1>(split_info_value); } + +SplitType SplitView::splitType() const { return std::get<0>(split_info_value); } + +void SplitView::setSplitInfo(SplitType type, float pos, float width, bool relayout) { + this->split_info_value = std::make_tuple(type, pos, width); + if (relayout) + this->relayout(); +} + +void SplitView::replaceComp(RectCom *view, RectCom *old) { + if (!child_store.contains(old) || child_store.contains(view)) { + throw new SimpleException("参数非法", "要替换的视图不属于本构件,或者新视图本就属于本构件"); + } + + auto index = child_store.indexOf(old); + child_store.replace(index, view); + view->setParentRes(this); + + viewPanel()->objsRelateRebuild(); +} + +QRectF SplitView::outline() const { return this->rect(); } + +void SplitView::relayout(const QRectF &outlinex) { + this->setGeometry(outlinex.toRect()); + this->relayout(); +} + +void SplitView::removeComp(RectCom *child_inst) { + auto pinst = parentRes(); + auto prev_childs = child(); + + prev_childs.first->setParentRes(nullptr); + prev_childs.second->setParentRes(nullptr); + this->child_store.clear(); + this->setParentRes(nullptr); + + auto sib = prev_childs.first; + if (child_inst == sib) + sib = prev_childs.second; + + static_cast(pinst)->replaceComp(sib, this); + delete this; +} + +void SplitView::paintEvent(QPaintEvent *ev) { + QWidget::paintEvent(ev); + + QPainter p(this); + QRectF rect = handle_rect(); + p.fillRect(rect, QBrush(Qt::gray, Qt::BrushStyle::SolidPattern)); + + for (auto &it : child_store) { + it->bind()->setVisible(true); + it->bind()->update(); + } +} + +bool SplitView::contains(QWidget *) const { return false; } + +void SplitView::resizeEvent(QResizeEvent *ev) { + QWidget::resizeEvent(ev); + relayout(); +} + +void SplitView::mousePressEvent(QMouseEvent *event) { + QWidget::mousePressEvent(event); + + if (event->button() == Qt::MouseButton::LeftButton) { + if (handle_rect().contains(event->pos())) + this->press_flags = true; + } +} + +void SplitView::mouseReleaseEvent(QMouseEvent *event) { + QWidget::mouseReleaseEvent(event); + + if (event->button() == Qt::MouseButton::LeftButton) { + this->press_flags = false; + } +} + +void SplitView::mouseMoveEvent(QMouseEvent *event) { + QWidget::mouseMoveEvent(event); + + auto drag_rect = handle_rect() + QMargins(2, 2, 2, 2); + if (drag_rect.contains(event->pos())) { + if (splitType() == SplitType::SPLIT_H) + setCursor(QCursor(Qt::CursorShape::SplitHCursor)); + else + setCursor(QCursor(Qt::CursorShape::SplitVCursor)); + + drags_flag = true; + } else { + setCursor(QCursor(Qt::CursorShape::ArrowCursor)); + } + + if (this->press_flags) { + auto pos = this->mapFromGlobal(event->globalPos()); + auto split_margin = splitterWidth(); + if (std::get<0>(split_info_value) == SplitType::SPLIT_H) { + setSplitInfo(splitType(), pos.x() - split_margin / 2, split_margin, true); + } else { + setSplitInfo(splitType(), pos.y() - split_margin / 2, split_margin, true); + } + update(); + } +} + +bool SplitView::eventFilter(QObject *watched, QEvent *event) { + if (watched != this && this->drags_flag && event->type() == QEvent::MouseMove) { + auto x = static_cast(event); + auto pos = mapFromGlobal(x->globalPos()); + if (!handle_rect().contains(pos)) { + setCursor(QCursor(Qt::CursorShape::ArrowCursor)); + this->drags_flag = false; + } + return true; + } + + return QWidget::eventFilter(watched, event); +} + +void SplitView::relayout() { + auto rects = view_rects(); + auto pair = child(); + + pair.first->relayout(std::get<0>(rects)); + pair.second->relayout(std::get<1>(rects)); + + update(); +} + +std::pair SplitView::view_rects() { + auto xrect = this->rect(); + + auto type = (int)splitType(); + if (!type) { + auto width0 = splitterPos(); + if (width0 + splitterWidth() > xrect.width()) + width0 = xrect.width() - splitterWidth(); + if (width0 < 0) + width0 = 0; + + setSplitInfo(splitType(), width0, splitterWidth(), false); + + auto rect0 = QRectF(xrect.topLeft(), QSizeF(width0, xrect.height())); + auto rect1 = QRectF(xrect.topLeft() + QPointF(rect0.width() + splitterWidth(), 0), + QSizeF(xrect.width() - rect0.width() - splitterWidth(), xrect.height())); + return std::make_pair(rect0, rect1); + } else { + auto height0 = splitterPos(); + if (height0 + splitterWidth() > xrect.height()) + height0 = xrect.height() - splitterWidth(); + if (height0 < 0) + height0 = 0; + + setSplitInfo(splitType(), height0, splitterWidth(), false); + + auto rect0 = QRectF(xrect.topLeft(), QSizeF(xrect.width(), height0)); + auto rect1 = QRectF(xrect.topLeft() + QPointF(0, rect0.height() + splitterWidth()), + QSizeF(xrect.width(), xrect.height() - splitterWidth() - rect0.height())); + return std::make_pair(rect0, rect1); + } +} + +QRectF SplitView::handle_rect() const { + QRectF rect; + + auto width_middle = splitterWidth() - 2; + if (splitType() == SplitType::SPLIT_H) { + rect = QRectF(splitterPos() + 1, 0, width_middle, outline().height()); + } else { + rect = QRectF(0, splitterPos() + 1, outline().width(), width_middle); + } + + return rect; +} diff --git a/libSplitView/splitview.h b/libSplitView/splitview.h new file mode 100644 index 0000000..bb31367 --- /dev/null +++ b/libSplitView/splitview.h @@ -0,0 +1,69 @@ +#ifndef SPLITVIEW_H +#define SPLITVIEW_H + +#include "splitpanel.h" + +namespace SplitFrame { + + /** + * @brief 分割视图 + */ + class SPLITVIEW_EXPORT SplitView : private QWidget, public SplitRect { + + public: + SplitView(RectCom *first, RectCom *next, QWidget *parent = nullptr); + virtual ~SplitView(); + + // ViewRes interface + public: + virtual QWidget *bind() const override; + virtual ViewPresent *viewPanel() const override; + virtual void setParentRes(ViewRes *inst) override; + virtual ViewRes *parentRes() const override; + virtual void registElement(QWidget *child) override; + virtual void pRelease() override; + virtual void pClose() override; + + // RectCom interface + public: + virtual QRectF outline() const override; + virtual void relayout(const QRectF &outline) override; + virtual void paintEvent(QPaintEvent *ev) override; + virtual bool contains(QWidget *) const override; + + // SplitRect interface + public: + virtual std::pair child() const override; + virtual void removeComp(RectCom *child) override; + virtual void replaceComp(RectCom *view, RectCom *old) override; + virtual float splitterWidth() const override; + virtual float splitterPos() const override; + virtual SplitType splitType() const override; + virtual void setSplitInfo(SplitType type, float pos, float width, bool relayout) override; + + // QObject interface + public: + virtual bool eventFilter(QObject *watched, QEvent *event) override; + + // QWidget interface + protected: + virtual void mousePressEvent(QMouseEvent *event) override; + virtual void mouseReleaseEvent(QMouseEvent *event) override; + virtual void mouseMoveEvent(QMouseEvent *event) override; + virtual void resizeEvent(QResizeEvent *event) override; + + private: + ViewRes *parent_inst; + QList child_store; + // type, pos, width + std::tuple split_info_value; + bool press_flags = false, drags_flag = false; + + virtual void relayout(); + std::pair view_rects(); + QRectF handle_rect() const; + }; + +} // namespace SplitFrame + +#endif // SPLITVIEW_H diff --git a/u_test/main.cpp b/u_test/main.cpp index 78cdba2..41930f1 100644 --- a/u_test/main.cpp +++ b/u_test/main.cpp @@ -9,6 +9,8 @@ #include #include #include +#include +#include #include using namespace SplitFrame; @@ -16,14 +18,6 @@ using namespace SplitFrame; int main(int argc, char *argv[]) { QApplication a(argc, argv); - // auto z = new QWidget(); - - // auto v = new XWidget(); - // v->setParent(z); - // v->setGeometry(0, 50, 200, 100); - - // z->show(); - auto win = new QMainWindow(); win->setMinimumSize(800, 600); win->menuBar()->addMenu("文件"); @@ -31,45 +25,34 @@ int main(int argc, char *argv[]) { win->addToolBar(Qt::ToolBarArea::LeftToolBarArea, tbar); auto b = tbar->addAction("添加"); - auto aview = new BaseView("hello", new QWidget); - auto bview = new BaseView("world", new QWidget); - auto cview = new BaseView("everyone", new QWidget); - auto dview = new BaseView("forth", new XWidget); - - auto conv0 = new SplitView(aview, bview); - conv0->setSplitInfo(SplitType::SPLIT_V, 100, 8, true); auto conv = new ViewPresent(); - win->setCentralWidget(conv); - conv->resetViews(conv0, cview); + auto aview = new XWidget(conv, Qt::black); + auto bview = new XWidget(conv, Qt::green); + auto cview = new XWidget(conv, Qt::yellow); + auto dview = new YWidget(conv); - conv->registViewComp(aview); - conv->registViewComp(bview); - conv->registViewComp(cview); - conv->registViewComp(dview); - conv->markFreedom(dview); + auto rect0 = conv->appendView(aview, "hello0"); + auto rect1 = conv->appendView(bview, "hello1"); + auto rect2 = conv->appendView(cview, "hello2"); + auto rect3 = conv->appendView(dview, "hello3"); + conv->markFreedom(rect0); + conv->markFreedom(rect1); + conv->markFreedom(rect2); + conv->markFreedom(rect3); conv->objsRelateRebuild(); + conv->resetEngross(static_cast(rect3)); + + win->setCentralWidget(conv->bind()); - b->setCheckable(true); win->connect(b, &QAction::triggered, [=](bool v) { - if (v) - conv->setTempVisible(dview); - else - conv->setTempVisible(nullptr); + auto items = conv->freedomViews(); + if (items.size()) { + conv->temporaryVisible(items.last()); + } }); win->show(); - // auto w = new QWidget(); - // QLabel w0, w1; - // w0.setPixmap(a.style()->standardIcon(QStyle::StandardPixmap::SP_ArrowUp).pixmap(QSize(20, 20))); - // w1.setText("hello"); - // auto v = new QHBoxLayout(w); - // v->setMargin(0); - // v->setSpacing(1); - // v->addWidget(&w0, 0); - // v->addWidget(&w1, 1); - // w->show(); - return a.exec(); } diff --git a/u_test/u_test.pro b/u_test/u_test.pro index ed2aa0d..242af8e 100644 --- a/u_test/u_test.pro +++ b/u_test/u_test.pro @@ -9,6 +9,11 @@ CONFIG -= app_bundle # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 +msvc{ + QMAKE_CFLAGS += /utf-8 + QMAKE_CXXFLAGS += /utf-8 +} + SOURCES += \ main.cpp \ unnnn.cpp @@ -21,12 +26,12 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin HEADERS += \ unnnn.h -win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../SplitView/release/ -lSplitView -else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../SplitView/debug/ -lSplitView -else:unix: LIBS += -L$$OUT_PWD/../SplitView/ -lSplitView +win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../libSplitView/release/ -llibSplitView +else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../libSplitView/debug/ -llibSplitView +else:unix: LIBS += -L$$OUT_PWD/../libSplitView/ -llibSplitView -INCLUDEPATH += $$PWD/../SplitView -DEPENDPATH += $$PWD/../SplitView +INCLUDEPATH += $$PWD/../libSplitView +DEPENDPATH += $$PWD/../libSplitView win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../GenericConsole/release/ -lGenericConsole else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../GenericConsole/debug/ -lGenericConsole @@ -34,3 +39,10 @@ else:unix: LIBS += -L$$OUT_PWD/../GenericConsole/ -lGenericConsole INCLUDEPATH += $$PWD/../GenericConsole DEPENDPATH += $$PWD/../GenericConsole + +win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../libConfig/release/ -llibConfig +else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../libConfig/debug/ -llibConfig +else:unix: LIBS += -L$$OUT_PWD/../libConfig/ -llibConfig + +INCLUDEPATH += $$PWD/../libConfig +DEPENDPATH += $$PWD/../libConfig diff --git a/u_test/u_test.vcxproj b/u_test/u_test.vcxproj deleted file mode 100644 index ab5609f..0000000 --- a/u_test/u_test.vcxproj +++ /dev/null @@ -1,193 +0,0 @@ - - - - - Release - x64 - - - Debug - x64 - - - - {2A348B24-97E4-3DE1-84FD-5A95F92CEADE} - u_test - QtVS_v304 - 10.0.22621.0 - 10.0.22621.0 - $(MSBuildProjectDirectory)\QtMsBuild - - - - v141 - release\ - false - NotSet - Application - release\ - u_test - - - v141 - debug\ - false - NotSet - Application - debug\ - u_test - - - - - - - - - - - - - - - - - - $(SolutionDir)x64\Debug - debug\ - u_test - true - $(SolutionDir)x64\Debug;$(LibraryPath) - - - release\ - release\ - u_test - true - false - - - 5.12.11_msvc2017_64 - core;xml;gui;widgets - - - 5.12.11_msvc2017_64 - core;xml;gui;widgets - - - - - - - GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;..\SplitView;..\GenericConsole;release;/include;%(AdditionalIncludeDirectories) - -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) - release\ - false - None - 4577;4467;%(DisableSpecificWarnings) - Sync - release\ - MaxSpeed - _CONSOLE;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_NO_DEBUG;NDEBUG;%(PreprocessorDefinitions) - false - - - MultiThreadedDLL - true - true - Level3 - true - - - SplitView.lib;GenericConsole.lib;%(AdditionalDependencies) - D:\Projects\Cpp\QtNovelDesc\SplitView\release;D:\Projects\Cpp\QtNovelDesc\GenericConsole\release;%(AdditionalLibraryDirectories) - "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions) - true - false - true - false - $(OutDir)\u_test.exe - true - Console - true - - - Unsigned - None - 0 - - - _CONSOLE;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_NO_DEBUG;%(PreprocessorDefinitions) - - - - - GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;..\SplitView;..\GenericConsole;debug;/include;%(AdditionalIncludeDirectories) - -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions) - debug\ - false - ProgramDatabase - 4577;4467;%(DisableSpecificWarnings) - Sync - debug\ - Disabled - _CONSOLE;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;%(PreprocessorDefinitions) - false - MultiThreadedDebugDLL - true - true - Level3 - true - - - SplitView.lib;D:\Projects\Cpp\QtNovelDesc\GenericConsole\debug\GenericConsole.lib;%(AdditionalDependencies) - D:\Projects\Cpp\QtNovelDesc\SplitView\debug;D:\Projects\Cpp\QtNovelDesc\GenericConsole\debug;%(AdditionalLibraryDirectories) - "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions) - true - true - true - $(OutDir)\u_test.exe - true - Console - true - - - Unsigned - None - 0 - - - _CONSOLE;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;_DEBUG;%(PreprocessorDefinitions) - - - - - - - - - - - - Document - true - $(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs) - cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2>NUL >debug\moc_predefs.h - Generate moc_predefs.h - debug\moc_predefs.h;%(Outputs) - - - Document - $(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs) - cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2>NUL >release\moc_predefs.h - Generate moc_predefs.h - release\moc_predefs.h;%(Outputs) - true - - - - - - - - \ No newline at end of file diff --git a/u_test/u_test.vcxproj.filters b/u_test/u_test.vcxproj.filters deleted file mode 100644 index 0b5fbf1..0000000 --- a/u_test/u_test.vcxproj.filters +++ /dev/null @@ -1,50 +0,0 @@ - - - - - {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} - cpp;c;cxx;moc;h;def;odl;idl;res; - - - {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} - cpp;c;cxx;moc;h;def;odl;idl;res; - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Source Files - - - Source Files - - - - - Header Files - - - - - Generated Files - - - Generated Files - - - \ No newline at end of file diff --git a/u_test/u_test.vcxproj.user b/u_test/u_test.vcxproj.user deleted file mode 100644 index be25078..0000000 --- a/u_test/u_test.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/u_test/unnnn.cpp b/u_test/unnnn.cpp index 677ef3e..8c6082a 100644 --- a/u_test/unnnn.cpp +++ b/u_test/unnnn.cpp @@ -1,10 +1,22 @@ #include "unnnn.h" #include +using namespace SplitFrame; -XWidget::XWidget(QWidget *parent) : QWidget(parent) {} +XWidget::XWidget(ViewPresent *host, Qt::GlobalColor c, QWidget *parent) : FnWrap(host, parent), c_store(c) {} void XWidget::paintEvent(QPaintEvent *ev) { QPainter p(this); - p.fillRect(this->rect(), Qt::red); + p.fillRect(this->rect(), c_store); } + +void XWidget::closeProcess() {} + +YWidget::YWidget(ViewPresent *host, QWidget *parent) : FnWrap(host, parent) {} + +void YWidget::paintEvent(QPaintEvent *ev) { + QPainter p(this); + p.fillRect(this->rect(), Qt::blue); +} + +void YWidget::closeProcess() {} diff --git a/u_test/unnnn.h b/u_test/unnnn.h index f62738e..ec729e6 100644 --- a/u_test/unnnn.h +++ b/u_test/unnnn.h @@ -3,11 +3,28 @@ #include #include +#include -class XWidget : public QWidget { +class XWidget : public SplitFrame::FnWrap { public: - XWidget(QWidget *parent = nullptr); - virtual void paintEvent(QPaintEvent *ev); + XWidget(SplitFrame::ViewPresent *host, Qt::GlobalColor c, QWidget *parent = nullptr); + virtual void paintEvent(QPaintEvent *ev) override; + + // FnWrap interface +public: + virtual void closeProcess() override; + +private: + Qt::GlobalColor c_store; +}; + +class YWidget : public SplitFrame::FnWrap { +public: + YWidget(SplitFrame::ViewPresent *host, QWidget *parent = nullptr); + virtual void paintEvent(QPaintEvent *ev) override; + // FnWrap interface +public: + virtual void closeProcess() override; }; #endif // UNNNN_H