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

preferencesAboutTextFull
unknown 14 years ago
commit ff0db5d78e
  1. 2
      Sankore_3.1.pro
  2. 42
      src/adaptors/publishing/UBDocumentPublisher.cpp
  3. 37
      src/gui/UBKeyboardPalette.cpp
  4. 6
      src/gui/UBKeyboardPalette.h
  5. 58
      src/transition/UniboardSankoreTransition.cpp
  6. 2
      src/transition/UniboardSankoreTransition.h

@ -7,7 +7,7 @@ CONFIG += debug_and_release \
no_include_pwd
VERSION_MAJ = 1
VERSION_MIN = 11
VERSION_MIN = 12
VERSION_TYPE = b # a = alpha, b = beta, r = release, other => error
VERSION_PATCH = 00

@ -574,27 +574,31 @@ void UBDocumentPublisher::onFinished(QNetworkReply *reply)
// Now we isolate every cookie value
QStringList qslCookieVals = qsCookieValue.split("; ");
bool bTransferOk = false;
for(int j = 0; j <= qslCookieVals.size(); j++)
{
if(qslCookieVals.at(j).startsWith("assetStatus"))
{
QStringList qslAsset = qslCookieVals.at(j).split("=");
if(qslAsset.at(1) == "UPLOADED")
{
bTransferOk = true;
break;
}
}
}
if(bTransferOk)
{
UBApplication::showMessage(tr("Document uploaded correctly on the web."));
}
else
bool bTransferOk = false;
for(int j = 0; j < qslCookieVals.size(); j++)
{
qDebug() << j;
if(qslCookieVals.at(j).startsWith("assetStatus"))
{
QStringList qslAsset = qslCookieVals.at(j).split("=");
if(qslAsset.at(1) == "UPLOADED")
{
UBApplication::showMessage(tr("Failed to upload document on the web."));
bTransferOk = true;
break;
}
}
}
if(bTransferOk)
{
UBApplication::showMessage(tr("Document uploaded correctly on the web."));
}
else
{
UBApplication::showMessage(tr("Failed to upload document on the web."));
}
reply->deleteLater();
}

@ -62,19 +62,37 @@ UBKeyboardPalette::UBKeyboardPalette(QWidget *parent)
QList<UBKeyboardPalette*> UBKeyboardPalette::instances;
UBKeyboardPalette* UBKeyboardPalette::create(QWidget *parent)
{
//------------------------------//
if (!UBPlatformUtils::hasVirtualKeyboard())
return NULL;
//------------------------------//
UBKeyboardPalette* firstKeyboard = NULL;
// if we already have keyboards inside, get it position and show/hide status, for new keyboard
if(instances.size() > 0)
firstKeyboard = instances.at(0);
//------------------------------//
UBKeyboardPalette* instance = new UBKeyboardPalette(parent);
instances.append(instance);
instance->setKeyButtonSize(UBSettings::settings()->boardKeyboardPaletteKeyBtnSize->get().toString());
instance->setVisible(false);
instance->m_isVisible = firstKeyboard ? firstKeyboard->m_isVisible : false;
instance->setVisible(instance->m_isVisible);
if( firstKeyboard )
instance->move(firstKeyboard->m_pos);
connect(UBSettings::settings()->boardKeyboardPaletteKeyBtnSize, SIGNAL(changed(QVariant)), instance, SLOT(keyboardPaletteButtonSizeChanged(QVariant)));
connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), instance, SLOT(showKeyboard(bool)));
// connect(instance, SIGNAL(moved(const QPoint&)), instance, SLOT(syncPosition(const QPoint&)));
connect(instance, SIGNAL(closed()), instance, SLOT(hideKeyboard()));
//------------------------------//
instances.append(instance);
foreach(UBKeyboardPalette* inst, instances)
{
connect(inst, SIGNAL(moved(const QPoint&)), instance, SLOT(syncPosition(const QPoint&)));
@ -82,11 +100,21 @@ UBKeyboardPalette* UBKeyboardPalette::create(QWidget *parent)
connect(inst, SIGNAL(localeChanged(int)), instance, SLOT(syncLocale(int)));
connect(instance, SIGNAL(localeChanged(int)), inst, SLOT(syncLocale(int)));
// connect(instance, SIGNAL(closed()), inst, )
}
//------------------------------//
return instance;
}
void UBKeyboardPalette::showKeyboard(bool show)
{
m_isVisible = show;
}
void UBKeyboardPalette::hideKeyboard()
{
UBApplication::mainWindow->actionVirtualKeyboard->activate(QAction::Trigger);
@ -94,6 +122,7 @@ void UBKeyboardPalette::hideKeyboard()
void UBKeyboardPalette::syncPosition(const QPoint & pos)
{
m_pos = pos;
move(pos);
}

@ -76,7 +76,11 @@ public:
virtual void adjustSizeAndPosition(bool pUp = true);
QString getKeyButtonSize() const {QString res; res.sprintf("%dx%d", btnWidth, btnHeight); return res;}
void setKeyButtonSize(const QString& strSize);
static UBKeyboardPalette* create(QWidget *parent);
static QList<UBKeyboardPalette*> instances;
bool m_isVisible;
QPoint m_pos;
signals:
void moved(const QPoint&);
@ -88,6 +92,7 @@ private slots:
void syncLocale(int nLocale);
void keyboardPaletteButtonSizeChanged(QVariant size);
void onActivated(bool b);
void showKeyboard(bool show);
void hideKeyboard();
protected:
@ -117,7 +122,6 @@ protected:
private:
UBKeyboardPalette(QWidget *parent);
static QList<UBKeyboardPalette*> instances;
QRect originalRect;

@ -12,6 +12,7 @@
* 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 "UniboardSankoreTransition.h"
#include "core/UBSettings.h"
#include "frameworks/UBDesktopServices.h"
@ -90,6 +91,59 @@ void UniboardSankoreTransition::startDocumentTransition()
connect(this,SIGNAL(transitioningFile(QString)),mTransitionDlg,SLOT(transitioningFile(QString)));
}
bool UniboardSankoreTransition::checkPage(QString& sankorePagePath)
{
QFile file(sankorePagePath);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
return false;
QByteArray documentByteArray = file.readAll();
file.close();
QString sankoreDirectory = sankorePagePath.left(sankorePagePath.indexOf("/page"));
;
sankoreDirectory = QUrl::fromLocalFile(sankoreDirectory).toString();
QString documentString(documentByteArray);
qDebug() << documentString;
documentString.replace("xlink:href=\"videos/","xlink:href=\"" + sankoreDirectory + "/videos/");
documentString.replace("xlink:href=\"widgets/","xlink:href=\"" + sankoreDirectory + "/widgets/");
documentString.replace("xlink:href=\"objects/","xlink:href=\"" + sankoreDirectory + "/objects/");
documentString.replace("xlink:href=\"audios/","xlink:href=\"" + sankoreDirectory + "/audios/");
qDebug() << documentString;
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
return false;
file.write(documentString.toAscii());
file.close();
return true;
}
bool UniboardSankoreTransition::updateSankoreHRef(QString& sankoreDocumentPath)
{
bool result = true;
QFileInfoList fileInfoList = UBFileSystemUtils::allElementsInDirectory(sankoreDocumentPath);
QFileInfoList::iterator fileInfo;
QString sankoreDocumentDirectory = UBSettings::uniboardDocumentDirectory();
for (fileInfo = fileInfoList.begin(); fileInfo != fileInfoList.end() && result; fileInfo += 1) {
if (fileInfo->fileName().endsWith("svg")){
qDebug() << fileInfo->absolutePath();
QString path = fileInfo->absolutePath() + "/" + fileInfo->fileName();
result = checkPage(path);
}
}
return result;
}
void UniboardSankoreTransition::executeTransition()
{
bool result = false;
@ -109,7 +163,9 @@ void UniboardSankoreTransition::executeTransition()
QString sankoreDocumentName = fileInfo->fileName();
emit transitioningFile(sankoreDocumentName);
sankoreDocumentName.replace("Uniboard","Sankore");
result = UBFileSystemUtils::copyDir(fileInfo->filePath(),sankoreDocumentDirectory + "/" + sankoreDocumentName);
QString sankoreDocumentPath = sankoreDocumentDirectory + "/" + sankoreDocumentName;
result = UBFileSystemUtils::copyDir(fileInfo->filePath(),sankoreDocumentPath);
result &= updateSankoreHRef(sankoreDocumentPath);
}
}

@ -39,6 +39,8 @@ public:
explicit UniboardSankoreTransition(QObject *parent = 0);
~UniboardSankoreTransition();
void documentTransition();
bool checkPage(QString& sankorePagePath);
bool updateSankoreHRef(QString &sankoreDocumentPath);
void executeTransition();

Loading…
Cancel
Save