diff --git a/Groups/Text/JsonFormat/JsonFormat.pri b/Groups/Text/JsonFormat/JsonFormat.pri new file mode 100755 index 0000000..833a500 --- /dev/null +++ b/Groups/Text/JsonFormat/JsonFormat.pri @@ -0,0 +1,11 @@ +INCLUDEPATH += \ + $$PWD/cpp/ + +HEADERS += \ + $$PWD/cpp/JsonFormat.h + +SOURCES += \ + $$PWD/cpp/JsonFormat.cpp + +RESOURCES += \ + $$PWD/qml/JsonFormat.qrc diff --git a/Groups/Text/JsonFormat/cpp/JsonFormat.cpp b/Groups/Text/JsonFormat/cpp/JsonFormat.cpp new file mode 100755 index 0000000..1a4a34b --- /dev/null +++ b/Groups/Text/JsonFormat/cpp/JsonFormat.cpp @@ -0,0 +1,32 @@ +#include "JsonFormat.h" + +// Qt lib import +#include +#include +#include +#include + +// JQToolsLibrary import +#include "JQToolsLibrary.hpp" + +using namespace JsonFormat; + +bool Manage::check(const QString &string) +{ + return !QJsonDocument::fromJson( string.toUtf8() ).isNull(); +} + +QString Manage::format(const QString &string, const bool &compact) +{ + return QJsonDocument::fromJson( string.toUtf8() ).toJson( ( compact ) ? ( QJsonDocument::Compact ) : ( QJsonDocument::Indented ) ); +} + +QString Manage::clipboardText() +{ + return qApp->clipboard()->text(); +} + +void Manage::setClipboardText(const QString &string) +{ + qApp->clipboard()->setText( string ); +} diff --git a/Groups/Text/JsonFormat/cpp/JsonFormat.h b/Groups/Text/JsonFormat/cpp/JsonFormat.h new file mode 100755 index 0000000..9e7bd32 --- /dev/null +++ b/Groups/Text/JsonFormat/cpp/JsonFormat.h @@ -0,0 +1,37 @@ +#ifndef __JsonFormat_h__ +#define __JsonFormat_h__ + +// Qt lib import +#include + +#define JSONFORMAT_INITIALIZA \ +{ \ + qmlRegisterType("JsonFormat", 1, 0, "JsonFormatManage"); \ +} + +namespace JsonFormat +{ + +class Manage: public QObject +{ + Q_OBJECT + Q_DISABLE_COPY(Manage) + +public: + Manage() = default; + + ~Manage() = default; + +public slots: + bool check(const QString &string); + + QString format(const QString &string, const bool &compact); + + QString clipboardText(); + + void setClipboardText(const QString &string); +}; + +} + +#endif//__JsonFormat_h__ diff --git a/Groups/Text/JsonFormat/qml/JsonFormat.qml b/Groups/Text/JsonFormat/qml/JsonFormat.qml new file mode 100755 index 0000000..2250b93 --- /dev/null +++ b/Groups/Text/JsonFormat/qml/JsonFormat.qml @@ -0,0 +1,96 @@ +import QtQuick 2.5 +import QtQuick.Controls 1.4 +import QtGraphicalEffects 1.0 +import "qrc:/MaterialUI/Interface/" +import JsonFormat 1.0 + +Item { + id: jsonFormat + width: 620 + height: 540 + + function format() { + if ( !jsonFormatManage.check( textFieldForSource.text ) ) + { + materialUI.showSnackbarMessage( "无效的JSON字符串" ); + return false; + } + + textFieldForSource.text = jsonFormatManage.format( textFieldForSource.text, checkBoxForCompact.checked ); + return true; + } + + JsonFormatManage { + id: jsonFormatManage + } + + MaterialButton { + x: 386 + text: "格式化" + anchors.horizontalCenterOffset: 0 + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + anchors.topMargin: 39 + + onClicked: jsonFormat.format(); + } + + MaterialButton { + x: 386 + text: "处理剪切板内容" + anchors.horizontalCenterOffset: 172 + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + anchors.topMargin: 39 + + onClicked: { + textFieldForSource.text = jsonFormatManage.clipboardText(); + if ( !jsonFormat.format() ) { return; } + jsonFormatManage.setClipboardText( textFieldForSource.text ); + materialUI.showSnackbarMessage( "格式化后的JSON字符串已经复制到了剪切板" ); + } + } + + MaterialCheckBox { + id: checkBoxForCompact + x: 192 + text: "压缩模式" + anchors.horizontalCenterOffset: -147 + anchors.top: parent.top + anchors.topMargin: 30 + anchors.horizontalCenter: parent.horizontalCenter + } + + RectangularGlow { + z: -1 + anchors.fill: itemForSource + glowRadius: 6 + spread: 0.22 + color: "#20000000" + } + + Item { + id: itemForSource + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.bottom: parent.bottom + anchors.bottomMargin: 10 + width: jsonFormat.width - 20 + height: jsonFormat.height - 110 + clip: true + + Rectangle { + anchors.fill: parent + color: "#ffffff" + } + + TextEdit { + id: textFieldForSource + x: 5 + y: 5 + width: parent.width - 10 + height: parent.height - 10 + wrapMode: TextInput.WrapAnywhere + } + } +} diff --git a/Groups/Text/JsonFormat/qml/JsonFormat.qrc b/Groups/Text/JsonFormat/qml/JsonFormat.qrc new file mode 100755 index 0000000..abfff7c --- /dev/null +++ b/Groups/Text/JsonFormat/qml/JsonFormat.qrc @@ -0,0 +1,5 @@ + + + JsonFormat.qml + + diff --git a/Groups/Text/Text.pri b/Groups/Text/Text.pri index d45204e..6d6af65 100755 --- a/Groups/Text/Text.pri +++ b/Groups/Text/Text.pri @@ -3,3 +3,4 @@ include($$PWD/RgbStringTransform/RgbStringTransform.pri) include($$PWD/UrlEncode/UrlEncode.pri) include($$PWD/RandomPassword/RandomPassword.pri) include($$PWD/CaseTransform/CaseTransform.pri) +include($$PWD/JsonFormat/JsonFormat.pri) diff --git a/Library/JQLibrary/JQLibrary.pri b/Library/JQLibrary/JQLibrary.pri index c34b4f9..9f760ba 100755 --- a/Library/JQLibrary/JQLibrary.pri +++ b/Library/JQLibrary/JQLibrary.pri @@ -56,6 +56,11 @@ exists($$PWD/src/JQEncrypt.cpp) { HEADERS *= $$PWD/include/JQEncrypt.h } +exists($$PWD/src/JQExcel.cpp) { + SOURCES *= $$PWD/src/JQExcel.cpp + HEADERS *= $$PWD/include/JQExcel.h +} + exists($$PWD/src/JQFile.cpp) { SOURCES *= $$PWD/src/JQFile.cpp HEADERS *= $$PWD/include/JQFile.h diff --git a/Library/JQLibrary/bin/JQQmlLib/Qt5.6.0/MinGW/libJQQmlLib.a b/Library/JQLibrary/bin/JQQmlLib/Qt5.6.0/MinGW/libJQQmlLib.a index c90937b..07c0d67 100755 Binary files a/Library/JQLibrary/bin/JQQmlLib/Qt5.6.0/MinGW/libJQQmlLib.a and b/Library/JQLibrary/bin/JQQmlLib/Qt5.6.0/MinGW/libJQQmlLib.a differ diff --git a/Library/JQLibrary/include/JQFoundation.h b/Library/JQLibrary/include/JQFoundation.h index 5c71d42..c160fdc 100755 --- a/Library/JQLibrary/include/JQFoundation.h +++ b/Library/JQLibrary/include/JQFoundation.h @@ -37,28 +37,21 @@ // Qt lib import #include -#include -#include #include +#include #include #include #include #include -#include #include #include -#include #include #include #include -#include #include #include #include - -#include -#include -#include +#include class QTableWidget; class QTreeWidget; @@ -98,7 +91,7 @@ class QLineEdit; private: #define PrimaryKeyPropertyDeclare(ClassName, Type, name, ...) \ - Type Name __VA_ARGS__; \ + Type name __VA_ARGS__; \ ClassName() = default; \ ClassName(const Type &name ## _): name(name ## _) { } \ operator QVariant() const { return name; } \ diff --git a/Library/JQLibrary/include/JQQmlLib/JQQmlLib.h b/Library/JQLibrary/include/JQQmlLib/JQQmlLib.h index d1f5d97..0520c5d 100755 --- a/Library/JQLibrary/include/JQQmlLib/JQQmlLib.h +++ b/Library/JQLibrary/include/JQQmlLib/JQQmlLib.h @@ -21,7 +21,7 @@ #define JQQmlLibAddToEngine(engine) \ { \ Q_INIT_RESOURCE(JQQmlLib); \ - (engine).setImportPathList( { ":/JasonQt_QmlLib/qml/" } ); \ + (engine).addImportPath( ":/JasonQt_QmlLib/qml/" ); \ } #endif//__JQQmlLib_h__ diff --git a/Library/JQLibrary/include/JQSettings.h b/Library/JQLibrary/include/JQSettings.h index 27a9d57..84c50af 100755 --- a/Library/JQLibrary/include/JQSettings.h +++ b/Library/JQLibrary/include/JQSettings.h @@ -18,64 +18,59 @@ #ifndef __JQSettings_h__ #define __JQSettings_h__ -// C lib import -#include - // Qt lib import #include -#include -#include -#include -#include #include -#include -#include -#include +#include + +#define JQSETTINGS_DEFAULTPROJECTGROUPNAME "JasonQt" -#define JQSettings_DefaultProjectGroupName "JasonQt" +class QTimer; namespace JQSettings { -QString documentsPath(const QString &projectName, const QString &projectGroupName = JQSettings_DefaultProjectGroupName); +QString documentsPath(const QString &projectName, const QString &projectGroupName = JQSETTINGS_DEFAULTPROJECTGROUPNAME); -QSharedPointer settingsFile(const QString &fileName, const QString &projectName, const QString &projectGroupName = JQSettings_DefaultProjectGroupName); +QSharedPointer< QSettings > settingsFile(const QString &fileName, const QString &projectName, const QString &projectGroupName = JQSETTINGS_DEFAULTPROJECTGROUPNAME); class Set: public QObject { Q_OBJECT public: - Set(const QString &fileName, const QString &groupName, const QString &projectName, const QString &projectGroupName = JQSettings_DefaultProjectGroupName); + Set(const QString &fileName, const QString &groupName, const QString &projectName, const QString &projectGroupName = JQSETTINGS_DEFAULTPROJECTGROUPNAME); ~Set(void); - QJsonValue operator[](const QString &key); + const QVariant operator[](const QString &key); QString filePath(void) const; public slots: bool contains(const QString &key); - QJsonValue value(const QString &key, const QJsonValue &defaultValue); + QVariant value(const QString &key, const QVariant &defaultValue); - QJsonValue value(const QString &key); + QVariant value(const QString &key); - void setValue(const QString &key, const QJsonValue &data); + void setValue(const QString &key, const QVariant &data); void save(void); - void readySave(const int &wait = 1000); + void readySave(const int &delayTime = 1000); void read(void); private: - QString filePath_; + QString fileName_; QString groupName_; + QString projectName_; + QString filePath_; - QMap< QString, QJsonValue > datas_; + QMap< QString, QVariant > datas_; - QTimer *timer_; + QSharedPointer< QTimer > timer_; }; } diff --git a/Library/JQLibrary/src/JQFoundation.cpp b/Library/JQLibrary/src/JQFoundation.cpp index a199d53..d3572cb 100755 --- a/Library/JQLibrary/src/JQFoundation.cpp +++ b/Library/JQLibrary/src/JQFoundation.cpp @@ -20,6 +20,9 @@ // Qt lib import #include +#include +#include +#include #include #include @@ -33,13 +36,15 @@ #include #include #include +#include +#include using namespace JQFoundation; void JQFoundation::eventLoopSleep(const int &delay) { QEventLoop eventLoop; - QTimer::singleShot(delay, &eventLoop, SLOT(quit())); + QTimer::singleShot( delay, &eventLoop, &QEventLoop::quit ); eventLoop.exec(); } diff --git a/Library/JQLibrary/src/JQSettings.cpp b/Library/JQLibrary/src/JQSettings.cpp index 67134f1..6339494 100755 --- a/Library/JQLibrary/src/JQSettings.cpp +++ b/Library/JQLibrary/src/JQSettings.cpp @@ -1,4 +1,4 @@ -/* +/* This file is part of JQLibrary Copyright: Jason @@ -17,75 +17,105 @@ #include "JQSettings.h" +// Qt lib import +#include +#include +#include +#include +#include +#include + using namespace JQSettings; QString JQSettings::documentsPath(const QString &projectName, const QString &projectGroupName) { - assert(!projectName.isEmpty()); - assert(!projectGroupName.isEmpty()); + if ( projectName.isEmpty() ) + { + qDebug() << "JQSettings::settingsFile: warning: projectName is empty"; + } + + if ( projectGroupName.isEmpty() ) + { + qDebug() << "JQSettings::settingsFile: warning: projectGroupName is empty"; + } #if (defined Q_OS_IOS) QDir dir(QStandardPaths::writableLocation(QStandardPaths::TempLocation)); dir.cdUp(); - dir.cd("Documents"); + dir.cd("Library"); + dir.cd("Preferences"); return dir.path() + "/"; #elif (defined Q_OS_ANDROID) - return "/sdcard/" + projectGroupName + "." + projectName + "/"; + return "/sdcard/" + projectGroupName + "_" + projectName + "/"; #elif (defined Q_OS_MAC) QDir dir(QStandardPaths::writableLocation(QStandardPaths::TempLocation)); dir.cdUp(); dir.cd("C"); - return dir.path() + "/" + projectGroupName + "." + projectName + "/"; + return dir.path() + "/" + projectGroupName + "_" + projectName + "/"; #elif (defined Q_OS_WIN) QDir dir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)); dir.cdUp(); - return dir.path() + "/" + projectGroupName + "." + projectName + "/"; + return dir.path() + "/" + projectGroupName + "_" + projectName + "/"; #else QDir dir(QStandardPaths::writableLocation(QStandardPaths::TempLocation)); - return dir.path() + "/" + projectGroupName + "." + projectName + "/"; + return dir.path() + "/" + projectGroupName + "_" + projectName + "/"; #endif } -QSharedPointer JQSettings::settingsFile(const QString &fileName, const QString &projectName, const QString &projectGroupName) +QSharedPointer< QSettings > JQSettings::settingsFile(const QString &fileName, const QString &projectName, const QString &projectGroupName) { - assert(!fileName.isEmpty()); + if ( fileName.isEmpty() ) + { + qDebug() << "JQSettings::settingsFile: warning: fileName is empty"; + } - return QSharedPointer(new QSettings(JQSettings::documentsPath(projectName, projectGroupName) + fileName, QSettings::IniFormat)); + if ( projectName.isEmpty() ) + { + qDebug() << "JQSettings::settingsFile: warning: projectName is empty"; + } + + if ( projectGroupName.isEmpty() ) + { + qDebug() << "JQSettings::settingsFile: warning: projectGroupName is empty"; + } + + return QSharedPointer< QSettings >( new QSettings( JQSettings::documentsPath( projectName, projectGroupName ) + fileName, QSettings::IniFormat ) ); } Set::Set(const QString &fileName, const QString &groupName, const QString &projectName, const QString &projectGroupName): - filePath_(documentsPath(projectName, projectGroupName) + fileName), - groupName_(groupName), - timer_(nullptr) + fileName_( fileName ), + groupName_( groupName ), + projectName_( projectName ), + filePath_( documentsPath( projectName, projectGroupName ) + fileName ) { this->read(); } Set::~Set(void) { - if (timer_) + if ( timer_ ) { - if (timer_->isActive()) + if ( timer_->isActive() ) { this->save(); } - delete timer_; + timer_.clear(); } } -QJsonValue Set::operator[](const QString &key) +const QVariant Set::operator[](const QString &key) { - if (!datas_.contains(key)) + if ( !datas_.contains( key ) ) { this->readySave(); } @@ -99,97 +129,84 @@ QString Set::filePath(void) const bool Set::contains(const QString &key) { - return datas_.contains(key); + return datas_.contains( key ); } -QJsonValue Set::value(const QString &key, const QJsonValue &defaultValue) +QVariant Set::value(const QString &key, const QVariant &defaultValue) { - if (!datas_.contains(key)) + if ( !datas_.contains( key ) ) { this->setValue(key, defaultValue); } - return datas_[key]; + return datas_[ key ]; } -QJsonValue Set::value(const QString &key) +QVariant Set::value(const QString &key) { - if (!datas_.contains(key)) + if ( !datas_.contains( key ) ) { - return QJsonValue(); + return { }; } - return datas_[key]; + return datas_[ key ]; } -void Set::setValue(const QString &key, const QJsonValue &data) +void Set::setValue(const QString &key, const QVariant &data) { - datas_[key] = data; + datas_[ key ] = data; this->readySave(); } void Set::save(void) { - QSettings settings(filePath_); - - settings.beginGroup(groupName_); - +#ifdef Q_OS_IOS + QSettings settings( projectName_, fileName_ ); +#else + QSettings settings( filePath_ ); +#endif + + settings.beginGroup( groupName_ ); + for (auto it = datas_.begin(); it != datas_.end(); it++) { - QJsonObject buf; - buf["type"] = (int)it.value().type(); - buf["data"] = it.value(); - settings.setValue(it.key(), QJsonDocument(buf).toJson()); + settings.setValue( it.key(), it.value() ); } settings.endGroup(); } -void Set::readySave(const int &wait) +void Set::readySave(const int &delayTime) { - if (!timer_) + if ( !timer_ ) { - timer_ = new QTimer; - timer_->setSingleShot(true); + timer_.reset( new QTimer ); + timer_->setSingleShot( true ); - connect(timer_, SIGNAL(timeout()), this, SLOT(save())); + connect( timer_.data(), &QTimer::timeout, this, &Set::save ); } - if (timer_->isActive()) + if ( timer_->isActive() ) { timer_->stop(); } - timer_->start(wait); + timer_->start( delayTime ); } void Set::read(void) { - QSettings settings(filePath_); - - settings.beginGroup(groupName_); +#ifdef Q_OS_IOS + QSettings settings( projectName_, fileName_ ); +#else + QSettings settings( filePath_ ); +#endif + + settings.beginGroup( groupName_ ); datas_.clear(); - foreach (const auto &now, settings.allKeys()) + + for ( const auto &key: settings.allKeys() ) { - const auto &&data = QJsonDocument::fromJson(settings.value(now).toByteArray()).object(); - switch (data["type"].toInt()) - { - case QJsonValue::Bool: - { - datas_[now] = data["data"].toBool(); - break; - } - case QJsonValue::Double: - { - datas_[now] = data["data"].toDouble(); - break; - } - case QJsonValue::String: - { - datas_[now] = data["data"].toString(); - break; - } - default: { break; } - } + datas_[ key ] = settings.value( key ); } settings.endGroup(); diff --git a/Library/JQToolsLibrary/include/JQToolsLibrary.hpp b/Library/JQToolsLibrary/include/JQToolsLibrary.hpp index e3a47c6..8e5d376 100755 --- a/Library/JQToolsLibrary/include/JQToolsLibrary.hpp +++ b/Library/JQToolsLibrary/include/JQToolsLibrary.hpp @@ -1,6 +1,6 @@ #ifndef __JQToolsLibrary_hpp__ #define __JQToolsLibrary_hpp__ -#define JQTOOLS_VERSIONSTRING "16.5.30" +#define JQTOOLS_VERSIONSTRING "16.6.7" #endif//__JQToolsLibrary_hpp__ diff --git a/Library/MaterialUI/Element/BaseListItem.qml b/Library/MaterialUI/Element/BaseListItem.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Element/BottomSheet.qml b/Library/MaterialUI/Element/BottomSheet.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Element/CircleMask.qml b/Library/MaterialUI/Element/CircleMask.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Element/Divider.qml b/Library/MaterialUI/Element/Divider.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Element/Dropdown.qml b/Library/MaterialUI/Element/Dropdown.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Element/Ink.qml b/Library/MaterialUI/Element/Ink.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Element/PopupBase.qml b/Library/MaterialUI/Element/PopupBase.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Element/Scrollbar.qml b/Library/MaterialUI/Element/Scrollbar.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Element/Standard.qml b/Library/MaterialUI/Element/Standard.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Element/Subheader.qml b/Library/MaterialUI/Element/Subheader.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Element/ThemePalette.qml b/Library/MaterialUI/Element/ThemePalette.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Element/ThinDivider.qml b/Library/MaterialUI/Element/ThinDivider.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Element/View.qml b/Library/MaterialUI/Element/View.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialActionButton.qml b/Library/MaterialUI/Interface/MaterialActionButton.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialBottomActionSheet.qml b/Library/MaterialUI/Interface/MaterialBottomActionSheet.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialButton.qml b/Library/MaterialUI/Interface/MaterialButton.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialCheckBox.qml b/Library/MaterialUI/Interface/MaterialCheckBox.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialDatePicker.qml b/Library/MaterialUI/Interface/MaterialDatePicker.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialDialog.qml b/Library/MaterialUI/Interface/MaterialDialog.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialDialogAlert.qml b/Library/MaterialUI/Interface/MaterialDialogAlert.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialDialogConfirm.qml b/Library/MaterialUI/Interface/MaterialDialogConfirm.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialDialogDatePicker.qml b/Library/MaterialUI/Interface/MaterialDialogDatePicker.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialDialogPrompt.qml b/Library/MaterialUI/Interface/MaterialDialogPrompt.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialDialogScrolling.qml b/Library/MaterialUI/Interface/MaterialDialogScrolling.qml old mode 100755 new mode 100644 index 4d0813f..fb34c56 --- a/Library/MaterialUI/Interface/MaterialDialogScrolling.qml +++ b/Library/MaterialUI/Interface/MaterialDialogScrolling.qml @@ -128,7 +128,10 @@ MaterialDialog { exclusiveGroup: checkGroup checked: defaultChecked - onClicked: { + onCheckedChanged: { + if ( !checked ) { return; } + + radioButton.checked = true; currentItemIndex = itemIndex; currentItemText = itemText; currentItemFlag = itemFlag; diff --git a/Library/MaterialUI/Interface/MaterialDialogTimePicker.qml b/Library/MaterialUI/Interface/MaterialDialogTimePicker.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialLabel.qml b/Library/MaterialUI/Interface/MaterialLabel.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialMenuField.qml b/Library/MaterialUI/Interface/MaterialMenuField.qml old mode 100755 new mode 100644 index a933321..906fd46 --- a/Library/MaterialUI/Interface/MaterialMenuField.qml +++ b/Library/MaterialUI/Interface/MaterialMenuField.qml @@ -113,13 +113,13 @@ Item { id: dropdown anchor: Item.TopLeft width: itemWidth - height: Math.min(maxVisibleItems * (48) + (24), listView.height) + height: Math.min(maxVisibleItems * (48), listView.height) ListView { id: listView width: dropdown.width - height: Math.min(count > 0 ? contentHeight : 0, 4.5 * (48)); + height: Math.min(count > 0 ? contentHeight : 0, maxVisibleItems * (48)); interactive: true diff --git a/Library/MaterialUI/Interface/MaterialPage.qml b/Library/MaterialUI/Interface/MaterialPage.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialProgressBar.qml b/Library/MaterialUI/Interface/MaterialProgressBar.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialProgressCircle.qml b/Library/MaterialUI/Interface/MaterialProgressCircle.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialRadioButton.qml b/Library/MaterialUI/Interface/MaterialRadioButton.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialSlider.qml b/Library/MaterialUI/Interface/MaterialSlider.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialSnackbar.qml b/Library/MaterialUI/Interface/MaterialSnackbar.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialSwipeToRefresh.qml b/Library/MaterialUI/Interface/MaterialSwipeToRefresh.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialSwitch.qml b/Library/MaterialUI/Interface/MaterialSwitch.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialTabbed.qml b/Library/MaterialUI/Interface/MaterialTabbed.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialTableView.qml b/Library/MaterialUI/Interface/MaterialTableView.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialTabs.qml b/Library/MaterialUI/Interface/MaterialTabs.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialTextField.qml b/Library/MaterialUI/Interface/MaterialTextField.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialTimePicker.qml b/Library/MaterialUI/Interface/MaterialTimePicker.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Interface/MaterialTreeView.qml b/Library/MaterialUI/Interface/MaterialTreeView.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/Material-Design-Iconic-Font.ttf b/Library/MaterialUI/Material-Design-Iconic-Font.ttf old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/MaterialUI.pri b/Library/MaterialUI/MaterialUI.pri old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/MaterialUI.qml b/Library/MaterialUI/MaterialUI.qml old mode 100755 new mode 100644 diff --git a/Library/MaterialUI/MaterialUI.qrc b/Library/MaterialUI/MaterialUI.qrc old mode 100755 new mode 100644 diff --git a/README.md b/README.md index f906146..32efb2b 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ https://github.com/188080501/JQTools/issues 文本类|大小写转换|已完成 文本类|密码随机器|已完成 文本类|URL转码|已完成 -文本类|JSON格式化|2016-06 +文本类|JSON格式化|已完成 || 计算类|HASH计算器|已完成 计算类|Unix时间戳转换|已完成 @@ -52,57 +52,54 @@ Qt相关|TS文件自动翻译器|2016-09 ## 功能介绍 -* PNG警告 - - 消除在Qt里,部分PNG图片在加载时控制台会报警告的问题,使用本工具可以将PNG图片进行转换,使用转换后的图片不会在报错。 - * UTF16转换 将字符串和UTF-16之间进行互转,例如将 "中文" 和 "\u4E2D\u6587" 互转。 -* HASH计算器 - - 计算常用的摘要值,如SHA1、MD5。 * RGB转16进制 可以从HEX颜色字符串(例如"#112233")分别提取RGB的值或者分别根据RGB值组成HEX颜色字符串。 - + * 大小写转换 文本转大写、文本转小写。 + +* 密码随机器 -* Unix时间戳转换 - - Unix时间戳与日期转换。 + 可以生成随机密码字符串,例如:"Hau-eqS-5EC-kWD" -* 代码行数统计 +* URL转码 - 可以统计文件中代码行数('\n'数量)。 + 将字符串和编码后的URL之间进行互转,例如将 "中文" 和 "%E4%B8%AD%E6%96%87" 互转。 + +* JSON格式化 -* 图标生成器 + 可以将JSON内容进行格式化,可选压缩或者不压缩模式。 + +* HASH计算器 - 根据已有的PNG图片,生成可以用于发布App的特定分辨率图片,例如OSX的 icon_128x128@2x.png 这样分辨率的图片。 + 计算常用的摘要值,如SHA1、MD5。 + +* Unix时间戳转换 + Unix时间戳与日期转换。 + * 屏幕二维码解析器 可以解析屏幕上的二维码,并显示结果字符串。 - -* 图标字体转PNG - - 将ttf字体或者svg字体,转换为PNG。 -* 密码随机器 +* 图标生成器 - 可以生成随机密码字符串,例如:"Hau-eqS-5EC-kWD" + 根据已有的PNG图片,生成可以用于发布App的特定分辨率图片,例如OSX的 icon_128x128@2x.png 这样分辨率的图片。 -* URL转码 +* 图标字体转PNG - 将字符串和编码后的URL之间进行互转,例如将 "中文" 和 "%E4%B8%AD%E6%96%87" 互转。 + 将ttf字体或者svg字体,转换为PNG。 -* Q_PROPERTY代码生成器 +* 代码行数统计 - 可以根据Q_PROPERTY的内容,生成代码。 + 可以统计文件中代码行数('\n'数量)。 * 屏幕拾色器 @@ -116,6 +113,14 @@ Qt相关|TS文件自动翻译器|2016-09 可以在局域网中远程控制其他电脑编译代码,并传回编译结果。 +* PNG警告 + + 消除在Qt里,部分PNG图片在加载时控制台会报警告的问题,使用本工具可以将PNG图片进行转换,使用转换后的图片不会在报错。 + +* Q_PROPERTY代码生成器 + + 可以根据Q_PROPERTY的内容,生成代码。 + * TS文件自动翻译器 可以使用百度翻译,自动翻译TS文件并保存翻译结果。 \ No newline at end of file diff --git a/cpp/main.cpp b/cpp/main.cpp index f66efb0..e8790cf 100755 --- a/cpp/main.cpp +++ b/cpp/main.cpp @@ -3,6 +3,7 @@ #include #include #include +#include // JQLibrary import #include "JQFoundation.h" @@ -17,19 +18,30 @@ // Project lib import #include "JQToolsManage.hpp" -// Models import +// Welcome import #include "Welcome.h" -#include "PngWarningRemover.h" + +// Text group import #include "Utf16Transform.h" #include "RgbStringTransform.h" -#include "UrlEncode.h" -#include "RandomPassword.h" #include "CaseTransform.h" +#include "RandomPassword.h" +#include "UrlEncode.h" +#include "JsonFormat.h" + +// Calculate group import #include "HashCalculate.h" #include "TimestampTransform.h" -#include "LinesStatistics.h" + +// Make group import #include "IconMaker.h" +// Tool group import +#include "LinesStatistics.h" + +// Qt group import +#include "PngWarningRemover.h" + void checkVersion(); int main(int argc, char *argv[]) @@ -38,22 +50,32 @@ int main(int argc, char *argv[]) checkVersion(); - if ( !JQFoundation::singleApplication("JQTools") ) + if ( !JQFoundation::singleApplication( "JQTools" ) ) { QMessageBox::warning( nullptr, QStringLiteral( "\u542F\u52A8\u5931\u8D25" ), QStringLiteral( "\u7A0B\u5E8F\u5DF2\u7ECF\u542F\u52A8" ) ); return -1; } + // Welcome initializa WELCOME_INITIALIZA + + // Text group initializa PNGWARNINGREMOVER_INITIALIZA UTF16TRANSFORM_INITIALIZA RGBSTRINGTRANSFORM_INITIALIZA - URLENCODE_INITIALIZA - RANDOMPASSWORD_INITIALIZA CASETRANSFORM_INITIALIZA + RANDOMPASSWORD_INITIALIZA + URLENCODE_INITIALIZA + JSONFORMAT_INITIALIZA + + // Calculate group initializa HASHCALCULATE_INITIALIZA TTIMESTAMPTRANSFORM_INITIALIZA + + // Tool group initializa LINESSTATISTICS_INITIALIZA + + // Qt group initializa ICONMAKER_INITIALIZA QQmlApplicationEngine engine; diff --git a/qml/main.qml b/qml/main.qml index 1f8c782..fb71779 100755 --- a/qml/main.qml +++ b/qml/main.qml @@ -3,11 +3,6 @@ import QtQuick.Controls 1.4 import QtGraphicalEffects 1.0 import "qrc:/MaterialUI/" import "qrc:/MaterialUI/Interface/" -import "qrc:/Welcome/" -import "qrc:/PngWarningRemover/" -import "qrc:/Utf16Transform/" -import "qrc:/HashCalculate/" -import "qrc:/IconMaker/" ApplicationWindow { id: applicationWindow @@ -36,7 +31,8 @@ ApplicationWindow { { bookmarkName: "RGB转16进制", titleName: "RGB转16进制", qrcLocation: "qrc:/RgbStringTransform/RgbStringTransform.qml" }, { bookmarkName: "大小写转换", titleName: "大小写转换", qrcLocation: "qrc:/CaseTransform/CaseTransform.qml" }, { bookmarkName: "密码随机器", titleName: "密码随机器", qrcLocation: "qrc:/RandomPassword/RandomPassword.qml" }, - { bookmarkName: "URL转码", titleName: "URL转码", qrcLocation: "qrc:/UrlEncode/UrlEncode.qml" } + { bookmarkName: "URL转码", titleName: "URL转码", qrcLocation: "qrc:/UrlEncode/UrlEncode.qml" }, + { bookmarkName: "JSON格式化", titleName: "JSON格式化", qrcLocation: "qrc:/JsonFormat/JsonFormat.qml" } ] }, {