commit
8d1b059f85
@ -0,0 +1,12 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<widget xmlns="http://www.w3.org/ns/widgets" |
||||||
|
xmlns:ub="http://uniboard.mnemis.com/widgets" |
||||||
|
id="http://uniboard.mnemis.com/widgets/geogebra" |
||||||
|
version="1.0" |
||||||
|
width="800" |
||||||
|
height="500" |
||||||
|
ub:resizable="true" |
||||||
|
ub:roles="tool cMAC cUNIX"> |
||||||
|
<name>Geogebra</name> |
||||||
|
<content src="index.html"/> |
||||||
|
</widget> |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 2.0 KiB |
@ -0,0 +1,71 @@ |
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
||||||
|
<HTML><HEAD> |
||||||
|
<META http-equiv=Content-Type content="text/html; charset=windows-1252"> |
||||||
|
<BODY> |
||||||
|
<DIV id=applet1></DIV> |
||||||
|
<SCRIPT type=text/javascript> |
||||||
|
|
||||||
|
function ggbOnInit() |
||||||
|
{ |
||||||
|
alert("Geogebra applet is initialized"); |
||||||
|
} |
||||||
|
|
||||||
|
var width=0; |
||||||
|
var height=0; |
||||||
|
setWidthHeight(); |
||||||
|
|
||||||
|
if (height < 500) height=500; |
||||||
|
if (width < 800) width=800; |
||||||
|
|
||||||
|
|
||||||
|
var applet1=document.getElementById('applet1'); |
||||||
|
|
||||||
|
applet1.innerHTML=geogebra_applet(0.95*width,height*0.95,"",true,true,true,false,true,true,true,true,true,true,true,true); |
||||||
|
|
||||||
|
function geogebra_applet(width,height,filename,framePossible,enableRightClick,enableShiftDragZoom,showResetIcon,showMenuBar,showToolBar,showToolBarHelp,showAlgebraInput,enableLabelDrags,showSpreadsheet,showAlgebraView) { |
||||||
|
|
||||||
|
|
||||||
|
ret = '<applet name="ggbApplet" code="geogebra.GeoGebraApplet" codebase="./bin/" archive="geogebra.jar" height="'+height+'" width="'+width+'">'; |
||||||
|
ret +='<param name="image" value="./images/loading.gif"/><param name="boxborder" value="false"/><param name="centerimage" value="true">'; |
||||||
|
ret +='<param name="java_arguments" value="-Xmx512m">'; |
||||||
|
if (filename != "") ret+='<param name="filename" value="'+filename+'">'; |
||||||
|
ret+='<param name="framePossible" value="'+framePossible+'">'; |
||||||
|
ret+='<param name="enableRightClick" value="'+enableRightClick+'">'; |
||||||
|
ret+='<param name="enableShiftDragZoom" value="'+enableShiftDragZoom+'">'; |
||||||
|
ret+='<param name="enableLabelDrags" value="'+enableLabelDrags+'">'; |
||||||
|
ret+='<param name="showSpreadsheet" value="'+showSpreadsheet+'">'; |
||||||
|
ret+='<param name="showAlgebraView" value="'+showAlgebraView+'">'; |
||||||
|
ret+='<param name="showResetIcon" value="'+showResetIcon+'">'; |
||||||
|
ret+='<param name="showMenuBar" value="'+showMenuBar+'">'; |
||||||
|
ret+='<param name="showToolBar" value="'+showToolBar+'">'; |
||||||
|
ret+='<param name="showToolBarHelp" value="'+showToolBarHelp+'">'; |
||||||
|
ret+='<param name="showAlgebraInput" value="'+showAlgebraInput+'">'; |
||||||
|
ret+='Sorry, the GeoGebra Applet could not be started. Please make sure that Java 1.4.2 (or later) is installed and activated.'; |
||||||
|
ret+='(<a href="http://java.sun.com/getjava">click here to install Java now</a>)'; |
||||||
|
ret+='</applet>'; |
||||||
|
return ret; |
||||||
|
} |
||||||
|
|
||||||
|
function setWidthHeight() { |
||||||
|
var myWidth = 0, myHeight = 0; |
||||||
|
if( typeof( window.innerWidth ) == 'number' ) { |
||||||
|
//Non-IE |
||||||
|
myWidth = window.innerWidth; |
||||||
|
myHeight = window.innerHeight; |
||||||
|
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { |
||||||
|
//IE 6+ in 'standards compliant mode' |
||||||
|
myWidth = document.documentElement.clientWidth; |
||||||
|
myHeight = document.documentElement.clientHeight; |
||||||
|
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { |
||||||
|
//IE 4 compatible |
||||||
|
myWidth = document.body.clientWidth; |
||||||
|
myHeight = document.body.clientHeight; |
||||||
|
} |
||||||
|
//window.alert( 'Width = ' + myWidth ); |
||||||
|
//window.alert( 'Height = ' + myHeight ); |
||||||
|
width=myWidth; |
||||||
|
height=myHeight; |
||||||
|
} |
||||||
|
</SCRIPT> |
||||||
|
</BODY></HTML> |
||||||
|
|
@ -1,63 +1,63 @@ |
|||||||
/* Pour info, les span étaient une tentative de mise en forme via CSS mais j'ai trouvé plus pratique, et je les ai laissés au cas où... */ |
/* Pour info, les span йtaient une tentative de mise en forme via CSS mais j'ai trouvй plus pratique, et je les ai laissйs au cas oщ... */ |
||||||
|
|
||||||
var txt_vesicule = "<h2>Vésicule<br/>Transporteurs</h2>"+ |
var txt_vesicule = "<h2>Vesicle<br/>Transporter</h2>"+ |
||||||
"<h4>Structure:</h4><span><p>Bicouche phospholipidique</p></span>"+ |
"<h4>Structure:</h4><span><p>Phospholipid bilayer</p></span>"+ |
||||||
"<h4>Rôle:</h4><span><p>Transport de protéines ou d'autres éléments à l'intérieur de la cellule, vers l'extérieur (exocytose) ou vers l'intérieur (endocytose).</p></span>"+ |
"<h4>Role:</h4><span><p>Transport of proteins and other components inside the cell to the exterior (exocytosis) or inward (endocytosis).</p></span>"+ |
||||||
'<h4>Fonctionnement:</h4><span><p>Transporteur "remorqué" par des protéines prenant appui sur le cytosquelette.</p></span>' |
'<h4>Operation:</h4><span><p>Transport "towed" by Protein building on the cytoskeleton.</p></span>' |
||||||
|
|
||||||
var txt_lysosome = "<h2>Lysosome<br/>Estomacs cellulaires</h2>"+ |
var txt_lysosome = "<h2>Lysosome<br/>A stomach cell.</h2>"+ |
||||||
"<h4>Structure:</h4><span><p>Bicouche phospholipidique</p></span>"+ |
"<h4>Structure:</h4><span><p>Phospholipid bilayer</p></span>"+ |
||||||
"<h4>Rôle:</h4><span><p>Digestion intra-cellulaire à l'aide d'enzymes</p></span>"+ |
"<h4>Role:</h4><span><p>А intracellular digestion with enzymes.</p></span>"+ |
||||||
"<h4>Fonctionnement:</h4><span><p>Absorption de nutriments par endocytose ou d'éléments cellulaires abimés, digestion de ceux-ci, puis distribution des résultats de la réaction chimique dans la cellule et enfin expulsion des déchets par exocytose.</p></span>" |
"<h4>Operation:</h4><span><p>Absorbes nutrient uptake or damaged cellular components by endocytosis, digest them and then distributes the results of the chemical reaction in the cell and finally expels of waste by exocytosis.</p></span>" |
||||||
|
|
||||||
var txt_mitoch = "<h2>Mitochondrie<br/>Piles</h2>"+ |
var txt_mitoch = "<h2>Mitochondrie<br/>Batteries</h2>"+ |
||||||
"<h4>Structure:</h4><span><p>Deux bichouches phospholipidiques appelées membranes mitochondriales, une externe et une interne. La mitochondrie contient des ribosomes, de l'ATP de l'ADN et bien d'autres molécules.</p></span>"+ |
"<h4>Structure:</h4><span><p>Two phospholipid bilayers called mitochondrial membranes, one external and one internal. The mitochondria contain ribosomes, ATP of DNA and other molecules.</p></span>"+ |
||||||
"<h4>Rôle:</h4><span><p>Centrale énergétique de la cellule.</p></span>"+ |
"<h4>Role:</h4><span><p>Powerhouse of the cell.</p></span>"+ |
||||||
"<h4>Fonctionnement:</h4><span><p>L'énergie - sous forme d'ATP (adénosine triphosphate) - est issue de différentes étapes de réactions chimique partant d'une molécule de glucose.</p></span>" |
"<h4>Operation:</h4><span><p>Energy - in the form of ATP (adenosine triphosphate) - comes from various stages of chemical reactions starting from a glucose molecule.</p></span>" |
||||||
|
|
||||||
var txt_golgi = "<h2>Appareil de Golgi<br/>Usines miniatures</h2>"+ |
var txt_golgi = "<h2>Apparatus golgi<br/>Miniature plants</h2>"+ |
||||||
"<h4>Structure:</h4><span><p>Formé d'un empilement de saccules membranaires applatis.</p></span>"+ |
"<h4>Structure:</h4><span><p>Has a stack of flattened membrane saccules.</p></span>"+ |
||||||
"<h4>Rôle:</h4><span><p>Modification de certaines protéines au cours d'un cheminement au travers de ses saccules.</p></span>"+ |
"<h4>Role:</h4><span><p>Modification of proteins during a journey through its saccules.</p></span>"+ |
||||||
"<h4>Fonctionnement:</h4><span><p>Suite de réactions chimiques, notamment par glycosilation.</p></span>" |
"<h4>Operation:</h4><span><p>Chemical reactions, including glycosylation.</p></span>" |
||||||
|
|
||||||
var txt_rer = "<h2>Réticulum endoplasmique rugueux - Tunnel</h2>"+ |
var txt_rer = "<h2>Rough endoplasmic reticulum - Tunnel</h2>"+ |
||||||
"<h4>Structure:</h4><span><p>Composé d'une bicouche phospholipidique piquetée de ribosomes (d'un aspect <i>rugueux</i>) délimitant la lumière, un espace interne pouvant être comparé à un tunnel.</p></span>"+ |
"<h4>Structure:</h4><span><p>Consists of a phospholipid bilayer studded with ribosomes (an aspect <i> rough </ i>) define the light, an internal space that can be compared to a tunnel.</p></span>"+ |
||||||
"<h4>Rôle:</h4><span><p>Plus spécialisé que le REL, il participe au transport et à la finalisation des protéines, qui sont synthétisées par les ribosomes.</p></span>"+ |
"<h4>Role:</h4><span><p>More specialized than the real, he participated in the transport and а finalizing the proteins that are synthesized by ribosomes.</p></span>"+ |
||||||
'<h4>Fonctionnement:</h4><span><p>Les protéines "tombent" dans la lumière du RER où elles sont modifiées et déplacées. Elles quittent le RER dans une vésucule issue de la membrane de ce dernier.</p></span>' |
'<h4>Operation:</h4><span><p>Proteins "fall" in the light of the RER where they are modified and displaced. They leave the RER in a vesicle membrane after it.</p></span>' |
||||||
|
|
||||||
var txt_noy = "<h2>Noyau - Le coffre-fort</h2>"+ |
var txt_noy = "<h2>Core - The safe</h2>"+ |
||||||
"<h4>Structure:</h4><span><p>Entouré par une double membrane appelée enveloppe nucléaire en lien par endroits avec le RER. Ces deux membranes fusionnent à intervalles réguliers pour former les pores nucléaires. À l'intérieur se trouvent le nucléole et l'ADN, sous forme de chromatine ou de chomosomes.</p></span>"+ |
"<h4>Structure:</h4><span><p>Surrounded by a double membrane, that called the nuclear envelope, in places linked with the RER. These two membranes protect regular intervals formed nuclear pores. It located within the nucleolus and the DNA in the form of chromatin or chromosomes.</p></span>"+ |
||||||
"<h4>Rôle:</h4><span><p>Stockage de la totalité des informations génétiques nécessaires à la vie de la cellule.</p></span>"+ |
"<h4>Role:</h4><span><p>Storing all the genetic information necessary for a life of the cell.</p></span>"+ |
||||||
"<h4>Fonctionnement:</h4><span><p>Site de la transcription (copie de l'information génétique sur des ARNm).</p></span>" |
"<h4>Operation:</h4><span><p>Copying of genetic information on mRNA.</p></span>" |
||||||
|
|
||||||
var txt_rel = "<h2>Réticulum endoplasmique lisse - REL</h2>"+ |
var txt_rel = "<h2>Smooth endoplasmic reticulum - REL</h2>"+ |
||||||
"<h4>Structure:</h4><span><p>Similaires à celle du RER, à la différence que sa membranne n'est pas parsemée de ribosomes, d'où son aspect <i>lisse</i>.</p></span>"+ |
"<h4>Structure:</h4><span><p>Like that of the RER, with the difference that the membrane is studded with ribosomes, as its smooth <i>appearance</i>.</p></span>"+ |
||||||
"<h4>Rôle:</h4><span><p>Sinthèse des phospholipides,stockage du calcium, transformation de certaines molécules extérieures (médicament, alcool, ...). Dans certaines cellules, le REL remplit aussi des fonctions supplémentaires, telles la production d'hormones, d'acides gastriques, etc.</p></span>"+ |
"<h4>Role:</h4><span><p>Phospholipid synthesis, calcium storage, transformation of certain molecules external (drugs, alcohol, ...). In some cells, the LRA also performs additional functions, such as the production of hormones, gastric acid, etc.</p></span>"+ |
||||||
"<h4>Fonctionnement:</h4><span><p>Il est le siège de beaucoup de réactions chimiques complexes (ex: détoxification, différentes synthèses).</p></span>" |
"<h4>Operation:</h4><span><p>It is the seat of many complex chemical reactions (eg detoxification, various syntheses).</p></span>" |
||||||
|
|
||||||
var txt_adn = "<h2>ADN - Le livre de la vie</h2>"+ |
var txt_adn = "<h2>DNA - The Book of Life</h2>"+ |
||||||
"<h4>Structure:</h4><span><p>Échelle à la célèbre forme de double hélice composée de deux colonnes sucre-phosphate-sucre-phosphate-... et dont les échelons sont apellés bases azotées.</p></span>"+ |
"<h4>Structure:</h4><span><p>A scale in form of the famous double helix consists of two columns sugar-phosphate-sugar-phosphate ... and whose levels are called nitrogenous bases.</p></span>"+ |
||||||
"<h4>Rôle:</h4><span><p>L'ADN contient toutes les informations nécessaires à la vie.</p></span>"+ |
"<h4>Role:</h4><span><p>DNA contains all the information needed for a life.</p></span>"+ |
||||||
"<h4>Fonctionnement:</h4><span><p>Toutes les informations sont écrites à l'aide des quatre lettres A, T, G, et C. Grâce à ces combinaisons, il est possible d'écrire tout ce qui est utile à la cellule.</p></span>" |
"<h4>Operation:</h4><span><p>All information is written using the four letters A, T, G and C. Using these combinations, it is possible to write anything useful about cell.</p></span>" |
||||||
|
|
||||||
var txt_centr= "<h2>Centrioles - Remorqueurs de choromosomes</h2>"+ |
var txt_centr= "<h2>Centrioles - Tug of chromosomes</h2>"+ |
||||||
"<h4>Structure:</h4><span><p>Neuf triplets de microtubules entourés par un certain nombre de protéines.</p></span>"+ |
"<h4>Structure:</h4><span><p>Nine triplets of microtubules surrounded by a some number of proteins.</p></span>"+ |
||||||
"<h4>Rôle:</h4><span><p>Séparer les différents chromosomes durant la division cellulaire.</p></span>"+ |
"<h4>Role:</h4><span><p>Separate the different chromosomes during cell division.</p></span>"+ |
||||||
"<h4>Fonctionnement:</h4><span><p>Les centrioles, une fois placés aux deux pôles de la cellule, déploient des microtubules vers les centromères des chromosomes et les tirent vers eux pour les séparer.</p></span>" |
"<h4>Operation:</h4><span><p>Centrioles, once placed at the two poles of the cell, deploy the microtubules to the centromeres of chromosomes and pull them to them to separate them.</p></span>" |
||||||
|
|
||||||
var txt_rib = "<h2>Ribosome - Décodeurs</h2>"+ |
var txt_rib = "<h2>Ribosome - Decoders</h2>"+ |
||||||
"<h4>Structure:</h4><span><p>Formé par deux sous-unités composées d'ARN ribosomique et de protéines.</p></span>"+ |
"<h4>Structure:</h4><span><p>Formed by two subunits composed of ribosomal RNA and proteins.</p></span>"+ |
||||||
"<h4>Rôle:</h4><span><p>Le ribosome synthétise les protéines.</p></span>"+ |
"<h4>Role:</h4><span><p>The ribosome synthesizes proteins.</p></span>"+ |
||||||
"<h4>Fonctionnement:</h4><span><p>Un brin d'ARNm (messager) passe dans le ribosome et un ARNt (de transfert) entre dans la grande sous-unité si son codon (groupe de trois bases azotées) correspond à celui qui est en face sur l'ARNm. Cet ARNt porte avec lui un acide aminé spécifique qui est ajouté à la chaine déja assemblée.</p></span>" |
"<h4>Operation:</h4><span><p>A strand of mRNA (messenger) pass through the ribosome and tRNA (transfer) between the large subunit where the codon (group of three nitrogen bases) is one who is in front of the mRNA. This tRNA carries with it a specific amino acid that is added а chain already assembled.</p></span>" |
||||||
|
|
||||||
var txt_arn = "<h2>ARN - Multifonction</h2>"+ |
var txt_arn = "<h2>RNA - Multifunction</h2>"+ |
||||||
"<h4>Structure:</h4><span><p>Très similaire à l'ADN à la différence qu'il ne possède qu'un brin et que la thymine (T) de l'ADN est remplacée par l'uracile (U). De plus, il est chimiquement plus instable que l'ADN, c'est pourquoi il n'est pas utilisé pour le stockage d'informations à long terme.</p></span>"+ |
"<h4>Structure:</h4><span><p>Very similar DNA with the difference it has only one strand and thymine (T) of DNA is replaced by uracil (U). In addition, it is chemically more stable than DNA, so it is not used for information storage, just if in long term.</p></span>"+ |
||||||
"<h4>Rôle:</h4><span><p>Multiples, il existe des ARN de transport, messagers, régulateus, guides, satellites, ...</p></span>"+ |
"<h4>Role:</h4><span><p>Multiple, there are RNA transport, passenger, cruise, guides, satellite ...</p></span>"+ |
||||||
"<h4>Fonctionnement:</h4><span><p>La copie d'informations génétiques se fait grâce à l'ouverture de la double-hélice d'ADN, puis la copie des codons sur l'ARN. Celui-ci peut alors sortir du noyau, ce que l'ADN ne peut pas faire.</p></span>" |
"<h4>Operation:</h4><span><p>Copying of genetic information, the opening of the double helix of DNA, and then copying the RNA codons. It can then exit the nucleus, the DNA can not do it.</p></span>" |
||||||
|
|
||||||
var txt_nucl = "<h2>Nucléole - Fabrique d'ARN</h2>"+ |
var txt_nucl = "<h2>Nucleolus - Factory RNA</h2>"+ |
||||||
"<h4>Structure:</h4><span><p>Composé d'aucune membranne, c'est un agglomérat de protéines et d'ARN.</p></span>"+ |
"<h4>Structure:</h4><span><p>Composed of any membrane, a cluster of proteins and RNA.</p></span>"+ |
||||||
"<h4>Rôle:</h4><span><p>Lieu de la transcription d'ARN, nottament d'ARNr (ribosomiques) qui, associés avec des protéines, vont former les deux sous-unités des ribosomes.</p></span>"+ |
"<h4>Role:</h4><span><p>Location of the RNA transcripts, including RNA (ribosomal), which combines with protein, will form the two subunits of ribosomes.</p></span>"+ |
||||||
"<h4>Fonctionnement:</h4><span><p>Création d'un ribosome: Transcription des ARNr ainsi que des protéines nécessaires (cette étape est effectuée dans le cytoplasme par d'autres ribosomes) qui rentrent dans le noyau, association des molécules fraîchement formées en un nouveau ribosome, qui sort du noyau pour jouer son rôle.</p></span>" |
"<h4>Operation:</h4><span><p>Creation of a ribosome: Transcription of rRNA and protein needed (this step is performed in the cytoplasm by other ribosomes) that fall within the nucleus, association of molecules frankly formed a new ribosome, which leaves the nucleus to play its role.</p></span>" |
||||||
|
|
||||||
|
|
@ -1,164 +0,0 @@ |
|||||||
/*
|
|
||||||
* 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); |
|
||||||
} |
|
@ -1,61 +0,0 @@ |
|||||||
/*
|
|
||||||
* 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
|
|
Loading…
Reference in new issue