Commit 98365798 authored by Claudio Valerio's avatar Claudio Valerio

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

parents ca7ce7bd 9eb27a86
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
......@@ -2268,50 +2268,22 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::textItemToSvg(UBGraphicsTextItem* it
, "fill-on-light-background", colorLightBg.name());
//for new documents from version 4.5.0
if (true) {
mXmlWriter.writeStartElement("itemTextContent");
mXmlWriter.writeCDATA(item->toHtml());
mXmlWriter.writeEndElement(); //itemTextContent
//tracking for back capability with older versions
} else if (false) {
mXmlWriter.writeStartElement(nsXHtml, "body");
mXmlWriter.writeStartElement(nsXHtml, "div");
mXmlWriter.writeStartElement(nsXHtml, "font");
QFont font = item->font();
mXmlWriter.writeAttribute("face", font.family());
QFontInfo fi(font);
int pixelSize = fi.pixelSize();
mXmlWriter.writeAttribute("style", sFontSizePrefix + QString(" %1").arg(pixelSize) + sPixelUnit + "; " +
sFontWeightPrefix + " " + (fi.bold() ? "bold" : "normal") + "; " +
sFontStylePrefix + " " + (fi.italic() ? "italic" : "normal") + ";");
mXmlWriter.writeAttribute("color", item->defaultTextColor().name());
QString text = item->toPlainText();
QStringList lines = text.split("\n");
for (int i = 0; i < lines.length() ; i++)
{
mXmlWriter.writeCharacters(lines.at(i));
if (i < lines.length() - 1)
mXmlWriter.writeEmptyElement(nsXHtml, "br");
}
mXmlWriter.writeEndElement(); //font
mXmlWriter.writeEndElement(); //div
mXmlWriter.writeEndElement(); //body
}
mXmlWriter.writeStartElement("itemTextContent");
//TODO:
// This is only a workaround that works quite well. The font sizes are expressed on
// px instead of pt because px is less sensitive to the physicalDPI of the Os. The
// main problem in fact appears when the file is used on another platform than the
// one used to create it.
// But a different solution has to be implemented to avoid some annoying case that
// are already present with this hack.
QString htmlString = item->toHtml();
QRegExp regExp("font-size:([0-9]{,3})pt");
htmlString = htmlString.replace(regExp,"font-size:\\1px");
mXmlWriter.writeCDATA(htmlString);
mXmlWriter.writeEndElement(); //itemTextContent
mXmlWriter.writeEndElement(); //foreignObject
// QtLogger::start("/home/ilia/Documents/tmp/10/log.log");
// QtLogger::appendl(item->toHtml());
// QtLogger::finish();
}
UBGraphicsTextItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::textItemFromSvg()
......@@ -2361,7 +2333,6 @@ UBGraphicsTextItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::textItemFromSvg()
text = mXmlReader.readElementText();
textItem->setHtml(text);
textItem->resize(width, height);
if (textItem->toPlainText().isEmpty()) {
delete textItem;
textItem = 0;
......
......@@ -154,10 +154,6 @@ UBGraphicsScene::~UBGraphicsScene()
void UBGraphicsScene::selectionChangedProcessing()
{
if (selectedItems().count())
UBApplication::showMessage("ZValue is " + QString::number(selectedItems().first()->zValue(), 'f'));
QList<QGraphicsItem *> allItemsList = items();
qreal maxZ = 0.;
for( int i = 0; i < allItemsList.size(); i++ ) {
......
......@@ -247,6 +247,7 @@ QString UBW3CWidget::createNPAPIWrapperInDir(const QString& pUrl, const QDir& pD
{
QString url = pUrl;
// if the file name start with file:// it has be removed because QFileInfo doesn't support this form
url = url.replace("file:///","");
url = url.replace("file://","");
QString name = pName;
......@@ -304,7 +305,8 @@ QString UBW3CWidget::createNPAPIWrapperInDir(const QString& pUrl, const QDir& pD
if (fi.exists()){
QString target = widgetLibraryPath + "/" + fi.fileName();
QString source = pUrl;
source.replace("file://","");
source = source.replace("file:///","");
source = source.replace("file://","");
QFile::copy(source, target);
}
......
......@@ -86,8 +86,14 @@ QString UBPlatformUtils::osUserLoginName()
QString UBPlatformUtils::computerName()
{
// TODO Linux implement me
return "Not Implemented";
char hostname[256];
memset(hostname,0,256);
// if the name is longer than 255 the name is truncated but os doesn't ensure
// that the last character returned is a null character
if(!gethostname(hostname,255))
return QString::fromAscii(hostname);
else
return "NOT FOUND";
}
void UBPlatformUtils::setWindowNonActivableFlag(QWidget* widget, bool nonAcivable)
......
......@@ -216,6 +216,8 @@ void UBKeyboardPalette::onActivated(bool activated)
void UBKeyboardPalette::onLocaleChanged(UBKeyboardLocale* locale)
{
const int maxMapOffset = 3; //Suppose to have at least 2 keysym groups due to X11 xlib specification
Display *display = XOpenDisplay(0);
if(display == NULL)
return;
......@@ -232,7 +234,7 @@ void UBKeyboardPalette::onLocaleChanged(UBKeyboardLocale* locale)
KEYCODE& kc = (*locale)[i]->codes[j];
if (!kc.empty())
{
if (kc.modifier <= 5)
if (kc.modifier <= maxMapOffset)
keySyms[kc.code * byte_per_code + kc.modifier] = kc.symbol;
}
......@@ -248,10 +250,10 @@ void UBKeyboardPalette::onLocaleChanged(UBKeyboardLocale* locale)
KEYCODE& kc = (*locale)[i]->codes[j];
if (!kc.empty())
{
if (kc.modifier > 5)
if (kc.modifier > maxMapOffset)
{
for(int i1=0; i1<SYMBOL_KEYS_COUNT; i1++)
for(int j1=0; j1<=5; j1++)
for(int j1=0; j1<=maxMapOffset; j1++)
if (keySyms[i1 * byte_per_code + j1]==NoSymbol)
{
kc.code =i1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment