update the Open-Sankore importer

preferencesAboutTextFull
Claudio Valerio 12 years ago
parent ef05678b19
commit bc5a17e43c
  1. 40
      resources/forms/preferences.ui
  2. 6
      src/core/UBApplicationController.cpp
  3. 6
      src/core/UBApplicationController.h
  4. 36
      src/core/UBOpenSankoreImporter.cpp
  5. 8
      src/core/UBOpenSankoreImporter.h
  6. 6
      src/core/UBPreferencesController.cpp
  7. 12
      src/gui/UBMainWindow.cpp
  8. 95
      src/gui/UBOpenSankoreImporterWidget.cpp
  9. 53
      src/gui/UBOpenSankoreImporterWidget.h
  10. 6
      src/gui/gui.pri

@ -24,7 +24,7 @@
<item row="1" column="0">
<widget class="QTabWidget" name="mainTabWidget">
<property name="currentIndex">
<number>5</number>
<number>6</number>
</property>
<widget class="QWidget" name="displayTab">
<attribute name="title">
@ -2781,6 +2781,44 @@ p, li { white-space: pre-wrap; }
</widget>
</widget>
</item>
<item>
<widget class="QGroupBox" name="softwareUpdateGroupBox_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>70</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>70</height>
</size>
</property>
<property name="title">
<string>Open-Sankoré Importer</string>
</property>
<widget class="QCheckBox" name="checkOpenSankoreAtStartup">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>551</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Check if Open-Sankoré data could be imported at launch</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>

@ -135,6 +135,9 @@ UBApplicationController::~UBApplicationController()
delete mBlackScene;
delete mMirror;
if (mHttp) delete mHttp;
delete(mOpenSankoreImporter);
mOpenSankoreImporter = NULL;
}
@ -525,7 +528,7 @@ void UBApplicationController::downloadJsonFinished(QString currentJson)
void UBApplicationController::checkAtLaunch()
{
UBOpenSankoreImporter();
mOpenSankoreImporter = new UBOpenSankoreImporter(mMainWindow->centralWidget());
if(UBSettings::settings()->appEnableAutomaticSoftwareUpdates->get().toBool()){
isNoUpdateDisplayed = false;
@ -610,6 +613,7 @@ void UBApplicationController::closing()
if (UBApplication::documentController)
UBApplication::documentController->closing();
}

@ -40,11 +40,11 @@ class QNetworkAccessManager;
class QNetworkReply;
class QHttp;
class UBRightPalette;
class UBOpenSankoreImporter;
class UBApplicationController : public QObject
{
Q_OBJECT;
Q_OBJECT
public:
@ -148,6 +148,8 @@ class UBApplicationController : public QObject
UBMainWindow *mMainWindow;
UBOpenSankoreImporter *mOpenSankoreImporter;
UBBoardView *mControlView;
UBBoardView *mDisplayView;
QList<UBBoardView*> mPreviousViews;

@ -27,29 +27,37 @@
#include "core/UBApplication.h"
#include "gui/UBMainWindow.h"
#include "gui/UBOpenSankoreImporterWidget.h"
UBOpenSankoreImporter::UBOpenSankoreImporter(QObject *parent) :
UBOpenSankoreImporter::UBOpenSankoreImporter(QWidget* mainWidget, QObject *parent) :
QObject(parent)
, mImporterWidget(NULL)
{
if(UBSettings::settings()->appLookForOpenSankoreInstall->get().toBool() &&
QDir(UBSettings::userDataDirectory().replace(qApp->applicationName(),"Sankore")).exists()){
if(UBApplication::mainWindow->yesNoQuestion(tr("Open-Sankoré data detected"),tr("Open-Sankoré directory is present on the disk. It's possible to import the Open-Sankoré documents into OpenBoard as the preferences. Pushing Ok will close OpenBoard and run the importer application."))){
QProcess newProcess;
mImporterWidget = new UBOpenSankoreImporterWidget(mainWidget);
connect(mImporterWidget->proceedButton(),SIGNAL(clicked()),mImporterWidget,SLOT(close()));
connect(mImporterWidget->proceedButton(),SIGNAL(clicked()),this,SLOT(onProceedClicked()));
}
}
void UBOpenSankoreImporter::onProceedClicked()
{
QProcess newProcess;
#ifdef Q_WS_X11
newProcess.startDetached(qApp->applicationDirPath()+"/Importer/OpenBoardImporter");
newProcess.startDetached(qApp->applicationDirPath()+"/Importer/OpenBoardImporter");
#elif defined Q_WS_MACX
newProcess.startDetached(qApp->applicationDirPath()+"/../Resources/OpenBoardImporter.app/Contents/MacOS/OpenBoardImporter");
newProcess.startDetached(qApp->applicationDirPath()+"/../Resources/OpenBoardImporter.app/Contents/MacOS/OpenBoardImporter");
#else
// Windows does not allows to run easily an exe located in a subdirectory when the main
// directory is placed into programs files.
//newProcess.startDetached(qApp->applicationDirPath()+"\\Importer\\OpenBoardImporter.exe");
newProcess.startDetached("C:/OpenBoard/Importer/OpenBoardImporter.exe");
// Windows does not allows to run easily an exe located in a subdirectory when the main
// directory is placed into programs files.
//newProcess.startDetached(qApp->applicationDirPath()+"\\Importer\\OpenBoardImporter.exe");
newProcess.startDetached("C:/OpenBoard/Importer/OpenBoardImporter.exe");
#endif
qApp->exit(0);
}
}
qApp->exit(0);
}

@ -23,17 +23,23 @@
#ifndef UBOPENSANKOREIMPORTER_H
#define UBOPENSANKOREIMPORTER_H
class UBOpenSankoreImporterWidget;
#include <QObject>
class UBOpenSankoreImporter : public QObject
{
Q_OBJECT
public:
explicit UBOpenSankoreImporter(QObject *parent = 0);
explicit UBOpenSankoreImporter(QWidget *mainWidget, QObject *parent = 0);
signals:
public slots:
void onProceedClicked();
private:
UBOpenSankoreImporterWidget* mImporterWidget;
};

@ -175,6 +175,7 @@ void UBPreferencesController::wire()
// about tab
connect(mPreferencesUI->checkSoftwareUpdateAtLaunchCheckBox, SIGNAL(clicked(bool)), settings->appEnableAutomaticSoftwareUpdates, SLOT(setBool(bool)));
connect(mPreferencesUI->checkOpenSankoreAtStartup, SIGNAL(clicked(bool)), settings->appLookForOpenSankoreInstall, SLOT(setBool(bool)));
}
void UBPreferencesController::init()
@ -183,6 +184,7 @@ void UBPreferencesController::init()
// about tab
mPreferencesUI->checkSoftwareUpdateAtLaunchCheckBox->setChecked(settings->appEnableAutomaticSoftwareUpdates->get().toBool());
mPreferencesUI->checkOpenSankoreAtStartup->setChecked(settings->appLookForOpenSankoreInstall->get().toBool());
// display tab
for(int i=0; i<mPreferencesUI->keyboardPaletteKeyButtonSize->count(); i++)
@ -297,6 +299,10 @@ void UBPreferencesController::defaultSettings()
{
bool defaultValue = settings->appEnableAutomaticSoftwareUpdates->reset().toBool();
mPreferencesUI->checkSoftwareUpdateAtLaunchCheckBox->setChecked(defaultValue);
defaultValue = settings->appLookForOpenSankoreInstall->reset().toBool();
mPreferencesUI->checkOpenSankoreAtStartup->setChecked(defaultValue);
}
else if(mPreferencesUI->mainTabWidget->currentWidget() == mPreferencesUI->networkTab){
bool defaultValue = settings->webUseExternalBrowser->reset().toBool();

@ -27,6 +27,8 @@
#include "core/UBApplication.h"
#include "core/UBApplicationController.h"
#include "board/UBBoardController.h"
#include "core/UBDisplayManager.h"
// work around for handling tablet events on MAC OS with Qt 4.8.0 and above
#if defined(Q_WS_MACX)
#include "board/UBBoardView.h"
@ -133,14 +135,6 @@ void UBMainWindow::switchToDocumentsWidget()
void UBMainWindow::keyPressEvent(QKeyEvent *event)
{
QMainWindow::keyPressEvent(event);
/*
if (event->key() == Qt::Key_B && !event->isAccepted())
{
UBApplication::applicationController->blackout();
event->accept();
}
*/
}
void UBMainWindow::closeEvent(QCloseEvent *event)
@ -191,8 +185,6 @@ void UBMainWindow::onExportDone()
actionDocumentAdd->setEnabled(true);
}
#include "core/UBDisplayManager.h"
bool UBMainWindow::yesNoQuestion(QString windowTitle, QString text)
{
QMessageBox messageBox;

@ -0,0 +1,95 @@
/* Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
*
* This file is part of Open-Sankoré.
*
* Open-Sankoré 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, version 3 of the License,
* with a specific linking exception for the OpenSSL project's
* "OpenSSL" library (or with modified versions of it that use the
* same license as the "OpenSSL" library).
*
* Open-Sankoré 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 Open-Sankoré. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QTextEdit>
#include <QCheckBox>
#include <QPushButton>
#include "core/UBSettings.h"
#include "UBOpenSankoreImporterWidget.h"
UBOpenSankoreImporterWidget::UBOpenSankoreImporterWidget(QWidget *parent):
UBFloatingPalette(Qt::TopRightCorner,parent)
{
setObjectName("UBOpenSankoreImporterWidget");
setFixedSize(700,450);
QVBoxLayout* mLayout = new QVBoxLayout(this);
mLayout->setContentsMargins(20,38,20,20);
setLayout(mLayout);
QLabel* title = new QLabel(this);
title->setText(tr("Open-Sankoré data detected"));
mLayout->addWidget(title);
QTextEdit* helpText = new QTextEdit(this);
helpText->setText(tr("Open-Sankoré directory is present on the disk. It's possible to import the Open-Sankoré documents into OpenBoard as the preferences. Pushing \"Proceed\" will close OpenBoard and run the importer application."));
helpText->setAcceptDrops(false);
helpText->setReadOnly(true);
mLayout->addWidget(helpText);
mDisplayOnNextRestart = new QCheckBox(this);
mDisplayOnNextRestart->setText(tr("Show this panel next time"));
mDisplayOnNextRestart->setChecked(true);
connect(mDisplayOnNextRestart,SIGNAL(clicked(bool)),this,SLOT(onNextRestartCheckBoxClicked(bool)));
mLayout->addStretch();
mLayout->addWidget(mDisplayOnNextRestart);
mLayout->addStretch();
QHBoxLayout* buttonLayout = new QHBoxLayout();
QPushButton* mCancelButton = new QPushButton(this);
mCancelButton->setText(tr("Cancel"));
buttonLayout->addWidget(mCancelButton);
buttonLayout->addStretch();
connect(mCancelButton,SIGNAL(clicked()),this,SLOT(close()));
mProceedButton = new QPushButton(this);
mProceedButton->setText(tr("Proceed"));
buttonLayout->addWidget(mProceedButton);
mLayout->addLayout(buttonLayout);
show();
}
void UBOpenSankoreImporterWidget::onNextRestartCheckBoxClicked(bool clicked)
{
UBSettings::settings()->appLookForOpenSankoreInstall->setBool(clicked);
}
void UBOpenSankoreImporterWidget::showEvent(QShowEvent *event)
{
Q_UNUSED(event);
adjustSizeAndPosition();
move((parentWidget()->width() - width()) / 2, (parentWidget()->height() - height()) / 5);
}
int UBOpenSankoreImporterWidget::border()
{
return 10;
}

@ -0,0 +1,53 @@
/* Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
*
* This file is part of Open-Sankoré.
*
* Open-Sankoré 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, version 3 of the License,
* with a specific linking exception for the OpenSSL project's
* "OpenSSL" library (or with modified versions of it that use the
* same license as the "OpenSSL" library).
*
* Open-Sankoré 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 Open-Sankoré. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBOPENSANKOREIMPORTERWIDGET_H
#define UBOPENSANKOREIMPORTERWIDGET_H
class QCheckBox;
class QPushButton;
#include "UBFloatingPalette.h"
class UBOpenSankoreImporterWidget : public UBFloatingPalette
{
Q_OBJECT
public:
UBOpenSankoreImporterWidget(QWidget* parent);
QPushButton* proceedButton(){return mProceedButton;}
protected:
void showEvent(QShowEvent *event);
int border();
QCheckBox* mDisplayOnNextRestart;
QPushButton* mProceedButton;
private slots:
void onNextRestartCheckBoxClicked(bool clicked);
};
#endif // UBOPENSANKOREIMPORTERWIDGET_H

@ -39,7 +39,8 @@ HEADERS += src/gui/UBThumbnailView.h \
src/gui/UBDockDownloadWidget.h \
src/gui/UBFeaturesWidget.h \
src/gui/UBFeaturesActionBar.h \
src/gui/UBMessagesDialog.h
src/gui/UBMessagesDialog.h \
src/gui/UBOpenSankoreImporterWidget.h
SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBFloatingPalette.cpp \
src/gui/UBToolbarButtonGroup.cpp \
@ -81,7 +82,8 @@ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBDockDownloadWidget.cpp \
src/gui/UBFeaturesWidget.cpp \
src/gui/UBFeaturesActionBar.cpp \
src/gui/UBMessagesDialog.cpp
src/gui/UBMessagesDialog.cpp \
src/gui/UBOpenSankoreImporterWidget.cpp
win32:SOURCES += src/gui/UBKeyboardPalette_win.cpp
macx:SOURCES += src/gui/UBKeyboardPalette_mac.cpp
linux-g++:SOURCES += src/gui/UBKeyboardPalette_linux.cpp

Loading…
Cancel
Save