Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
a082cc2c
Commit
a082cc2c
authored
Aug 16, 2011
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed old unused class
parent
d60738b5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
248 deletions
+18
-248
adaptors.pri
src/adaptors/adaptors.pri
+0
-2
UBCapturePublisher.cpp
src/adaptors/publishing/UBCapturePublisher.cpp
+0
-164
UBCapturePublisher.h
src/adaptors/publishing/UBCapturePublisher.h
+0
-61
UBBoardPaletteManager.cpp
src/board/UBBoardPaletteManager.cpp
+18
-20
UBBoardPaletteManager.h
src/board/UBBoardPaletteManager.h
+0
-1
No files found.
src/adaptors/adaptors.pri
View file @
a082cc2c
...
...
@@ -17,7 +17,6 @@ HEADERS += src/adaptors/UBExportAdaptor.h\
src/adaptors/UBCFFSubsetAdaptor.h
HEADERS += src/adaptors/publishing/UBDocumentPublisher.h \
src/adaptors/publishing/UBCapturePublisher.h \
src/adaptors/publishing/UBAbstractPublisher.h \
src/adaptors/publishing/UBSvgSubsetRasterizer.h
...
...
@@ -42,7 +41,6 @@ SOURCES += src/adaptors/UBExportAdaptor.cpp\
src/adaptors/UBCFFSubsetAdaptor.cpp
SOURCES += src/adaptors/publishing/UBDocumentPublisher.cpp \
src/adaptors/publishing/UBCapturePublisher.cpp \
src/adaptors/publishing/UBAbstractPublisher.cpp \
src/adaptors/publishing/UBSvgSubsetRasterizer.cpp
...
...
src/adaptors/publishing/UBCapturePublisher.cpp
deleted
100644 → 0
View file @
d60738b5
/*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "UBCapturePublisher.h"
#include "frameworks/UBStringUtils.h"
#include "core/UBApplication.h"
#include "core/UBSettings.h"
#include "gui/UBMainWindow.h"
#include "board/UBBoardController.h"
#include "network/UBServerXMLHttpRequest.h"
#include "network/UBNetworkAccessManager.h"
#include "domain/UBGraphicsScene.h"
#include "core/memcheck.h"
UBCapturePublisher
::
UBCapturePublisher
(
const
QPixmap
&
pixmap
,
QObject
*
parent
)
:
UBAbstractPublisher
(
parent
)
,
mPixmap
(
pixmap
)
{
connect
(
this
,
SIGNAL
(
authenticated
(
const
QUuid
&
,
const
QString
&
))
,
this
,
SLOT
(
postPixmap
(
const
QUuid
&
,
const
QString
&
)));
}
void
UBCapturePublisher
::
publish
()
{
UBAbstractPublisher
::
authenticate
();
}
void
UBCapturePublisher
::
postPixmap
(
const
QUuid
&
tokenUuid
,
const
QString
&
encryptedBase64Token
)
{
UBCapturePublishingDialog
dialog
(
UBApplication
::
mainWindow
);
QString
defaultEMail
=
UBSettings
::
settings
()
->
uniboardWebEMail
->
get
().
toString
();
dialog
.
email
->
setText
(
defaultEMail
);
QString
defaultAuthor
=
UBSettings
::
settings
()
->
uniboardWebAuthor
->
get
().
toString
();
dialog
.
author
->
setText
(
defaultAuthor
);
if
(
dialog
.
exec
()
==
QDialog
::
Accepted
)
{
QApplication
::
setOverrideCursor
(
QCursor
(
Qt
::
WaitCursor
));
UBApplication
::
showMessage
(
tr
(
"Preparing capture for upload..."
),
true
);
QString
title
=
dialog
.
title
->
text
();
QString
description
=
dialog
.
description
->
toPlainText
();
QString
email
=
dialog
.
email
->
text
();
QString
author
=
dialog
.
author
->
text
();
QPixmap
pix
(
mPixmap
);
if
(
mPixmap
.
hasAlpha
())
{
if
(
UBApplication
::
boardController
->
activeScene
()
->
isDarkBackground
())
pix
.
fill
(
Qt
::
black
);
else
pix
.
fill
(
Qt
::
white
);
QPainter
p
(
&
pix
);
p
.
drawPixmap
(
0
,
0
,
mPixmap
);
}
QByteArray
bytes
;
QBuffer
buffer
(
&
bytes
);
buffer
.
open
(
QIODevice
::
WriteOnly
);
pix
.
save
(
&
buffer
,
"JPG"
,
80
);
buffer
.
close
();
QUrl
publishingEndpoint
=
QUrl
(
UBSettings
::
settings
()
->
capturesPublishingUrl
);
mPublishImageOnWebUploadRequest
=
new
UBServerXMLHttpRequest
(
UBNetworkAccessManager
::
defaultAccessManager
()
,
"application/octet-stream"
);
mPublishImageOnWebUploadRequest
->
setVerbose
(
true
);
connect
(
mPublishImageOnWebUploadRequest
,
SIGNAL
(
finished
(
bool
,
const
QByteArray
&
)),
this
,
SLOT
(
publishImageOnWebUploadResponse
(
bool
,
const
QByteArray
&
)));
mWebUploadPublishingUuid
=
QUuid
::
createUuid
();
mPublishImageOnWebUploadRequest
->
addHeader
(
"Publishing-UUID"
,
UBStringUtils
::
toCanonicalUuid
(
mWebUploadPublishingUuid
));
mPublishImageOnWebUploadRequest
->
addHeader
(
"Document-Title"
,
title
);
mPublishImageOnWebUploadRequest
->
addHeader
(
"Document-Author"
,
author
);
mPublishImageOnWebUploadRequest
->
addHeader
(
"Document-AuthorEMail"
,
email
);
mPublishImageOnWebUploadRequest
->
addHeader
(
"Document-Description"
,
description
);
mPublishImageOnWebUploadRequest
->
addHeader
(
"Deletion-Token"
,
UBStringUtils
::
toCanonicalUuid
(
QUuid
::
createUuid
()));
mPublishImageOnWebUploadRequest
->
addHeader
(
"Token-UUID"
,
UBStringUtils
::
toCanonicalUuid
(
tokenUuid
));
mPublishImageOnWebUploadRequest
->
addHeader
(
"Token-Encrypted"
,
encryptedBase64Token
);
mPublishImageOnWebUploadRequest
->
post
(
publishingEndpoint
,
bytes
);
}
else
{
UBApplication
::
showMessage
(
tr
(
"Publication canceled ..."
));
QApplication
::
restoreOverrideCursor
();
}
}
void
UBCapturePublisher
::
publishImageOnWebUploadResponse
(
bool
success
,
const
QByteArray
&
payload
)
{
QUrl
url
(
QString
::
fromUtf8
(
payload
));
if
(
success
&&
url
.
isValid
())
{
UBApplication
::
showMessage
(
tr
(
"Capture Published to the Web."
));
}
else
{
UBApplication
::
showMessage
(
tr
(
"Error Publishing Capture to the Web: %1"
).
arg
(
QString
::
fromUtf8
(
payload
)));
}
if
(
mPublishImageOnWebUploadRequest
)
{
mPublishImageOnWebUploadRequest
->
deleteLater
();
mPublishImageOnWebUploadRequest
=
0
;
}
QApplication
::
restoreOverrideCursor
();
}
UBCapturePublishingDialog
::
UBCapturePublishingDialog
(
QWidget
*
parent
)
:
QDialog
(
parent
)
{
Ui
::
capturePublishingDialog
::
setupUi
(
this
);
connect
(
dialogButtons
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
accept
()));
connect
(
dialogButtons
,
SIGNAL
(
rejected
()),
this
,
SLOT
(
reject
()));
connect
(
title
,
SIGNAL
(
textChanged
(
const
QString
&
)),
this
,
SLOT
(
updateUIState
(
const
QString
&
)));
connect
(
email
,
SIGNAL
(
textChanged
(
const
QString
&
)),
this
,
SLOT
(
updateUIState
(
const
QString
&
)));
dialogButtons
->
button
(
QDialogButtonBox
::
Ok
)
->
setEnabled
(
false
);
dialogButtons
->
button
(
QDialogButtonBox
::
Ok
)
->
setText
(
tr
(
"Publish"
));
}
void
UBCapturePublishingDialog
::
updateUIState
(
const
QString
&
string
)
{
Q_UNUSED
(
string
);
bool
ok
=
title
->
text
().
length
()
>
0
&&
email
->
text
().
length
()
>
0
;
dialogButtons
->
button
(
QDialogButtonBox
::
Ok
)
->
setEnabled
(
ok
);
}
src/adaptors/publishing/UBCapturePublisher.h
deleted
100644 → 0
View file @
d60738b5
/*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBCAPTUREPUBLISHER_H
#define UBCAPTUREPUBLISHER_H
#include <QtGui>
#include "ui_capturePublishing.h"
#include "UBAbstractPublisher.h"
class
UBServerXMLHttpRequest
;
class
UBCapturePublisher
:
public
UBAbstractPublisher
{
Q_OBJECT
public
:
explicit
UBCapturePublisher
(
const
QPixmap
&
pixmap
,
QObject
*
parent
=
0
);
void
publish
();
private
slots
:
void
publishImageOnWebUploadResponse
(
bool
success
,
const
QByteArray
&
payload
);
void
postPixmap
(
const
QUuid
&
tokenUuid
,
const
QString
&
encryptedBase64Token
);
private
:
UBServerXMLHttpRequest
*
mPublishImageOnWebUploadRequest
;
QUuid
mWebUploadPublishingUuid
;
QPixmap
mPixmap
;
};
class
UBCapturePublishingDialog
:
public
QDialog
,
public
Ui
::
capturePublishingDialog
{
Q_OBJECT
;
public
:
UBCapturePublishingDialog
(
QWidget
*
parent
=
0
);
~
UBCapturePublishingDialog
(){}
private
slots
:
void
updateUIState
(
const
QString
&
string
);
};
#endif // UBCAPTUREPUBLISHER_H
src/board/UBBoardPaletteManager.cpp
View file @
a082cc2c
...
...
@@ -54,8 +54,6 @@
#include "tools/UBToolsManager.h"
#include "adaptors/publishing/UBCapturePublisher.h"
#include "UBBoardController.h"
#include "core/memcheck.h"
...
...
@@ -579,27 +577,27 @@ void UBBoardPaletteManager::addItemToLibrary()
mAddItemPalette
->
hide
();
}
void
UBBoardPaletteManager
::
shareItemOnWeb
()
{
QPixmap
pixmap
=
mPixmap
;
//
void UBBoardPaletteManager::shareItemOnWeb()
//
{
//
QPixmap pixmap = mPixmap;
if
(
mPixmap
.
isNull
())
{
pixmap
=
QPixmap
(
mItemUrl
.
toLocalFile
());
}
//
if(mPixmap.isNull())
//
{
//
pixmap = QPixmap(mItemUrl.toLocalFile());
//
}
if
(
!
pixmap
.
isNull
())
{
UBCapturePublisher
*
publisher
=
new
UBCapturePublisher
(
pixmap
,
this
);
publisher
->
publish
();
}
else
{
UBApplication
::
showMessage
(
tr
(
"Error Publishing Image to the Web"
));
}
//
if(!pixmap.isNull())
//
{
//
UBCapturePublisher* publisher = new UBCapturePublisher(pixmap, this);
//
publisher->publish();
//
}
//
else
//
{
//
UBApplication::showMessage(tr("Error Publishing Image to the Web"));
//
}
mAddItemPalette
->
hide
();
}
//
mAddItemPalette->hide();
//
}
void
UBBoardPaletteManager
::
zoomButtonPressed
()
...
...
src/board/UBBoardPaletteManager.h
View file @
a082cc2c
...
...
@@ -118,7 +118,6 @@ class UBBoardPaletteManager : public QObject
void
addItemToCurrentPage
();
void
addItemToNewPage
();
void
addItemToLibrary
();
void
shareItemOnWeb
();
void
purchaseLinkActivated
(
const
QString
&
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment