diff --git a/examples/QQPlayer/QQPlayer.rc b/examples/QQPlayer/QQPlayer.rc index 3e26090..ffd8ed1 100644 --- a/examples/QQPlayer/QQPlayer.rc +++ b/examples/QQPlayer/QQPlayer.rc @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (C) 2020 by wangwenx190 (Yuhang Zhao) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + #include IDI_ICON1 ICON "QQPlayer.ico" diff --git a/examples/QQPlayer/main.cpp b/examples/QQPlayer/main.cpp index 5cec51f..75fc760 100644 --- a/examples/QQPlayer/main.cpp +++ b/examples/QQPlayer/main.cpp @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (C) 2020 by wangwenx190 (Yuhang Zhao) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + #include "../../framelessquickhelper.h" #include #include @@ -11,10 +35,10 @@ int main(int argc, char *argv[]) { Qt::ApplicationAttribute::AA_EnableHighDpiScaling); QGuiApplication::setAttribute( Qt::ApplicationAttribute::AA_UseHighDpiPixmaps); -#endif #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) QGuiApplication::setHighDpiScaleFactorRoundingPolicy( Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); +#endif #endif QGuiApplication::setApplicationName(QString::fromUtf8("QQPlayer")); QGuiApplication::setApplicationDisplayName(QString::fromUtf8("QQPlayer")); diff --git a/examples/QQPlayer/resources/qml/CloseButton.qml b/examples/QQPlayer/resources/qml/CloseButton.qml index a21a74e..81f9ea5 100644 --- a/examples/QQPlayer/resources/qml/CloseButton.qml +++ b/examples/QQPlayer/resources/qml/CloseButton.qml @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (C) 2020 by wangwenx190 (Yuhang Zhao) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + import QtQuick 2.15 import QtQuick.Controls 2.15 diff --git a/examples/QQPlayer/resources/qml/MainMenuButton.qml b/examples/QQPlayer/resources/qml/MainMenuButton.qml index 48a062d..d7a0b6a 100644 --- a/examples/QQPlayer/resources/qml/MainMenuButton.qml +++ b/examples/QQPlayer/resources/qml/MainMenuButton.qml @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (C) 2020 by wangwenx190 (Yuhang Zhao) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + import QtQuick 2.15 import QtQuick.Controls 2.15 diff --git a/examples/QQPlayer/resources/qml/MaximizeButton.qml b/examples/QQPlayer/resources/qml/MaximizeButton.qml index 41cbe0c..44b66fc 100644 --- a/examples/QQPlayer/resources/qml/MaximizeButton.qml +++ b/examples/QQPlayer/resources/qml/MaximizeButton.qml @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (C) 2020 by wangwenx190 (Yuhang Zhao) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + import QtQuick 2.15 import QtQuick.Controls 2.15 diff --git a/examples/QQPlayer/resources/qml/MinimizeButton.qml b/examples/QQPlayer/resources/qml/MinimizeButton.qml index 7b81000..857e145 100644 --- a/examples/QQPlayer/resources/qml/MinimizeButton.qml +++ b/examples/QQPlayer/resources/qml/MinimizeButton.qml @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (C) 2020 by wangwenx190 (Yuhang Zhao) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + import QtQuick 2.15 import QtQuick.Controls 2.15 diff --git a/examples/QQPlayer/resources/qml/NextButton.qml b/examples/QQPlayer/resources/qml/NextButton.qml index 425a4ec..827ec50 100644 --- a/examples/QQPlayer/resources/qml/NextButton.qml +++ b/examples/QQPlayer/resources/qml/NextButton.qml @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (C) 2020 by wangwenx190 (Yuhang Zhao) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + import QtQuick 2.15 import QtQuick.Controls 2.15 diff --git a/examples/QQPlayer/resources/qml/OpenFileButton.qml b/examples/QQPlayer/resources/qml/OpenFileButton.qml index 4f6b186..d61d00d 100644 --- a/examples/QQPlayer/resources/qml/OpenFileButton.qml +++ b/examples/QQPlayer/resources/qml/OpenFileButton.qml @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (C) 2020 by wangwenx190 (Yuhang Zhao) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + import QtQuick 2.15 import QtQuick.Controls 2.15 diff --git a/examples/QQPlayer/resources/qml/PlayButton.qml b/examples/QQPlayer/resources/qml/PlayButton.qml index dd159e5..b0ae534 100644 --- a/examples/QQPlayer/resources/qml/PlayButton.qml +++ b/examples/QQPlayer/resources/qml/PlayButton.qml @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (C) 2020 by wangwenx190 (Yuhang Zhao) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + import QtQuick 2.15 import QtQuick.Controls 2.15 diff --git a/examples/QQPlayer/resources/qml/PreviousButton.qml b/examples/QQPlayer/resources/qml/PreviousButton.qml index 05d3583..8042343 100644 --- a/examples/QQPlayer/resources/qml/PreviousButton.qml +++ b/examples/QQPlayer/resources/qml/PreviousButton.qml @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (C) 2020 by wangwenx190 (Yuhang Zhao) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + import QtQuick 2.15 import QtQuick.Controls 2.15 diff --git a/examples/QQPlayer/resources/qml/ProgressSlider.qml b/examples/QQPlayer/resources/qml/ProgressSlider.qml index 7a7a9c6..f32403e 100644 --- a/examples/QQPlayer/resources/qml/ProgressSlider.qml +++ b/examples/QQPlayer/resources/qml/ProgressSlider.qml @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (C) 2020 by wangwenx190 (Yuhang Zhao) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + import QtQuick 2.15 import QtQuick.Controls 2.15 diff --git a/examples/QQPlayer/resources/qml/StopButton.qml b/examples/QQPlayer/resources/qml/StopButton.qml index ac404fa..760aeee 100644 --- a/examples/QQPlayer/resources/qml/StopButton.qml +++ b/examples/QQPlayer/resources/qml/StopButton.qml @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (C) 2020 by wangwenx190 (Yuhang Zhao) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + import QtQuick 2.15 import QtQuick.Controls 2.15 diff --git a/examples/QQPlayer/resources/qml/VolumeButton.qml b/examples/QQPlayer/resources/qml/VolumeButton.qml index 47da2fd..33b8418 100644 --- a/examples/QQPlayer/resources/qml/VolumeButton.qml +++ b/examples/QQPlayer/resources/qml/VolumeButton.qml @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (C) 2020 by wangwenx190 (Yuhang Zhao) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + import QtQuick 2.15 import QtQuick.Controls 2.15 diff --git a/examples/QQPlayer/resources/qml/main.qml b/examples/QQPlayer/resources/qml/main.qml index 1ec4043..aa6e46e 100644 --- a/examples/QQPlayer/resources/qml/main.qml +++ b/examples/QQPlayer/resources/qml/main.qml @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (C) 2020 by wangwenx190 (Yuhang Zhao) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + import QtQuick 2.15 import QtQuick.Window 2.15 import wangwenx190.Utils 1.0 diff --git a/examples/QWidget/main.cpp b/examples/QWidget/main.cpp index 110869b..7cff2e1 100644 --- a/examples/QWidget/main.cpp +++ b/examples/QWidget/main.cpp @@ -30,59 +30,10 @@ #include #ifdef Q_OS_WINDOWS #include "../../winnativeeventfilter.h" -#include -#include #else #include "../../framelesshelper.h" #endif -static inline bool shouldHaveWindowFrame() -{ -#ifdef Q_OS_WINDOWS - return QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows10; -#else - return false; -#endif -} - -class Widget : public QWidget -{ - Q_OBJECT - Q_DISABLE_COPY_MOVE(Widget) - -public: - explicit Widget(QWidget *parent = nullptr) : QWidget(parent) - { - isWin10OrGreater = shouldHaveWindowFrame(); - } - ~Widget() override = default; - - bool isNormaled() const { return !isMinimized() && !isMaximized() && !isFullScreen(); } - -protected: - void paintEvent(QPaintEvent *event) override - { - QWidget::paintEvent(event); -#ifdef Q_OS_WINDOWS - if (isWin10OrGreater && isNormaled()) { - QPainter painter(this); - painter.save(); - painter.setPen(isActiveWindow() ? borderColor_active : borderColor_inactive); - painter.drawLine(0, 0, width(), 0); - // painter.drawLine(0, height(), width(), height()); - // painter.drawLine(0, 0, 0, height()); - // painter.drawLine(width(), 0, width(), height()); - painter.restore(); - } -#endif - } - -private: - const QColor borderColor_active = {/*"#707070"*/ "#ffffff"}; - const QColor borderColor_inactive = {"#aaaaaa"}; - bool isWin10OrGreater = false; -}; - int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); @@ -113,7 +64,7 @@ int main(int argc, char *argv[]) FramelessHelper helper; #endif - Widget widget; + QWidget widget; widget.setContentsMargins(2, 2, 2, 2); QLabel *label = new QLabel; QObject::connect(&widget, &QWidget::windowTitleChanged, label, &QLabel::setText); @@ -170,5 +121,3 @@ int main(int argc, char *argv[]) return QApplication::exec(); } - -#include "main.moc" diff --git a/examples/Quick/main.cpp b/examples/Quick/main.cpp index 33fcf0b..1f70f77 100644 --- a/examples/Quick/main.cpp +++ b/examples/Quick/main.cpp @@ -25,19 +25,6 @@ #include "../../framelessquickhelper.h" #include #include -#include -#ifdef Q_OS_WINDOWS -#include -#endif - -static inline bool shouldHaveWindowFrame() -{ -#ifdef Q_OS_WINDOWS - return QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows10; -#else - return false; -#endif -} int main(int argc, char *argv[]) { @@ -83,12 +70,8 @@ int main(int argc, char *argv[]) } }, Qt::QueuedConnection); + engine.load(mainQmlUrl); - QList rootObjs = engine.rootObjects(); - Q_ASSERT(!rootObjs.isEmpty()); - QObject *rootObj = rootObjs.at(0); - Q_ASSERT(rootObj); - QQmlProperty::write(rootObj, QString::fromUtf8("isWin10OrGreater"), shouldHaveWindowFrame()); return QGuiApplication::exec(); } diff --git a/resources/qml/CloseButton.qml b/resources/qml/CloseButton.qml index 0ead30e..2ef1603 100644 --- a/resources/qml/CloseButton.qml +++ b/resources/qml/CloseButton.qml @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (C) 2020 by wangwenx190 (Yuhang Zhao) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + import QtQuick 2.15 import QtQuick.Controls 2.15 diff --git a/resources/qml/MaximizeButton.qml b/resources/qml/MaximizeButton.qml index 08a4b70..86878df 100644 --- a/resources/qml/MaximizeButton.qml +++ b/resources/qml/MaximizeButton.qml @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (C) 2020 by wangwenx190 (Yuhang Zhao) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + import QtQuick 2.15 import QtQuick.Controls 2.15 diff --git a/resources/qml/MinimizeButton.qml b/resources/qml/MinimizeButton.qml index 6c9c983..37eb91a 100644 --- a/resources/qml/MinimizeButton.qml +++ b/resources/qml/MinimizeButton.qml @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (C) 2020 by wangwenx190 (Yuhang Zhao) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + import QtQuick 2.15 import QtQuick.Controls 2.15 diff --git a/resources/qml/main.qml b/resources/qml/main.qml index 07c9edd..f9d5dfc 100644 --- a/resources/qml/main.qml +++ b/resources/qml/main.qml @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (C) 2020 by wangwenx190 (Yuhang Zhao) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + import QtQuick 2.15 import QtQuick.Window 2.15 import wangwenx190.Utils 1.0 @@ -9,30 +33,16 @@ Window { height: 600 title: qsTr("Hello, World!") - property bool isWin10OrGreater: false - FramelessHelper { id: framelessHelper } - Rectangle { - visible: isWin10OrGreater && (window.visibility === Window.Windowed) - anchors { - top: parent.top - left: parent.left - right: parent.right - } - height: 1 - color: Qt.application.state === Qt.ApplicationActive ? /*"#707070"*/ "#ffffff" : "#aaaaaa" - } - Rectangle { id: titleBar height: framelessHelper.titleBarHeight color: "white" anchors { top: parent.top - topMargin: 1 left: parent.left right: parent.right }