757 |
758 |
758 return true; |
759 return true; |
759 } |
760 } |
760 |
761 |
761 /*! |
762 /*! |
762 Sets the database blocked or unblocked. |
763 |
763 */ |
764 */ |
764 void HsDatabase::setDataBaseBlocked(bool blocked) |
765 bool HsDatabase::generalConfiguration(HsGeneralConfiguration &data) |
765 { |
766 { |
766 mBlocked = blocked; |
767 if (!checkConnection()) { |
767 } |
768 return false; |
768 |
769 } |
769 /*! |
770 |
770 Returns is the database blocked. |
771 QSqlQuery query(QSqlDatabase::database(mConnectionName)); |
771 Return value true if blocked. |
772 |
772 */ |
773 QString statement = |
773 bool HsDatabase::getDataBaseBlocked() |
774 "SELECT bounceEffect, tapAndHoldDistance, widgetTapAndHoldTimeout, sceneTapAndHoldTimeout, " |
774 { |
775 "pageChangeZoneWidth, " |
775 return mBlocked; |
776 "pageIndicatorSpacing, pageChangeAnimationDuration, pageChangeZoneAnimationDuration, " |
|
777 "pageChangeZoneReverseAnimationDuration, " |
|
778 "pageRemovedAnimationDuration, newPageAddedAnimationDuration, widgetDragEffectDuration, " |
|
779 "widgetDropEffectDuration, boundaryFeedbackEffectDistance " |
|
780 "FROM GeneralConfiguration"; |
|
781 |
|
782 if (query.prepare(statement) && query.exec() && query.next()) { |
|
783 data.bounceEffect = query.value(0).toInt(); |
|
784 data.tapAndHoldDistance = query.value(1).toInt(); |
|
785 data.widgetTapAndHoldTimeout = query.value(2).toInt(); |
|
786 data.sceneTapAndHoldTimeout = query.value(3).toInt(); |
|
787 data.pageChangeZoneWidth = query.value(4).toInt(); |
|
788 data.pageIndicatorSpacing = query.value(5).toInt(); |
|
789 data.pageChangeAnimationDuration = query.value(6).toInt(); |
|
790 data.pageChangeZoneAnimationDuration = query.value(7).toInt(); |
|
791 data.pageChangeZoneReverseAnimationDuration = query.value(8).toInt(); |
|
792 data.pageRemovedAnimationDuration = query.value(9).toInt(); |
|
793 data.newPageAddedAnimationDuration = query.value(10).toInt(); |
|
794 data.widgetDragEffectDuration = query.value(11).toInt(); |
|
795 data.widgetDropEffectDuration = query.value(12).toInt(); |
|
796 data.boundaryFeedbackEffectDistance = query.value(13).toInt(); |
|
797 return true; |
|
798 } |
|
799 |
|
800 return false; |
|
801 } |
|
802 |
|
803 /*! |
|
804 |
|
805 */ |
|
806 bool HsDatabase::feedbackConfiguration(HsFeedbackConfiguration &data) |
|
807 { |
|
808 if (!checkConnection()) { |
|
809 return false; |
|
810 } |
|
811 |
|
812 QSqlQuery query(QSqlDatabase::database(mConnectionName)); |
|
813 |
|
814 QString statement = |
|
815 "SELECT pageChangeFeedbackType, widgetPickFeedbackType, widgetDropFeedbackType, " |
|
816 "widgetRepositionFeedbackType, widgetOverTrashbinFeedbackType, widgetDropToTrashbinFeedbackType, " |
|
817 "shortcutWidgetTapFeedbackType, widgetMoveBlockedFeedbackType, clockWidgetTapFeedbackType, " |
|
818 "widgetSnappingFeedbackType " |
|
819 "FROM FeedbackConfiguration"; |
|
820 |
|
821 if (query.prepare(statement) && query.exec() && query.next()) { |
|
822 data.pageChangeFeedbackType = data.feedbackFromString(query.value(0).toString()); |
|
823 data.widgetPickFeedbackType = data.feedbackFromString(query.value(1).toString()); |
|
824 data.widgetDropFeedbackType = data.feedbackFromString(query.value(2).toString()); |
|
825 data.widgetRepositionFeedbackType = data.feedbackFromString(query.value(3).toString()); |
|
826 data.widgetOverTrashbinFeedbackType = data.feedbackFromString(query.value(4).toString()); |
|
827 data.widgetDropToTrashbinFeedbackType = data.feedbackFromString(query.value(5).toString()); |
|
828 data.shortcutWidgetTapFeedbackType = data.feedbackFromString(query.value(6).toString()); |
|
829 data.widgetMoveBlockedFeedbackType = data.feedbackFromString(query.value(7).toString()); |
|
830 data.clockWidgetTapFeedbackType = data.feedbackFromString(query.value(8).toString()); |
|
831 data.widgetSnappingFeedbackType = data.feedbackFromString(query.value(9).toString()); |
|
832 return true; |
|
833 } |
|
834 |
|
835 return false; |
|
836 } |
|
837 |
|
838 bool HsDatabase::snapConfiguration(HsSnapConfiguration &data) |
|
839 { |
|
840 if (!checkConnection()) { |
|
841 return false; |
|
842 } |
|
843 |
|
844 QSqlQuery query(QSqlDatabase::database(mConnectionName)); |
|
845 |
|
846 QString statement = |
|
847 "SELECT snappingEnabled, snapForce, snapGap, borderGap, timeout " |
|
848 "FROM SnapConfiguration"; |
|
849 |
|
850 if (query.prepare(statement) && query.exec() && query.next()) { |
|
851 data.snappingEnabled = false; |
|
852 if (query.value(0).toInt() == 1) { |
|
853 data.snappingEnabled = true; |
|
854 } |
|
855 data.snapForce = query.value(1).toReal(); |
|
856 data.snapGap = query.value(2).toReal(); |
|
857 data.borderGap = query.value(3).toReal(); |
|
858 data.timeout = query.value(4).toInt(); |
|
859 return true; |
|
860 } |
|
861 return false; |
776 } |
862 } |
777 |
863 |
778 /*! |
864 /*! |
779 Sets the database instance. The existing instance |
865 Sets the database instance. The existing instance |
780 will be deleted. |
866 will be deleted. |