Merge branch 'master' of github.com:Sankore/Sankore-3.1

preferencesAboutTextFull
ivan.ilyin 14 years ago
commit 8c98bb64b8
  1. 177
      Sankore 3.1.iss
  2. 15
      Sankore_3.1.pro
  3. 190
      resources/forms/preferences.ui
  4. 2627
      resources/i18n/sankore_ar.ts
  5. BIN
      resources/images/toolPalette/triangleTool.png
  6. 143
      src/adaptors/publishing/UBDocumentPublisher.cpp
  7. 8
      src/adaptors/publishing/UBDocumentPublisher.h
  8. 20
      src/api/UBWidgetUniboardAPI.cpp
  9. 3
      src/api/UBWidgetUniboardAPI.h
  10. 17
      src/core/UBPreferencesController.cpp
  11. 2
      src/core/UBPreferencesController.h
  12. 22
      src/core/UBSettings.cpp
  13. 8
      src/core/UBSettings.h
  14. 2
      src/domain/UBGraphicsWidgetItem.cpp
  15. 2
      src/domain/UBW3CWidget.cpp
  16. 2
      src/gui/UBToolWidget.cpp
  17. 3
      src/pdf/XPDFRenderer.cpp
  18. 468
      src/tools/UBGraphicsTriangle.cpp
  19. 21
      src/tools/UBGraphicsTriangle.h

@ -1,89 +1,88 @@
; Script generated by the Inno Setup Script Wizard. ; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[Setup] [Setup]
; NOTE: The value of AppId uniquely identifies this application. ; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications. ; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{E63D17F8-D9DA-479D-B9B5-0D101A03703B} AppId={{E63D17F8-D9DA-479D-B9B5-0D101A03703B}
AppName=Sankore 3.1 AppName=Sankore 3.1
AppVerName=Sankore 3.1 AppVerName=Sankore 3.1
AppPublisher=Mnemis AppPublisher=Mnemis
AppPublisherURL=http://www.getuniboard.com AppPublisherURL=http://www.getuniboard.com
AppSupportURL=http://support.getuniboard.com AppSupportURL=http://support.getuniboard.com
AppUpdatesURL=http://www.getuniboard.com AppUpdatesURL=http://www.getuniboard.com
DefaultDirName={pf}\Sankore 3.1 DefaultDirName={pf}\Sankore 3.1
DefaultGroupName=Sankore 3.1 DefaultGroupName=Sankore 3.1
OutputDir=.\install\win32\ OutputDir=.\install\win32\
OutputBaseFilename=Sankore 3.1 setup OutputBaseFilename=Sankore 3.1 setup
SetupIconFile=.\resources\win\uniboard.ico SetupIconFile=.\resources\win\uniboard.ico
Compression=lzma Compression=lzma
SolidCompression=yes SolidCompression=yes
[Languages] [Languages]
Name: "english"; MessagesFile: "compiler:Default.isl" Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks] [Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[InstallDelete] [InstallDelete]
Type: files ; Name: "{app}\Sankore 3.1.pdb" Type: files ; Name: "{app}\Sankore 3.1.pdb"
Type: filesandordirs ; Name: "{app}\library" Type: filesandordirs ; Name: "{app}\library"
Type: filesandordirs ; Name: "{app}\Microsoft.VC90.CRT" Type: filesandordirs ; Name: "{app}\Microsoft.VC90.CRT"
Type: filesandordirs ; Name: "{app}\plugins" Type: filesandordirs ; Name: "{app}\plugins"
Type: filesandordirs ; Name: "{app}\i18n" Type: filesandordirs ; Name: "{app}\i18n"
Type: files ; Name: "{app}\*.dll" Type: files ; Name: "{app}\*.dll"
[Files] [Files]
Source: ".\build\win32\release\product\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs Source: ".\build\win32\release\product\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\runtime\windows\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Source: ".\runtime\windows\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
Source: ".\resources\win\plugins\*"; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs Source: ".\resources\win\plugins\*"; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files ; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons] [Icons]
Name: "{group}\Sankore 3.1"; Filename: "{app}\Sankore 3.1.exe" Name: "{group}\Sankore 3.1"; Filename: "{app}\Sankore 3.1.exe"
;Name: "{group}\{cm:ProgramOnTheWeb,Sankore 3.1}"; Filename: "http://www.getuniboard.com/" ;Name: "{group}\{cm:ProgramOnTheWeb,Sankore 3.1}"; Filename: "http://www.getuniboard.com/"
Name: "{group}\{cm:UninstallProgram,Sankore 3.1}"; Filename: "{uninstallexe}" Name: "{group}\{cm:UninstallProgram,Sankore 3.1}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\Sankore 3.1"; Filename: "{app}\Sankore 3.1.exe"; Tasks: desktopicon Name: "{commondesktop}\Sankore 3.1"; Filename: "{app}\Sankore 3.1.exe"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\Sankore 3.1"; Filename: "{app}\Sankore 3.1.exe"; Tasks: quicklaunchicon Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\Sankore 3.1"; Filename: "{app}\Sankore 3.1.exe"; Tasks: quicklaunchicon
Name: "{group}\Printing Preferences"; Filename: "{app}\properties.exe"; WorkingDir: {app} Name: "{group}\Printing Preferences"; Filename: "{app}\properties.exe"; WorkingDir: {app}
[Registry] [Registry]
Root: HKCR; Subkey: ".ubz"; ValueType: string; ValueName: ""; ValueData: "SankoreFile"; Flags: uninsdeletevalue Root: HKCR; Subkey: ".ubz"; ValueType: string; ValueName: ""; ValueData: "SankoreFile"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "SankoreFile"; ValueType: string; ValueName: ""; ValueData: "Sankore 3.1 document"; Flags: uninsdeletekey Root: HKCR; Subkey: "SankoreFile"; ValueType: string; ValueName: ""; ValueData: "Sankore 3.1 document"; Flags: uninsdeletekey
Root: HKCR; Subkey: "SankoreFile\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\Sankore 3.1.exe,1" Root: HKCR; Subkey: "SankoreFile\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\Sankore 3.1.exe,1"
Root: HKCR; Subkey: "SankoreFile\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\Sankore 3.1.exe"" ""%1""" Root: HKCR; Subkey: "SankoreFile\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\Sankore 3.1.exe"" ""%1"""
Root: HKLM; Subkey: "SOFTWARE\Sankore 3.1"; ValueType: string; ValueName: "Client application"; ValueData: "{app}\Sankore 3.1.exe"; Flags: uninsdeletevalue; Check: isProcessorNotX64 Root: HKLM; Subkey: "SOFTWARE\Sankore 3.1"; ValueType: string; ValueName: "Client application"; ValueData: "{app}\Sankore 3.1.exe"; Flags: uninsdeletevalue; Check: isProcessorNotX64
Root: HKLM; Subkey: "SOFTWARE\Sankore 3.1"; ValueType: dword; ValueName: "Transfer mode"; ValueData: "0"; Flags: uninsdeletevalue; Check: isProcessorNotX64 Root: HKLM; Subkey: "SOFTWARE\Sankore 3.1"; ValueType: dword; ValueName: "Transfer mode"; ValueData: "0"; Flags: uninsdeletevalue; Check: isProcessorNotX64
Root: HKLM; Subkey: "SOFTWARE\Sankore 3.1"; ValueType: dword; ValueName: "EMF: Hide page"; ValueData: "1"; Flags: uninsdeletevalue; Check: isProcessorNotX64 Root: HKLM; Subkey: "SOFTWARE\Sankore 3.1"; ValueType: dword; ValueName: "EMF: Hide page"; ValueData: "1"; Flags: uninsdeletevalue; Check: isProcessorNotX64
Root: HKLM; Subkey: "SOFTWARE\Sankore 3.1\Defaults"; ValueType: dword; ValueName: "PDF: Enabled"; ValueData: "1"; Flags: uninsdeletevalue; Check: isProcessorNotX64 Root: HKLM; Subkey: "SOFTWARE\Sankore 3.1\Defaults"; ValueType: dword; ValueName: "PDF: Enabled"; ValueData: "1"; Flags: uninsdeletevalue; Check: isProcessorNotX64
Root: HKLM64; Subkey: "SOFTWARE\Sankore 3.1"; ValueType: string; ValueName: "Client application"; ValueData: "{app}\Sankore 3.1.exe"; Flags: uninsdeletevalue; Check: isProcessorX64 Root: HKLM64; Subkey: "SOFTWARE\Sankore 3.1"; ValueType: string; ValueName: "Client application"; ValueData: "{app}\Sankore 3.1.exe"; Flags: uninsdeletevalue; Check: isProcessorX64
Root: HKLM64; Subkey: "SOFTWARE\Sankore 3.1"; ValueType: dword; ValueName: "Transfer mode"; ValueData: "0"; Flags: uninsdeletevalue; Check: isProcessorX64 Root: HKLM64; Subkey: "SOFTWARE\Sankore 3.1"; ValueType: dword; ValueName: "Transfer mode"; ValueData: "0"; Flags: uninsdeletevalue; Check: isProcessorX64
Root: HKLM64; Subkey: "SOFTWARE\Sankore 3.1"; ValueType: dword; ValueName: "EMF: Hide page"; ValueData: "1"; Flags: uninsdeletevalue; Check: isProcessorX64 Root: HKLM64; Subkey: "SOFTWARE\Sankore 3.1"; ValueType: dword; ValueName: "EMF: Hide page"; ValueData: "1"; Flags: uninsdeletevalue; Check: isProcessorX64
Root: HKLM64; Subkey: "SOFTWARE\Sankore 3.1\Defaults"; ValueType: dword; ValueName: "PDF: Enabled"; ValueData: "1"; Flags: uninsdeletevalue; Check: isProcessorX64 Root: HKLM64; Subkey: "SOFTWARE\Sankore 3.1\Defaults"; ValueType: dword; ValueName: "PDF: Enabled"; ValueData: "1"; Flags: uninsdeletevalue; Check: isProcessorX64
[Run] [Run]
Filename: "{app}\Sankore 3.1.exe"; Description: "{cm:LaunchProgram,Sankore 3.1}"; Flags: nowait postinstall Filename: "{app}\Sankore 3.1.exe"; Description: "{cm:LaunchProgram,Sankore 3.1}"; Flags: nowait postinstall
[UninstallDelete] [UninstallDelete]
; cleanup and delete whole installation directory ; cleanup and delete whole installation directory
Name: {app}; Type: filesandordirs Name: {app}; Type: filesandordirs
[Code] [Code]
function isProcessorX64: Boolean; function isProcessorX64: Boolean;
begin begin
Result := (ProcessorArchitecture = paX64); Result := (ProcessorArchitecture = paX64);
end; end;
function isProcessorNotX64: Boolean; function isProcessorNotX64: Boolean;
begin begin
Result := not isProcessorX64; Result := not isProcessorX64;
end; end;

@ -7,9 +7,9 @@ CONFIG += debug_and_release \
no_include_pwd no_include_pwd
VERSION_MAJ = 1 VERSION_MAJ = 1
VERSION_MIN = 00 VERSION_MIN = 10
VERSION_TYPE = r # a = alpha, b = beta, r = release, other => error VERSION_TYPE = b # a = alpha, b = beta, r = release, other => error
VERSION_PATCH = 00 VERSION_PATCH = 01
VERSION = "$${VERSION_MAJ}.$${VERSION_MIN}.$${VERSION_TYPE}.$${VERSION_PATCH}" VERSION = "$${VERSION_MAJ}.$${VERSION_MIN}.$${VERSION_TYPE}.$${VERSION_PATCH}"
VERSION = $$replace(VERSION, "\\.r", "") VERSION = $$replace(VERSION, "\\.r", "")
@ -269,6 +269,12 @@ macx {
TRANSLATION_ro.path = "$$RESOURCES_DIR/ro.lproj" TRANSLATION_ro.path = "$$RESOURCES_DIR/ro.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_ro QMAKE_BUNDLE_DATA += TRANSLATION_ro
} }
exists(resources/i18n/sankore_ar.qm) {
TRANSLATION_ar.files = resources/i18n/sankore_ar.qm \
resources/i18n/Localizable.strings
TRANSLATION_ar.path = "$$RESOURCES_DIR/ar.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_ar
}
QMAKE_BUNDLE_DATA += UB_ETC \ QMAKE_BUNDLE_DATA += UB_ETC \
UB_LIBRARY \ UB_LIBRARY \
@ -338,7 +344,8 @@ TRANSLATIONS = resources/i18n/sankore_en.ts \
resources/i18n/sankore_ja.ts \ resources/i18n/sankore_ja.ts \
resources/i18n/sankore_ko.ts \ resources/i18n/sankore_ko.ts \
resources/i18n/sankore_zh.ts \ resources/i18n/sankore_zh.ts \
resources/i18n/sankore_ro.ts resources/i18n/sankore_ro.ts \
resources/i18n/sankore_ar.ts
INSTALLS = UB_ETC \ INSTALLS = UB_ETC \
UB_I18N \ UB_I18N \

@ -21,10 +21,59 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="defaultSettingsButton">
<property name="text">
<string>Default Settings</string>
</property>
</widget>
</item>
<item>
<spacer name="bottomHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="closeButton">
<property name="text">
<string>Close</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QTabWidget" name="mainTabWidget"> <widget class="QTabWidget" name="mainTabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>4</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="displayTab"> <widget class="QWidget" name="displayTab">
<attribute name="title"> <attribute name="title">
@ -564,7 +613,7 @@
<item> <item>
<widget class="QTabWidget" name="openSslWidget"> <widget class="QTabWidget" name="openSslWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>4</number> <number>3</number>
</property> </property>
<widget class="QWidget" name="openSSlTab"> <widget class="QWidget" name="openSSlTab">
<attribute name="title"> <attribute name="title">
@ -577,7 +626,7 @@
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt; color:#1a1a1a;&quot;&gt;The OpenSSL toolkit stays under a dual license, i.e. both the conditions of the OpenSSL License and the original SSLeay license apply to the toolkit.&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt; color:#1a1a1a;&quot;&gt;The OpenSSL toolkit stays under a dual license, i.e. both the conditions of the OpenSSL License and the original SSLeay license apply to the toolkit.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt; color:#1a1a1a;&quot;&gt;See below for the actual license texts. Actually both licenses are BSD-style Open Source licenses. In case of any license issues related to OpenSSL please contact &lt;/span&gt;&lt;a href=&quot;mailto:openssl-core@openssl.org&quot;&gt;&lt;span style=&quot; font-size:9pt; text-decoration: underline; color:#0000ff;&quot;&gt;openssl-core@openssl.org&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-size:9pt; color:#1a1a1a;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt; &lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt; color:#1a1a1a;&quot;&gt;See below for the actual license texts. Actually both licenses are BSD-style Open Source licenses. In case of any license issues related to OpenSSL please contact &lt;/span&gt;&lt;a href=&quot;mailto:openssl-core@openssl.org&quot;&gt;&lt;span style=&quot; font-size:9pt; text-decoration: underline; color:#0000ff;&quot;&gt;openssl-core@openssl.org&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-size:9pt; color:#1a1a1a;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt; &lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
@ -596,7 +645,7 @@ p, li { white-space: pre-wrap; }
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt; color:#1a1a1a;&quot;&gt;Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot; font-size:9pt; color:#1a1a1a;&quot;&gt; This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.&lt;/span&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot; font-size:9pt; color:#1a1a1a;&quot;&gt; Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:&lt;/span&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot; font-size:9pt; color:#1a1a1a;&quot;&gt; 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.&lt;/span&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot; font-size:9pt; color:#1a1a1a;&quot;&gt; 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.&lt;/span&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot; font-size:9pt; color:#1a1a1a;&quot;&gt; 3. This notice may not be removed or altered from any source distribution.&lt;/span&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt; &lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> &lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt; color:#1a1a1a;&quot;&gt;Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot; font-size:9pt; color:#1a1a1a;&quot;&gt; This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.&lt;/span&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot; font-size:9pt; color:#1a1a1a;&quot;&gt; Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:&lt;/span&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot; font-size:9pt; color:#1a1a1a;&quot;&gt; 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.&lt;/span&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot; font-size:9pt; color:#1a1a1a;&quot;&gt; 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.&lt;/span&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot; font-size:9pt; color:#1a1a1a;&quot;&gt; 3. This notice may not be removed or altered from any source distribution.&lt;/span&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt; &lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
@ -614,7 +663,7 @@ p, li { white-space: pre-wrap; }
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt; color:#000000;&quot;&gt;Xpdf is licensed under the GNU General Public License (GPL), version 2.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> &lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt; color:#000000;&quot;&gt;Xpdf is licensed under the GNU General Public License (GPL), version 2.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
@ -632,7 +681,7 @@ p, li { white-space: pre-wrap; }
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;GNU Library or Lesser General Public License (LGPL), zlib/libpng License&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> &lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;GNU Library or Lesser General Public License (LGPL), zlib/libpng License&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
@ -650,7 +699,7 @@ p, li { white-space: pre-wrap; }
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;SANKORE3.1 is free software: you can redistribute it and/or modify it under the terms of the Lesser GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. You can find the source code of this software at &amp;lt;https://adullact.net/projects/sankore/&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;SANKORE3.1 is free software: you can redistribute it and/or modify it under the terms of the Lesser GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. You can find the source code of this software at &amp;lt;https://adullact.net/projects/sankore/&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;justify&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:9pt;&quot;&gt;&lt;/p&gt; &lt;p align=&quot;justify&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:9pt;&quot;&gt;&lt;/p&gt;
&lt;p align=&quot;justify&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:9pt;&quot;&gt;&lt;/p&gt; &lt;p align=&quot;justify&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:9pt;&quot;&gt;&lt;/p&gt;
@ -845,7 +894,7 @@ p, li { white-space: pre-wrap; }
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt; color:#1a1a1a;&quot;&gt;Sankoré 3.1 version , Copyright (C) 2010 Sankoré 3.1 comes with ABSOLUTELY NO WARRANTY.&lt;/span&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot; font-size:9pt; color:#35382a;&quot;&gt; &lt;/span&gt;&lt;/p&gt; &lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt; color:#1a1a1a;&quot;&gt;Sankoré 3.1 version , Copyright (C) 2010 Sankoré 3.1 comes with ABSOLUTELY NO WARRANTY.&lt;/span&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot; font-size:9pt; color:#35382a;&quot;&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt; color:#35382a;&quot;&gt;This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.&lt;/span&gt;&lt;/p&gt; &lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt; color:#35382a;&quot;&gt;This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;justify&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:9pt; color:#35382a;&quot;&gt;&lt;/p&gt; &lt;p align=&quot;justify&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:9pt; color:#35382a;&quot;&gt;&lt;/p&gt;
@ -861,8 +910,8 @@ p, li { white-space: pre-wrap; }
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;justify&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt; &lt;p align=&quot;justify&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;&lt;/p&gt;
&lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt; color:#3c3c3c;&quot;&gt;GIPENA&lt;/span&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot; font-size:9pt; color:#3c3c3c;&quot;&gt;Délégation Interministérielle à l'Education Numérique en Afrique&lt;/span&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot; font-size:9pt; color:#3c3c3c;&quot;&gt;20 Avenue Ségur Paris 75007&lt;/span&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot; font-size:9pt; color:#3c3c3c;&quot;&gt;Téléphone : 01 43 17 68 08&lt;/span&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot; font-size:9pt; color:#3c3c3c;&quot;&gt;email: &lt;/span&gt;&lt;a href=&quot;mailto:contact@sankore.org&quot;&gt;&lt;span style=&quot; font-size:9pt; text-decoration: underline; color:#0000ff;&quot;&gt;contact@sankore.org&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt; &lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> &lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:9pt; color:#3c3c3c;&quot;&gt;GIPENA&lt;/span&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot; font-size:9pt; color:#3c3c3c;&quot;&gt;Délégation Interministérielle à l'Education Numérique en Afrique&lt;/span&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot; font-size:9pt; color:#3c3c3c;&quot;&gt;20 Avenue Ségur Paris 75007&lt;/span&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot; font-size:9pt; color:#3c3c3c;&quot;&gt;Téléphone : 01 43 17 68 08&lt;/span&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot; font-size:9pt; color:#3c3c3c;&quot;&gt;email: &lt;/span&gt;&lt;a href=&quot;mailto:contact@sankore.org&quot;&gt;&lt;span style=&quot; font-size:9pt; text-decoration: underline; color:#0000ff;&quot;&gt;contact@sankore.org&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt; &lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
@ -907,55 +956,78 @@ p, li { white-space: pre-wrap; }
</item> </item>
</layout> </layout>
</widget> </widget>
</widget> <widget class="QWidget" name="tab">
</item> <attribute name="title">
<item row="3" column="0"> <string>Network</string>
<widget class="QFrame" name="frame"> </attribute>
<property name="frameShape"> <layout class="QGridLayout" name="gridLayout_6">
<enum>QFrame::NoFrame</enum> <item row="0" column="0">
</property> <widget class="QGroupBox" name="CommunityGroupBox">
<property name="frameShadow"> <property name="sizePolicy">
<enum>QFrame::Raised</enum> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
</property> <horstretch>0</horstretch>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <verstretch>0</verstretch>
<property name="margin"> </sizepolicy>
<number>0</number> </property>
</property> <property name="title">
<item> <string>Community</string>
<widget class="QPushButton" name="defaultSettingsButton"> </property>
<property name="text"> <layout class="QGridLayout" name="gridLayout_18">
<string>Default Settings</string> <item row="2" column="0">
</property> <layout class="QGridLayout" name="gridLayout_20">
</widget> <item row="0" column="0">
</item> <widget class="QLabel" name="label_4">
<item> <property name="text">
<spacer name="bottomHSpacer"> <string>User/Pass:</string>
<property name="orientation"> </property>
<enum>Qt::Horizontal</enum> </widget>
</property> </item>
<property name="sizeHint" stdset="0"> <item row="0" column="1">
<size> <widget class="QWidget" name="widget_3" native="true">
<width>40</width> <layout class="QHBoxLayout" name="horizontalLayout_11">
<height>20</height> <property name="spacing">
</size> <number>5</number>
</property> </property>
</spacer> <property name="margin">
</item> <number>0</number>
<item> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <item>
<item> <widget class="QLineEdit" name="Username_textBox">
<widget class="QPushButton" name="closeButton"> <property name="echoMode">
<property name="text"> <enum>QLineEdit::Normal</enum>
<string>Close</string> </property>
</property> </widget>
<property name="default"> </item>
<bool>true</bool> <item>
</property> <widget class="QLineEdit" name="Password_textEdit">
</widget> <property name="echoMode">
</item> <enum>QLineEdit::Password</enum>
</layout> </property>
</item> </widget>
</layout> </item>
</layout>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget> </widget>
</item> </item>
</layout> </layout>

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

@ -1,4 +1,6 @@
#include "UBDocumentPublisher.h" #include <QFileInfo>
#include "UBDocumentPublisher.h"
#include "frameworks/UBPlatformUtils.h" #include "frameworks/UBPlatformUtils.h"
#include "frameworks/UBFileSystemUtils.h" #include "frameworks/UBFileSystemUtils.h"
@ -36,6 +38,7 @@ UBDocumentPublisher::UBDocumentPublisher(UBDocumentProxy* pDocument, QObject *pa
, mPublishingDocument(0) , mPublishingDocument(0)
, mUsername("") , mUsername("")
, mPassword("") , mPassword("")
, bLoginCookieSet(false)
{ {
mpWebView = new QWebView(0); mpWebView = new QWebView(0);
UBApplication::mainWindow->addSankoreWebDocumentWidget(mpWebView); UBApplication::mainWindow->addSankoreWebDocumentWidget(mpWebView);
@ -44,6 +47,7 @@ UBDocumentPublisher::UBDocumentPublisher(UBDocumentProxy* pDocument, QObject *pa
connect(mpWebView, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool))); connect(mpWebView, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool)));
connect(mpWebView, SIGNAL(linkClicked(QUrl)), this, SLOT(onLinkClicked(QUrl))); connect(mpWebView, SIGNAL(linkClicked(QUrl)), this, SLOT(onLinkClicked(QUrl)));
connect(this, SIGNAL(loginDone()), this, SLOT(onLoginDone()));
init(); init();
@ -52,23 +56,68 @@ UBDocumentPublisher::UBDocumentPublisher(UBDocumentProxy* pDocument, QObject *pa
UBDocumentPublisher::~UBDocumentPublisher() UBDocumentPublisher::~UBDocumentPublisher()
{ {
delete mpWebView; //delete mpWebView;
delete mPublishingDocument; //delete mPublishingDocument;
} }
void UBDocumentPublisher::publish() void UBDocumentPublisher::publish()
{ {
//check that the username and password are stored on preferences //check that the username and password are stored on preferences
mUsername = "Admin"; UBSettings* settings = UBSettings::settings();
mPassword = "admin";
mUsername = settings->communityUsername();
mPassword = settings->communityPassword();
buildUbwFile(); buildUbwFile();
UBApplication::showMessage(tr("Uploading Sankore File on Web.")); UBApplication::showMessage(tr("Uploading Sankore File on Web."));
login(mUsername, mPassword);
//sendUbw();
}
void UBDocumentPublisher::onLoginDone()
{
sendUbw(); sendUbw();
}
void UBDocumentPublisher::login(QString username, QString password)
{
QString data,crlf;
QByteArray datatoSend;
// Create the request body
data="srid=&j_username=" +username +"&j_password=" +password +crlf+crlf;
datatoSend=data.toAscii(); // convert data string to byte array for request
// Create the request header
QString qsLoginURL = QString("http://sankore.devxwiki.com/xwiki/bin/loginsubmit/XWiki/XWikiLogin?xredirect=%0").arg(DOCPUBLICATION_URL);
QNetworkRequest request(QUrl(qsLoginURL.toAscii().constData()));
request.setRawHeader("Origin", "http://sankore.devxwiki.com");
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
request.setRawHeader("Accept", "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5");
request.setRawHeader("Referer", DOCPUBLICATION_URL);
request.setHeader(QNetworkRequest::ContentLengthHeader,datatoSend.size());
request.setRawHeader("Accept-Language", "en-US,*");
// Generate a session id
//mSessionID = getSessionID();
// Create the cookie
//QList<QNetworkCookie> cookiesList;
//QString qsCookieValue;
//qsCookieValue = mSessionID;
//qsCookieValue += "; language=en";
//QNetworkCookie cookie("JSESSIONID", qsCookieValue.toAscii().constData());
//cookiesList << cookie;
//request.setHeader(QNetworkRequest::CookieHeader, QVariant::fromValue(cookiesList));
// Send the request
mpNetworkMgr->post(request,datatoSend);
} }
void UBDocumentPublisher::buildUbwFile() void UBDocumentPublisher::buildUbwFile()
{ {
QDir d; QDir d;
@ -526,6 +575,9 @@ void UBDocumentPublisher::init()
mCrlf+=0x0a; mCrlf+=0x0a;
mpNetworkMgr = new QNetworkAccessManager(this); mpNetworkMgr = new QNetworkAccessManager(this);
//mpCache = new QNetworkDiskCache(this);
//mpCache->setCacheDirectory("cache");
//mpNetworkMgr->setCache(mpCache);
mpCookieJar = new QNetworkCookieJar(); mpCookieJar = new QNetworkCookieJar();
connect(mpNetworkMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(onFinished(QNetworkReply*))); connect(mpNetworkMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(onFinished(QNetworkReply*)));
@ -533,20 +585,19 @@ void UBDocumentPublisher::init()
void UBDocumentPublisher::onFinished(QNetworkReply *reply) void UBDocumentPublisher::onFinished(QNetworkReply *reply)
{ {
qDebug() << "[-[ Request finished! ]-]";
QByteArray response = reply->readAll(); QByteArray response = reply->readAll();
if (!bCookieSet) if (!bLoginCookieSet)
{ {
QList<QNetworkCookie> cookiesList;
QVariant cookieHeader = reply->rawHeader("Set-Cookie"); QVariant cookieHeader = reply->rawHeader("Set-Cookie");
qDebug() << cookieHeader.toString();
// First we concatenate all the Set-Cookie values (the packet can contains many of them) // First we concatenate all the Set-Cookie values (the packet can contains many of them)
QStringList qslCookie = cookieHeader.toString().split("\n"); QStringList qslCookie = cookieHeader.toString().split("\n");
QString qsCookieValue = qslCookie.at(0); QString qsCookieValue = qslCookie.at(0);
for (int i = 1; i < qslCookie.size(); i++) { for (int i = 1; i < qslCookie.size(); i++) {
qsCookieValue += "; " +qslCookie.at(i); qsCookieValue += "; " +qslCookie.at(i);
} }
qDebug() << "qsCookieValue " << qsCookieValue;
// Now we isolate every cookie value // Now we isolate every cookie value
QStringList qslCookieVals = qsCookieValue.split("; "); QStringList qslCookieVals = qsCookieValue.split("; ");
@ -554,32 +605,62 @@ void UBDocumentPublisher::onFinished(QNetworkReply *reply)
for (int i = 0; i < qslCookieVals.size(); i++) for (int i = 0; i < qslCookieVals.size(); i++)
{ {
QString cookieString = qslCookieVals.at(i); QString cookieString = qslCookieVals.at(i);
qDebug() << "qslCookieVals.at(i): " << cookieString.replace("\"", ""); //qDebug() << "qslCookieVals.at(i): " << cookieString.replace("\"", "");
QStringList qslCrntCookie = cookieString.split("="); QStringList qslCrntCookie = cookieString.split("=");
QNetworkCookie crntCookie; QNetworkCookie crntCookie;
if (qslCrntCookie.length() == 2) if (qslCrntCookie.length() == 2)
crntCookie = QNetworkCookie(qslCrntCookie.at(0).toAscii().constData(), qslCrntCookie.at(1).toAscii().constData()); {
QString qsValue = qslCrntCookie.at(1);
qsValue.remove("\"");
crntCookie = QNetworkCookie(qslCrntCookie.at(0).toAscii().constData(), qsValue.toAscii().constData());
}
else else
{
crntCookie = QNetworkCookie(qslCrntCookie.at(0).toAscii().constData()); crntCookie = QNetworkCookie(qslCrntCookie.at(0).toAscii().constData());
cookiesList << crntCookie; }
// HACK : keep only the same cookies as the XWiki website does.
if(crntCookie.name() == "JSESSIONID" ||
crntCookie.name() == "username" ||
crntCookie.name() == "password" ||
crntCookie.name() == "rememberme" ||
crntCookie.name() == "validation")
{
mCookies << crntCookie;
}
}
QNetworkCookie langCookie("language", "en");
mCookies << langCookie;
// DEBUG : Verify
for(int i = 0; i < mCookies.size(); i++)
{
qDebug() << mCookies.at(i).name() << "=" << mCookies.at(i).value();
} }
// Set the cookiejar : it set the cookies that will be sent with every packet. // Set the cookiejar : it set the cookies that will be sent with every packet.
qDebug() << reply->url().toString(); mpCookieJar->setCookiesFromUrl(mCookies, QUrl(DOCPUBLICATION_URL)/*reply->url()*/);
mpCookieJar->setCookiesFromUrl(cookiesList, reply->url());
mpNetworkMgr->setCookieJar(mpCookieJar);
bCookieSet = true;
}
if (response.isEmpty()){ mpNetworkMgr->setCookieJar(mpCookieJar);
bLoginCookieSet = true;
emit loginDone(); emit loginDone();
} }
else{ else
// Display the iframe {
mpWebView->setHtml(response, QUrl("http://sankore.devxwiki.com/xwiki/bin/view/Test/FileUpload")); if (!response.isEmpty()){
UBApplication::applicationController->showSankoreWebDocument(); // Display the iframe
mpWebView->setHtml(response, reply->url());
UBApplication::applicationController->showSankoreWebDocument();
}
else
{
// Redirect
QVariant locationHeader = reply->rawHeader("Location");
QNetworkRequest req(QUrl(locationHeader.toString()));
mpNetworkMgr->get(req);
qDebug() << mpWebView->url().toString();
}
} }
reply->deleteLater();
} }
void UBDocumentPublisher::sendUbw() void UBDocumentPublisher::sendUbw()
@ -589,6 +670,7 @@ void UBDocumentPublisher::sendUbw()
QFile f(mTmpZipFile); QFile f(mTmpZipFile);
if (f.open(QIODevice::ReadOnly)) if (f.open(QIODevice::ReadOnly))
{ {
QFileInfo fi(f);
QByteArray ba = f.readAll(); QByteArray ba = f.readAll();
QString boundary,data, multipartHeader; QString boundary,data, multipartHeader;
QByteArray datatoSend; QByteArray datatoSend;
@ -597,23 +679,19 @@ void UBDocumentPublisher::sendUbw()
multipartHeader = "multipart/form-data; boundary="+boundary; multipartHeader = "multipart/form-data; boundary="+boundary;
data="--"+boundary+mCrlf; data="--"+boundary+mCrlf;
data+="Content-Disposition: form-data; name=\"file\"; filename=\""+ f.fileName() +"\""+mCrlf; data+="Content-Disposition: form-data; name=\"file\"; filename=\""+ fi.fileName() +"\""+mCrlf;
data+="Content-Type: application/octet-stream"+mCrlf+mCrlf; data+="Content-Type: application/octet-stream"+mCrlf+mCrlf;
datatoSend=data.toAscii(); // convert data string to byte array for request datatoSend=data.toAscii(); // convert data string to byte array for request
datatoSend += ba; datatoSend += ba;
datatoSend += mCrlf.toAscii(); datatoSend += mCrlf;
datatoSend += QString("--%0--%1").arg(boundary).arg(mCrlf).toAscii(); datatoSend += QString("--%0--%1").arg(boundary).arg(mCrlf);
QNetworkRequest request(QUrl("http://sankore.devxwiki.com/xwiki/bin/view/Test/FileUpload")); QNetworkRequest request(QUrl(DOCPUBLICATION_URL));
request.setHeader(QNetworkRequest::ContentTypeHeader, multipartHeader); request.setHeader(QNetworkRequest::ContentTypeHeader, multipartHeader);
request.setHeader(QNetworkRequest::ContentLengthHeader,datatoSend.size()); request.setHeader(QNetworkRequest::ContentLengthHeader,datatoSend.size());
request.setRawHeader("Accept", "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"); request.setRawHeader("Accept", "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5");
request.setRawHeader("Accept-Language", "en-US,*"); request.setRawHeader("Accept-Language", "en-US,*");
request.setRawHeader("Referer", "http://sankore.devxwiki.com/xwiki/bin/view/Test/FileUpload"); request.setRawHeader("Referer", DOCPUBLICATION_URL);
request.setRawHeader("Origin", "http://sankore.devxwiki.com");
QString b64Auth = getBase64Of(QString("%0:%1").arg(mUsername).arg(mPassword));
request.setRawHeader("Authorization", QString("Basic %0").arg(b64Auth).toAscii().constData());
// Send the file // Send the file
mpNetworkMgr->post(request,datatoSend); mpNetworkMgr->post(request,datatoSend);
@ -640,7 +718,8 @@ void UBDocumentPublisher::onLoadFinished(bool result)
{ {
Q_UNUSED(result); Q_UNUSED(result);
// [Basic Auth] This line says: if the user click on a link, do not interpret it. // [Basic Auth] This line says: if the user click on a link, do not interpret it.
mpWebView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); //mpWebView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
mpWebView->page()->setNetworkAccessManager(mpNetworkMgr);
} }

@ -7,6 +7,9 @@
#include "ui_webPublishing.h" #include "ui_webPublishing.h"
#include "UBAbstractPublisher.h" #include "UBAbstractPublisher.h"
#define DOCPUBLICATION_URL "http://sankore.devxwiki.com/xwiki/bin/view/CreateResources/UniboardUpload"
#define XWIKI_ORIGIN_HEADER "http://sankore.devxwiki.com"
class UBDocumentProxy; class UBDocumentProxy;
class UBServerXMLHttpRequest; class UBServerXMLHttpRequest;
class UBGraphicsW3CWidgetItem; class UBGraphicsW3CWidgetItem;
@ -38,6 +41,7 @@ private slots:
void onFinished(QNetworkReply* reply); void onFinished(QNetworkReply* reply);
void onLinkClicked(const QUrl& url); void onLinkClicked(const QUrl& url);
void onLoadFinished(bool result); void onLoadFinished(bool result);
void onLoginDone();
private: private:
@ -55,10 +59,12 @@ private:
QString mUsername; QString mUsername;
QString mPassword; QString mPassword;
QString mCrlf; QString mCrlf;
bool bCookieSet; bool bLoginCookieSet;
void buildUbwFile(); void buildUbwFile();
void login(QString username, QString password);
QString mTmpZipFile; QString mTmpZipFile;
QList<QNetworkCookie> mCookies;
}; };
#endif // UBDOCUMENTPUBLISHER_H #endif // UBDOCUMENTPUBLISHER_H

@ -375,6 +375,26 @@ QString UBWidgetUniboardAPI::lang()
return lang; return lang;
} }
void UBWidgetUniboardAPI::returnStatus(const QString& method, const QString& status)
{
QString msg = QString(tr("%0 called (method=%1, status=%2)")).arg("returnStatus").arg(method).arg(status);
UBApplication::showMessage(msg);
}
void UBWidgetUniboardAPI::usedMethods(QStringList methods)
{
// TODO: Implement this method
foreach(QString method, methods)
{
}
}
void UBWidgetUniboardAPI::response(bool correct)
{
Q_UNUSED(correct);
// TODO: Implement this method
}
UBDocumentDatastoreAPI::UBDocumentDatastoreAPI(UBGraphicsW3CWidgetItem *graphicsWidget) UBDocumentDatastoreAPI::UBDocumentDatastoreAPI(UBGraphicsW3CWidgetItem *graphicsWidget)

@ -207,6 +207,9 @@ class UBWidgetUniboardAPI : public QObject
void addText(const QString& text, const qreal x, const qreal y, const int height = -1, const QString& font = "" void addText(const QString& text, const qreal x, const qreal y, const int height = -1, const QString& font = ""
, bool bold = false, bool italic = false); , bool bold = false, bool italic = false);
void returnStatus(const QString& method, const QString& status);
void usedMethods(QStringList methods);
void response(bool correct);
private: private:
QString uuid(); QString uuid();

@ -38,6 +38,8 @@ UBPreferencesController::UBPreferencesController(QWidget *parent)
mPreferencesWindow = new QDialog(parent, Qt::Dialog); mPreferencesWindow = new QDialog(parent, Qt::Dialog);
mPreferencesUI = new Ui::preferencesDialog(); // deleted in UBPreferencesController::destructor mPreferencesUI = new Ui::preferencesDialog(); // deleted in UBPreferencesController::destructor
mPreferencesUI->setupUi(mPreferencesWindow); mPreferencesUI->setupUi(mPreferencesWindow);
connect(mPreferencesUI->Username_textBox, SIGNAL(editingFinished()), this, SLOT(onCommunityUsernameChanged()));
connect(mPreferencesUI->Password_textEdit, SIGNAL(editingFinished()), this, SLOT(onCommunityPasswordChanged()));
wire(); wire();
} }
@ -160,6 +162,9 @@ void UBPreferencesController::init()
mPreferencesUI->verticalChoice->setChecked(settings->appToolBarOrientationVertical->get().toBool()); mPreferencesUI->verticalChoice->setChecked(settings->appToolBarOrientationVertical->get().toBool());
mPreferencesUI->horizontalChoice->setChecked(!settings->appToolBarOrientationVertical->get().toBool()); mPreferencesUI->horizontalChoice->setChecked(!settings->appToolBarOrientationVertical->get().toBool());
mPreferencesUI->Username_textBox->setText(settings->communityUsername());
mPreferencesUI->Password_textEdit->setText(settings->communityPassword());
// pen tab // pen tab
mPenProperties->fineSlider->setValue(settings->boardPenFineWidth->get().toDouble() * sSliderRatio); mPenProperties->fineSlider->setValue(settings->boardPenFineWidth->get().toDouble() * sSliderRatio);
mPenProperties->mediumSlider->setValue(settings->boardPenMediumWidth->get().toDouble() * sSliderRatio); mPenProperties->mediumSlider->setValue(settings->boardPenMediumWidth->get().toDouble() * sSliderRatio);
@ -176,6 +181,18 @@ void UBPreferencesController::init()
} }
void UBPreferencesController::onCommunityUsernameChanged()
{
UBSettings* settings = UBSettings::settings();
settings->setCommunityUsername(mPreferencesUI->Username_textBox->text());
}
void UBPreferencesController::onCommunityPasswordChanged()
{
UBSettings* settings = UBSettings::settings();
settings->setCommunityPassword(mPreferencesUI->Password_textEdit->text());
}
void UBPreferencesController::close() void UBPreferencesController::close()
{ {
//web //web

@ -55,6 +55,8 @@ class UBPreferencesController : public QObject
void toolbarPositionChanged(bool checked); void toolbarPositionChanged(bool checked);
void toolbarOrientationVertical(bool checked); void toolbarOrientationVertical(bool checked);
void toolbarOrientationHorizontal(bool checked); void toolbarOrientationHorizontal(bool checked);
void onCommunityUsernameChanged();
void onCommunityPasswordChanged();
private: private:

@ -313,6 +313,9 @@ void UBSettings::init()
uniboardWebAuthor = new UBSetting(this, "UniboardWeb", "Author", ""); uniboardWebAuthor = new UBSetting(this, "UniboardWeb", "Author", "");
uniboardWebGoogleMapApiKey = new UBSetting(this, "UniboardWeb", "GoogleMapAPIKey", "ABQIAAAAsWU4bIbaeCLinpZ30N_erRQEk562OPinwQkG9J-ZXUNAqYhJ5RT_z2EmpfVXiUg8c41BcsD_XM6P5g"); uniboardWebGoogleMapApiKey = new UBSetting(this, "UniboardWeb", "GoogleMapAPIKey", "ABQIAAAAsWU4bIbaeCLinpZ30N_erRQEk562OPinwQkG9J-ZXUNAqYhJ5RT_z2EmpfVXiUg8c41BcsD_XM6P5g");
communityUser = new UBSetting(this, "Community", "Username", "");
communityPsw = new UBSetting(this, "Community", "Password", "");
QStringList uris = UBToolsManager::manager()->allToolIDs(); QStringList uris = UBToolsManager::manager()->allToolIDs();
favoritesNativeToolUris = new UBSetting(this, "App", "FavoriteToolURIs", uris); favoritesNativeToolUris = new UBSetting(this, "App", "FavoriteToolURIs", uris);
@ -1292,3 +1295,22 @@ void UBSettings::setProxyPassword(const QString& password)
} }
QString UBSettings::communityUsername()
{
return communityUser->get().toString();
}
void UBSettings::setCommunityUsername(const QString &username)
{
communityUser->set(QVariant(username));
}
QString UBSettings::communityPassword()
{
return communityPsw->get().toString();
}
void UBSettings::setCommunityPassword(const QString &password)
{
communityPsw->set(QVariant(password));
}

@ -89,6 +89,11 @@ class UBSettings : public QObject
QString proxyPassword(); QString proxyPassword();
void setProxyPassword(const QString& password); void setProxyPassword(const QString& password);
QString communityUsername();
void setCommunityUsername(const QString& username);
QString communityPassword();
void setCommunityPassword(const QString& password);
void init(); void init();
static QString uniboardDataDirectory(); static QString uniboardDataDirectory();
@ -315,6 +320,9 @@ class UBSettings : public QObject
UBSetting* navigPaletteWidth; UBSetting* navigPaletteWidth;
UBSetting* libPaletteWidth; UBSetting* libPaletteWidth;
UBSetting* communityUser;
UBSetting* communityPsw;
/* /*
static int navigPaletteWidth; static int navigPaletteWidth;
static int libPaletteWidth; static int libPaletteWidth;

@ -36,7 +36,7 @@ void UBGraphicsWidgetItem::javaScriptWindowObjectCleared()
if(!mUniboardAPI) if(!mUniboardAPI)
mUniboardAPI = new UBWidgetUniboardAPI(scene(), this); mUniboardAPI = new UBWidgetUniboardAPI(scene(), this);
mWebKitWidget->page()->mainFrame()->addToJavaScriptWindowObject("uniboard", mUniboardAPI); mWebKitWidget->page()->mainFrame()->addToJavaScriptWindowObject("sankore", mUniboardAPI);
} }

@ -169,7 +169,7 @@ void UBW3CWidget::javaScriptWindowObjectCleared()
{ {
UBWidgetUniboardAPI *uniboardAPI = new UBWidgetUniboardAPI(UBApplication::boardController->activeScene(), 0); UBWidgetUniboardAPI *uniboardAPI = new UBWidgetUniboardAPI(UBApplication::boardController->activeScene(), 0);
page()->mainFrame()->addToJavaScriptWindowObject("uniboard", uniboardAPI); page()->mainFrame()->addToJavaScriptWindowObject("sankore", uniboardAPI);
UBWidgetVotingSystemAPI *votingSystem = new UBWidgetVotingSystemAPI(this); UBWidgetVotingSystemAPI *votingSystem = new UBWidgetVotingSystemAPI(this);
page()->mainFrame()->addToJavaScriptWindowObject("voting", votingSystem); page()->mainFrame()->addToJavaScriptWindowObject("voting", votingSystem);

@ -120,7 +120,7 @@ void UBToolWidget::javaScriptWindowObjectCleared()
{ {
UBWidgetUniboardAPI* uniboardAPI = new UBWidgetUniboardAPI(UBApplication::boardController->activeScene()); UBWidgetUniboardAPI* uniboardAPI = new UBWidgetUniboardAPI(UBApplication::boardController->activeScene());
mToolWidget->page()->mainFrame()->addToJavaScriptWindowObject("uniboard", uniboardAPI); mToolWidget->page()->mainFrame()->addToJavaScriptWindowObject("sankore", uniboardAPI);
UBW3CWidget* w3c = dynamic_cast<UBW3CWidget*>(mToolWidget); UBW3CWidget* w3c = dynamic_cast<UBW3CWidget*>(mToolWidget);
if (w3c) if (w3c)

@ -183,7 +183,10 @@ void XPDFRenderer::render(QPainter *p, int pageNumber, const QRectF &bounds)
QTransform savedTransform = p->worldTransform(); QTransform savedTransform = p->worldTransform();
p->resetTransform(); p->resetTransform();
QTime t;
t.start();
p->drawImage(QPointF(savedTransform.dx() + mSliceX, savedTransform.dy() + mSliceY), pdfImage); p->drawImage(QPointF(savedTransform.dx() + mSliceX, savedTransform.dy() + mSliceY), pdfImage);
//qDebug() << "XPDFRenderer::render(...) execution time: " << t.elapsed() << "ms";
p->setWorldTransform(savedTransform); p->setWorldTransform(savedTransform);
} }
} }

@ -40,9 +40,35 @@ UBGraphicsTriangle::UBGraphicsTriangle()
mRotateSvgItem->setVisible(false); mRotateSvgItem->setVisible(false);
mRotateSvgItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); mRotateSvgItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control));
//updateResizeCursor(); updateResizeCursor();
} }
void UBGraphicsTriangle::updateResizeCursor()
{
QPixmap pix(":/images/cursors/resize.png");
QTransform itemTransform = sceneTransform();
QRectF itemRect = boundingRect();
QPointF topLeft = itemTransform.map(itemRect.topLeft());
QPointF topRight = itemTransform.map(itemRect.topRight());
QPointF bottomLeft = itemTransform.map(itemRect.bottomLeft());
QLineF topLine(topLeft, topRight);
QLineF leftLine(topLeft, bottomLeft);
qreal angle = topLine.angle();
QTransform tr1;
tr1.rotate(- angle);
mResizeCursor1 = QCursor(pix.transformed(tr1, Qt::SmoothTransformation), pix.width() / 2, pix.height() / 2);
angle = leftLine.angle();
QTransform tr2;
tr2.rotate(- angle);
mResizeCursor2 = QCursor(pix.transformed(tr2, Qt::SmoothTransformation), pix.width() / 2, pix.height() / 2);
}
UBGraphicsTriangle::~UBGraphicsTriangle() UBGraphicsTriangle::~UBGraphicsTriangle()
{ {
} }
@ -65,7 +91,7 @@ UBItem* UBGraphicsTriangle::deepCopy(void) const
void UBGraphicsTriangle::setRect(qreal x, qreal y, qreal w, qreal h, UBGraphicsTriangleOrientation orientation) void UBGraphicsTriangle::setRect(qreal x, qreal y, qreal w, qreal h, UBGraphicsTriangleOrientation orientation)
{ {
QPolygonF polygon; QPolygonF polygon;
polygon << QPointF(x, y) << QPoint(x, y + h) << QPoint(x+w, y + h) << QPoint(x, y); polygon << QPointF(x, y) << QPoint(x, y + h) << QPoint(x+w, y + h);
setPolygon(polygon); setPolygon(polygon);
setOrientation(orientation); setOrientation(orientation);
@ -73,26 +99,12 @@ void UBGraphicsTriangle::setRect(qreal x, qreal y, qreal w, qreal h, UBGraphicsT
void UBGraphicsTriangle::setOrientation(UBGraphicsTriangleOrientation orientation) void UBGraphicsTriangle::setOrientation(UBGraphicsTriangleOrientation orientation)
{ {
mOrientation = orientation; mOrientation = orientation;
QTransform t; calculatePoints(boundingRect());
switch(orientation)
{
case BottomLeft:
t.setMatrix(1, 0, 0, 0, 1, 0, 0, 0, 1);
break;
case BottomRight:
t.setMatrix(-1, 0, 0, 0, 1, 0, boundingRect().right(), 0, 1);
break;
case TopLeft:
t.setMatrix(1, 0, 0, 0, -1, 0, 0, boundingRect().bottom(), 1);
break;
case TopRight:
t.setMatrix(-1, 0, 0, 0, -1, 0, boundingRect().right(), boundingRect().bottom(), 1);
break;
}
rotateAroundCenter(t); QPolygonF polygon;
setTransform(t); polygon << A1 << B1 << C1;
setPolygon(polygon);
} }
UBGraphicsScene* UBGraphicsTriangle::scene() const UBGraphicsScene* UBGraphicsTriangle::scene() const
@ -100,25 +112,81 @@ UBGraphicsScene* UBGraphicsTriangle::scene() const
return static_cast<UBGraphicsScene*>(QGraphicsPolygonItem::scene()); return static_cast<UBGraphicsScene*>(QGraphicsPolygonItem::scene());
} }
void UBGraphicsTriangle::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) void UBGraphicsTriangle::calculatePoints(const QRectF& r)
{ {
QPointF A1(rect().x(), rect().y()); switch(mOrientation)
QPointF B1(rect().x(), rect().y() + rect().height()); {
QPointF C1(rect().x() + rect().width(), rect().y() + rect().height()); case BottomLeft:
A1.setX(r.left()); A1.setY(r.top());
B1.setX(r.left()); B1.setY(r.bottom());
C1.setX(r.right()); C1.setY(r.bottom());
break;
case TopLeft:
A1.setX(r.left()); A1.setY(r.bottom());
B1.setX(r.left()); B1.setY(r.top());
C1.setX(r.right()); C1.setY(r.top());
break;
case TopRight:
A1.setX(r.right()); A1.setY(r.bottom());
B1.setX(r.right()); B1.setY(r.top());
C1.setX(r.left()); C1.setY(r.top());
break;
case BottomRight:
A1.setX(r.right()); A1.setY(r.top());
B1.setX(r.right()); B1.setY(r.bottom());
C1.setX(r.left()); C1.setY(r.bottom());
break;
}
qreal C = sqrt(rect().width() * rect().width() + rect().height() * rect().height()); C = sqrt(rect().width() * rect().width() + rect().height() * rect().height());
qreal L = (C * d + rect().width() * d)/ rect().height(); qreal L = (C * d + rect().width() * d)/ rect().height();
qreal K = (C * d + rect().height() * d)/ rect().width(); qreal K = (C * d + rect().height() * d)/ rect().width();
qreal W1 = rect().height() * d / C; switch(mOrientation)
qreal H1 = rect().width() * d / C; {
case BottomLeft:
A2.setX(r.left() + d); A2.setY(r.top() + K);
B2.setX(r.left() + d); B2.setY(r.bottom() - d);
C2.setX(r.right() - L); C2.setY(r.bottom() - d);
break;
case TopLeft:
A2.setX(r.left() + d); A2.setY(r.bottom() - K);
B2.setX(r.left() + d); B2.setY(r.top() + d);
C2.setX(r.right() - L); C2.setY(r.top() + d);
break;
case TopRight:
A2.setX(r.right() - d); A2.setY(r.bottom() - K);
B2.setX(r.right() - d); B2.setY(r.top() + d);
C2.setX(r.left() + L); C2.setY(r.top() + d);
break;
case BottomRight:
A2.setX(r.right() - d); A2.setY(r.top() + K);
B2.setX(r.right() - d); B2.setY(r.bottom() - d);
C2.setX(r.left() + L); C2.setY(r.bottom() - d);
break;
}
W1 = rect().height() * d / C;
H1 = rect().width() * d / C;
QPointF A2(rect().x() + d, rect().y() + K); switch(mOrientation)
QPointF B2(rect().x() + d, rect().y() + rect().height() - d); {
QPointF C2(rect().x() + rect().width() - L, rect().y() + rect().height() - d); case BottomLeft:
CC.setX(r.right() - L + W1); CC.setY(r.bottom() - d - H1);
break;
case TopLeft:
CC.setX(r.right() - L + W1); CC.setY(r.top() + d + H1);
break;
case TopRight:
CC.setX(r.left() + L - W1); CC.setY(r.top() + d + H1);
break;
case BottomRight:
CC.setX(r.left() + L - W1); CC.setY(r.top() - d - H1);
break;
}
}
QPoint CC(rect().x() + rect().width() - L + W1, void UBGraphicsTriangle::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
rect().y() + rect().height() - d - H1); {
painter->setPen(Qt::NoPen); painter->setPen(Qt::NoPen);
@ -193,41 +261,76 @@ void UBGraphicsTriangle::paintGraduations(QPainter *painter)
const int millimetersPerCentimeter = 10; const int millimetersPerCentimeter = 10;
const int millimetersPerHalfCentimeter = 5; const int millimetersPerHalfCentimeter = 5;
qreal kx = (mOrientation == TopLeft || mOrientation == BottomLeft) ? 1 : -1;
qreal ky = (mOrientation == BottomLeft || mOrientation == BottomRight) ? 1 : -1;
painter->save(); painter->save();
painter->setFont(font()); painter->setFont(font());
QFontMetricsF fontMetrics(painter->font()); QFontMetricsF fontMetrics(painter->font());
for (int millimeters = 0; millimeters < (rect().width() - sLeftEdgeMargin - sRoundingRadius) / sPixelsPerMillimeter; millimeters++) for (int millimeters = 0; millimeters < (rect().width() - sLeftEdgeMargin - sRoundingRadius) / sPixelsPerMillimeter; millimeters++)
{ {
int graduationX = rotationCenter().x() + sPixelsPerMillimeter * millimeters; int graduationX = rotationCenter().x() + kx * sPixelsPerMillimeter * millimeters;
int graduationHeight = (0 == millimeters % millimetersPerCentimeter) ? int graduationHeight = (0 == millimeters % millimetersPerCentimeter) ?
centimeterGraduationHeight : centimeterGraduationHeight :
((0 == millimeters % millimetersPerHalfCentimeter) ? ((0 == millimeters % millimetersPerHalfCentimeter) ?
halfCentimeterGraduationHeight : millimeterGraduationHeight); halfCentimeterGraduationHeight : millimeterGraduationHeight);
// Check that grad. line inside triangle // Check that grad. line inside triangle
qreal lineY = rect().bottom() - rect().height()/rect().width()*(rect().width() - graduationX); qreal dx = (kx > 0) ? rect().width() - graduationX : graduationX - rect().x();
if (lineY >= rotationCenter().y() - graduationHeight) qreal lineY = rotationCenter().y() - ky * rect().height()/rect().width() * dx;
break; if (mOrientation == BottomLeft || mOrientation == BottomRight)
{
if (lineY >= rotationCenter().y() - ky * graduationHeight)
break;
}
else
{
if (lineY <= rotationCenter().y() - ky * graduationHeight)
break;
}
painter->drawLine(QLine(graduationX, rotationCenter().y(), graduationX, rotationCenter().y() - graduationHeight)); painter->drawLine(QLine(graduationX, rotationCenter().y(), graduationX, rotationCenter().y() - ky * graduationHeight));
if (0 == millimeters % millimetersPerCentimeter) if (0 == millimeters % millimetersPerCentimeter)
{ {
QString text = QString("%1").arg((int)(millimeters / millimetersPerCentimeter)); QString text = QString("%1").arg((int)(millimeters / millimetersPerCentimeter));
int textXRight = graduationX + fontMetrics.width(text) / 2; int textXRight = graduationX + fontMetrics.width(text) / 2;
qreal textWidth = fontMetrics.width(text); qreal textWidth = fontMetrics.width(text);
qreal textHeight = fontMetrics.tightBoundingRect(text).height() + 5; qreal textHeight = fontMetrics.tightBoundingRect(text).height() + 5;
int textY = rect().bottom() - 5 - centimeterGraduationHeight - textHeight;
lineY = rect().bottom() - rect().height()/rect().width()*(rect().width() - textXRight); int textY = (ky > 0) ? rotationCenter().y() - 5 - centimeterGraduationHeight - textHeight
: rotationCenter().y() + 5 + centimeterGraduationHeight;
if (textXRight < rect().right() bool bText = false;
&& lineY < textY) switch(mOrientation)
{ {
case BottomLeft:
dx = rect().width() - textXRight;
lineY = rotationCenter().y() - rect().height()/rect().width() * dx;
bText = lineY <= textY;
break;
case TopLeft:
dx = rect().width() - textXRight;
lineY = rotationCenter().y() + rect().height()/rect().width() * dx;
bText = lineY >= textY + textHeight;
break;
case TopRight:
dx = textXRight - textWidth - rect().left();
lineY = rotationCenter().y() + rect().height()/rect().width() * dx;
bText = lineY >= textY + textHeight;
break;
case BottomRight:
dx = textXRight - textWidth - rect().left();
lineY = rotationCenter().y() - rect().height()/rect().width() * dx;
bText = lineY <= textY;
break;
}
if (bText)
painter->drawText( painter->drawText(
QRectF(graduationX - textWidth / 2, QRectF(graduationX - textWidth / 2,
textY, textWidth, textHeight), textY, textWidth, textHeight),
Qt::AlignVCenter, text); Qt::AlignVCenter, text);
}
} }
} }
painter->restore(); painter->restore();
@ -236,98 +339,210 @@ void UBGraphicsTriangle::paintGraduations(QPainter *painter)
void UBGraphicsTriangle::rotateAroundCenter(qreal angle) void UBGraphicsTriangle::rotateAroundCenter(qreal angle)
{ {
qreal oldAngle = this->angle;
this->angle = angle; this->angle = angle;
QTransform transform; QTransform transform;
rotateAroundCenter(transform); rotateAroundCenter(transform, rotationCenter());
setTransform(transform, true); setTransform(transform, true);
this->angle = oldAngle + angle; // We have to store absolute value for FLIP case
} }
void UBGraphicsTriangle::rotateAroundCenter(QTransform& transform) void UBGraphicsTriangle::rotateAroundCenter(QTransform& transform, QPointF center)
{ {
transform.translate(rotationCenter().x(), rotationCenter().y()); transform.translate(center.x(), center.y());
transform.rotate(angle); transform.rotate(angle);
transform.translate(- rotationCenter().x(), - rotationCenter().y()); transform.translate(- center.x(), - center.y());
} }
QPointF UBGraphicsTriangle::rotationCenter() const QPointF UBGraphicsTriangle::rotationCenter() const
{ {
return QPointF(rect().x() + sLeftEdgeMargin , rect().bottom()); switch(mOrientation)
{
case BottomLeft:
case TopLeft:
return B1 + QPointF(sLeftEdgeMargin, 0);
case TopRight:
case BottomRight:
return B1 - QPointF(sLeftEdgeMargin, 0);
}
return QPointF(0, 0);
} }
QRectF UBGraphicsTriangle::closeButtonRect() const QRectF UBGraphicsTriangle::closeButtonRect() const
{ {
return QRectF(rect().x() + d - mCloseSvgItem->boundingRect().width() - 5, switch(mOrientation)
rect().bottom() - d - mCloseSvgItem->boundingRect().height() - 5, {
mCloseSvgItem->boundingRect().width(), case BottomLeft:
mCloseSvgItem->boundingRect().height()); return QRectF(B2.x() - mCloseSvgItem->boundingRect().width() - 5,
B2.y() - mCloseSvgItem->boundingRect().height() - 5,
mCloseSvgItem->boundingRect().width(),
mCloseSvgItem->boundingRect().height());
case TopLeft:
return QRectF(B2.x() - mCloseSvgItem->boundingRect().width() - 5,
B2.y() + 5,
mCloseSvgItem->boundingRect().width(),
mCloseSvgItem->boundingRect().height());
case TopRight:
return QRectF(B2.x() + 5,
B2.y() + 5,
mCloseSvgItem->boundingRect().width(),
mCloseSvgItem->boundingRect().height());
case BottomRight:
return QRectF(B2.x() + 5,
B2.y() - mCloseSvgItem->boundingRect().height() - 5,
mCloseSvgItem->boundingRect().width(),
mCloseSvgItem->boundingRect().height());
}
return QRectF(0,0,0,0);
} }
QPolygonF UBGraphicsTriangle::resize1Polygon() const QPolygonF UBGraphicsTriangle::resize1Polygon() const
{ {
qreal C = sqrt(rect().width() * rect().width() + rect().height() * rect().height()); qreal x1, y1;
switch(mOrientation)
{
case BottomLeft:
x1 = -1;
y1 = -1;
break;
case TopLeft:
x1 = -1;
y1 = 1;
break;
case TopRight:
x1 = 1;
y1 = 1;
break;
case BottomRight:
x1 = 1;
y1 = -1;
break;
}
QPointF P1(C1.x() + x1 * sArrowLength, C1.y());
QPointF P2(C1.x() + x1 * sArrowLength * rect().width()/C, C1.y() + y1 * sArrowLength * rect().height() / C);
QPolygonF p; QPolygonF p;
p << C1 << P1 << P2;
QPointF P1(rect().right() - sArrowLength, rect().bottom());
QPointF P2(rect().right() - sArrowLength * rect().width() / C,
rect().bottom() - sArrowLength * rect().height() / C );
p << QPointF(rect().right(), rect().bottom()) << P1 << P2;
return p; return p;
} }
QPolygonF UBGraphicsTriangle::resize2Polygon() const QPolygonF UBGraphicsTriangle::resize2Polygon() const
{ {
qreal C = sqrt(rect().width() * rect().width() + rect().height() * rect().height()); qreal x1, y1;
switch(mOrientation)
{
case BottomLeft:
x1 = 1;
y1 = 1;
break;
case TopLeft:
x1 = 1;
y1 = -1;
break;
case TopRight:
x1 = -1;
y1 = -1;
break;
case BottomRight:
x1 = -1;
y1 = 1;
break;
}
QPointF P1(A1.x(), A1.y() + y1 * sArrowLength);
QPointF P2(A1.x() + x1 * sArrowLength * rect().width()/C,
A1.y() + y1 * sArrowLength * rect().height() / C);
QPolygonF p; QPolygonF p;
p << A1 << P1 << P2;
QPointF P1(rect().left(), rect().top() + sArrowLength);
QPointF P2(rect().left() + sArrowLength * rect().width() / C,
rect().top() + sArrowLength * rect().height() / C );
p << QPointF(rect().left(), rect().top()) << P1 << P2;
return p; return p;
} }
QRectF UBGraphicsTriangle::hFlipRect() const QRectF UBGraphicsTriangle::hFlipRect() const
{ {
return QRectF(rect().x() + d - mHFlipSvgItem->boundingRect().width() - 5, qreal dy = mVFlipSvgItem->boundingRect().height() + mCloseSvgItem->boundingRect().height() + 10;
rect().bottom() - d - mCloseSvgItem->boundingRect().height() - mVFlipSvgItem->boundingRect().height() - switch(mOrientation)
mVFlipSvgItem->boundingRect().height() - 15, {
mHFlipSvgItem->boundingRect().width(), case BottomLeft:
mHFlipSvgItem->boundingRect().height()); return QRectF(B2.x() - mHFlipSvgItem->boundingRect().width() - 5,
B2.y() - mHFlipSvgItem->boundingRect().height() - 5 - dy,
mHFlipSvgItem->boundingRect().width(),
mHFlipSvgItem->boundingRect().height());
case TopLeft:
return QRectF(B2.x() - mHFlipSvgItem->boundingRect().width() - 5,
B2.y() + 5 + dy,
mHFlipSvgItem->boundingRect().width(),
mHFlipSvgItem->boundingRect().height());
case TopRight:
return QRectF(B2.x() + 5,
B2.y() + 5 + dy,
mHFlipSvgItem->boundingRect().width(),
mHFlipSvgItem->boundingRect().height());
case BottomRight:
return QRectF(B2.x() + 5,
B2.y() - mHFlipSvgItem->boundingRect().height() - 5 - dy,
mHFlipSvgItem->boundingRect().width(),
mHFlipSvgItem->boundingRect().height());
}
return QRectF(0,0,0,0);
} }
QRectF UBGraphicsTriangle::vFlipRect() const QRectF UBGraphicsTriangle::vFlipRect() const
{ {
return QRectF(rect().x() + d - mVFlipSvgItem->boundingRect().width() - 5, qreal dy = mCloseSvgItem->boundingRect().height() + 5;
rect().bottom() - d - mCloseSvgItem->boundingRect().height() - mVFlipSvgItem->boundingRect().height() - 10, switch(mOrientation)
mVFlipSvgItem->boundingRect().width(), {
mVFlipSvgItem->boundingRect().height()); case BottomLeft:
return QRectF(B2.x() - mVFlipSvgItem->boundingRect().width() - 5,
B2.y() - mVFlipSvgItem->boundingRect().height() - 5 - dy,
mVFlipSvgItem->boundingRect().width(),
mVFlipSvgItem->boundingRect().height());
case TopLeft:
return QRectF(B2.x() - mVFlipSvgItem->boundingRect().width() - 5,
B2.y() + 5 + dy,
mVFlipSvgItem->boundingRect().width(),
mVFlipSvgItem->boundingRect().height());
case TopRight:
return QRectF(B2.x() + 5,
B2.y() + 5 + dy,
mVFlipSvgItem->boundingRect().width(),
mVFlipSvgItem->boundingRect().height());
case BottomRight:
return QRectF(B2.x() + 5,
B2.y() - mVFlipSvgItem->boundingRect().height() - 5 - dy,
mVFlipSvgItem->boundingRect().width(),
mVFlipSvgItem->boundingRect().height());
}
return QRectF(0,0,0,0);
} }
QRectF UBGraphicsTriangle::rotateRect() const QRectF UBGraphicsTriangle::rotateRect() const
{ {
QPointF A1(rect().x(), rect().y()); QPointF p(C2);
QPointF B1(rect().x(), rect().y() + rect().height()); switch(mOrientation)
QPointF C1(rect().x() + rect().width(), rect().y() + rect().height()); {
case BottomLeft:
qreal C = sqrt(rect().width() * rect().width() + rect().height() * rect().height()); p += QPointF(20, 5);
qreal L = (C * d + rect().width() * d)/ rect().height(); break;
case TopLeft:
QPointF C2(rect().x() + rect().width() - L, rect().y() + rect().height() - d); p += QPointF(20, -5 - mRotateSvgItem->boundingRect().height());
break;
return QRectF(C2 + QPointF(20, 5), QSizeF(mRotateSvgItem->boundingRect().size())); case TopRight:
p += QPointF(-20 - mRotateSvgItem->boundingRect().width(), -5 - mRotateSvgItem->boundingRect().height());
break;
case BottomRight:
p += QPointF(-20 - mRotateSvgItem->boundingRect().width(), 5);
break;
}
return QRectF(p, QSizeF(mRotateSvgItem->boundingRect().size()));
}
QCursor UBGraphicsTriangle::resizeCursor1() const
{
return mResizeCursor1;
} }
QCursor UBGraphicsTriangle::moveResizeCursor() const QCursor UBGraphicsTriangle::resizeCursor2() const
{ {
return Qt::OpenHandCursor; return mResizeCursor2;
} }
QCursor UBGraphicsTriangle::flipCursor() const QCursor UBGraphicsTriangle::flipCursor() const
@ -376,8 +591,16 @@ void UBGraphicsTriangle::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
if (mResizing1) if (mResizing1)
{ {
QPointF delta = event->pos() - event->lastPos(); QPointF delta = event->pos() - event->lastPos();
if (rect().width() + delta.x() < sMinWidth) if (mOrientation == TopLeft || mOrientation == BottomLeft)
delta.setX(sMinWidth - rect().width()); {
if (rect().width() + delta.x() < sMinWidth)
delta.setX(sMinWidth - rect().width());
}
else
{
if (rect().width() - delta.x() < sMinWidth)
delta.setX(sMinWidth - rect().width());
}
if (mOrientation == TopLeft || mOrientation == BottomLeft) if (mOrientation == TopLeft || mOrientation == BottomLeft)
{ {
setRect(QRectF( setRect(QRectF(
@ -388,11 +611,11 @@ void UBGraphicsTriangle::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
} }
else else
{ {
setRect( setRect(QRectF(
rect().left() - delta.x(), rect().left() + delta.x(),
rect().top(), rect().top(),
rect().width() + delta.x(), rect().width() - delta.x(),
rect().height(), rect().height()),
mOrientation mOrientation
); );
} }
@ -400,15 +623,30 @@ void UBGraphicsTriangle::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
if (mResizing2) if (mResizing2)
{ {
QPointF delta = event->pos() - event->lastPos(); QPointF delta = event->pos() - event->lastPos();
if (rect().height() + delta.y() < sMinHeight) if (mOrientation == BottomRight || mOrientation == BottomLeft)
delta.setY(sMinHeight - rect().height()); {
qDebug() << delta; if (rect().height() - delta.y() < sMinHeight)
setRect(QRect( delta.setY(sMinHeight - rect().height());
rect().left(), }
rect().top() + delta.y(), else
rect().width(), {
rect().height() - delta.y()), if (rect().height() + delta.y() < sMinHeight)
mOrientation); delta.setY(sMinHeight - rect().height());
}
if (mOrientation == BottomRight || mOrientation == BottomLeft)
setRect(QRectF(
rect().left(),
rect().top() + delta.y(),
rect().width(),
rect().height() - delta.y()),
mOrientation);
else
setRect(QRectF(
rect().left(),
rect().top(),
rect().width(),
rect().height() + delta.y()),
mOrientation);
} }
if (mRotating) if (mRotating)
{ {
@ -425,6 +663,8 @@ void UBGraphicsTriangle::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (mResizing1 || mResizing2 || mRotating) if (mResizing1 || mResizing2 || mRotating)
{ {
if (mRotating)
updateResizeCursor();
mResizing1 = false; mResizing1 = false;
mResizing2 = false; mResizing2 = false;
mRotating = false; mRotating = false;
@ -496,9 +736,10 @@ void UBGraphicsTriangle::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
mVFlipSvgItem->setVisible(true); mVFlipSvgItem->setVisible(true);
mRotateSvgItem->setVisible(true); mRotateSvgItem->setVisible(true);
if (resize1Polygon().containsPoint(event->pos().toPoint(), Qt::OddEvenFill) || if (resize1Polygon().containsPoint(event->pos().toPoint(), Qt::OddEvenFill))
resize2Polygon().containsPoint(event->pos().toPoint(), Qt::OddEvenFill)) setCursor(resizeCursor1());
setCursor(moveResizeCursor()); else if(resize2Polygon().containsPoint(event->pos().toPoint(), Qt::OddEvenFill))
setCursor(resizeCursor2());
else if (closeButtonRect().contains(event->pos())) else if (closeButtonRect().contains(event->pos()))
setCursor(closeCursor()); setCursor(closeCursor());
else if (hFlipRect().contains(event->pos()) else if (hFlipRect().contains(event->pos())
@ -537,9 +778,10 @@ void UBGraphicsTriangle::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
mHFlipSvgItem->setVisible(mShowButtons); mHFlipSvgItem->setVisible(mShowButtons);
mRotateSvgItem->setVisible(mShowButtons); mRotateSvgItem->setVisible(mShowButtons);
if (resize1Polygon().containsPoint(event->pos().toPoint(), Qt::OddEvenFill) || if (resize1Polygon().containsPoint(event->pos().toPoint(), Qt::OddEvenFill))
resize2Polygon().containsPoint(event->pos().toPoint(), Qt::OddEvenFill)) setCursor(resizeCursor1());
setCursor(moveResizeCursor()); else if (resize2Polygon().containsPoint(event->pos().toPoint(), Qt::OddEvenFill))
setCursor(resizeCursor2());
else if (closeButtonRect().contains(event->pos())) else if (closeButtonRect().contains(event->pos()))
setCursor(closeCursor()); setCursor(closeCursor());
else if (hFlipRect().contains(event->pos()) else if (hFlipRect().contains(event->pos())

@ -67,6 +67,8 @@ class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonIt
protected: protected:
void updateResizeCursor();
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *styleOption, QWidget *widget); virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *styleOption, QWidget *widget);
virtual void rotateAroundCenter(qreal angle); virtual void rotateAroundCenter(qreal angle);
@ -80,7 +82,9 @@ class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonIt
QRectF vFlipRect() const; QRectF vFlipRect() const;
QRectF rotateRect() const; QRectF rotateRect() const;
QCursor moveResizeCursor() const; QCursor resizeCursor1() const;
QCursor resizeCursor2() const;
QCursor flipCursor() const; QCursor flipCursor() const;
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
@ -92,9 +96,12 @@ class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonIt
private: private:
QCursor mResizeCursor1;
QCursor mResizeCursor2;
QTransform calculateRotationTransform(); QTransform calculateRotationTransform();
qreal angle; qreal angle;
void rotateAroundCenter(QTransform& transform); void rotateAroundCenter(QTransform& transform, QPointF center);
bool mResizing1; bool mResizing1;
bool mResizing2; bool mResizing2;
@ -112,10 +119,16 @@ class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonIt
UBGraphicsTriangleOrientation mOrientation; UBGraphicsTriangleOrientation mOrientation;
QPointF A1, B1, C1, A2, B2, C2; // coordinates of points in ext and int triangles
qreal C;
qreal W1, H1; // Neccessary for filling
QPointF CC; // Hyp. fillining gradient - top point
void calculatePoints(const QRectF& rect);
static const int d = 70; // width of triangle border static const int d = 70; // width of triangle border
static const int sArrowLength = 30; static const int sArrowLength = 30;
static const int sMinWidth = 200; static const int sMinWidth = 380;
static const int sMinHeight = 150; static const int sMinHeight = 200;
}; };
#endif /* UBGRAPHICSTRIANGLE_H_ */ #endif /* UBGRAPHICSTRIANGLE_H_ */

Loading…
Cancel
Save