From 2aecb8281ff192fa67e0dc7984dc3340176f970e Mon Sep 17 00:00:00 2001 From: baydam Date: Fri, 17 Jun 2016 17:58:12 +0000 Subject: [PATCH] improve preferences system --- MM.cpp | 5 + MM.h | 24 +- MainApplication.cpp | 6 +- MainApplication.h | 3 +- MainWindow.cpp | 96 +-- MainWindow.h | 13 +- MapperGLCanvas.cpp | 25 +- MapperGLCanvas.h | 3 +- Mapping.cpp | 3 +- Mapping.h | 1 + OutputGLCanvas.cpp | 171 +++- OutputGLCanvas.h | 6 + PreferenceDialog.cpp | 415 ++++++++++ PreferenceDialog.h | 124 +++ PreferencesDialog.cpp | 89 --- PreferencesDialog.h | 60 -- ShapeGraphicsItem.cpp | 7 +- ShapeGraphicsItem.h | 1 + main.cpp | 30 +- mapmap.pro | 13 +- mapmap.qrc | 8 +- resources/texts/mapmap_fr.ts | 721 ----------------- translations/mapmap_en.ts | 1450 ++++++++++++++++++++++++++++++++++ translations/mapmap_fr.ts | 1290 ++++++++++++++++++++++++++++++ translations/translation.qrc | 6 + 25 files changed, 3573 insertions(+), 997 deletions(-) create mode 100644 PreferenceDialog.cpp create mode 100644 PreferenceDialog.h delete mode 100644 PreferencesDialog.cpp delete mode 100644 PreferencesDialog.h delete mode 100644 resources/texts/mapmap_fr.ts create mode 100644 translations/mapmap_en.ts create mode 100644 translations/mapmap_fr.ts create mode 100644 translations/translation.qrc diff --git a/MM.cpp b/MM.cpp index ef5a368..9b11e73 100644 --- a/MM.cpp +++ b/MM.cpp @@ -2,6 +2,7 @@ * MM.cpp * * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com + * (c) 2015 Dame Diongue -- baydamd(@)gmail(.)com * * 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 @@ -30,6 +31,7 @@ const QString MM::FILE_EXTENSION = "mmp"; const QString MM::VIDEO_FILES_FILTER = "*.mov *.mp4 *.avi *.ogg *.ogv *.mpeg *.mpeg1 *.mpeg4 *.mpg *.mpg2 *.mp2 *.mjpq *.mjp *.wmv *sock"; const QString MM::IMAGE_FILES_FILTER = "*.jpg *.jpeg *.gif *.png *.tiff *.tif *.bmp"; const QString MM::NAMESPACE_PREFIX = QString("%1::").arg(TOSTRING(MM_NAMESPACE)); +const QString MM::SUPPORTED_LANGUAGES = "en, fr"; const QColor MM::WHITE("#f6f5f5"); const QColor MM::BLUE_GRAY("#323541"); @@ -64,4 +66,7 @@ const qreal MM::ZOOM_FACTOR = 1.4f; const qreal MM::ZOOM_MIN = 0.1f; const qreal MM::ZOOM_MAX = 5.0f; +// Default values +const QString MM::DEFAULT_LANGUAGE = "en"; + MM_END_NAMESPACE diff --git a/MM.h b/MM.h index 5434049..ed609dd 100644 --- a/MM.h +++ b/MM.h @@ -2,6 +2,7 @@ * MM.h * * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com + * (c) 2015 Dame Diongue -- baydamd(@)gmail(.)com * * 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 @@ -58,12 +59,12 @@ public: static const QString VIDEO_FILES_FILTER; static const QString IMAGE_FILES_FILTER; static const QString NAMESPACE_PREFIX; + static const QString SUPPORTED_LANGUAGES; // GUI. static const int DEFAULT_WINDOW_WIDTH = 640; static const int DEFAULT_WINDOW_HEIGHT = 480; - static const int TOP_TOOLBAR_ICON_SIZE = 48; - static const int BOTTOM_TOOLBAR_ICON_SIZE = 32; + static const int TOOLBAR_ICON_SIZE = 48; static const int ZOOM_TOOLBAR_ICON_SIZE = 22; static const int ZOOM_TOOLBAR_BUTTON_SIZE = 32; static const int MAPPING_LIST_ICON_SIZE = 16; @@ -71,6 +72,19 @@ public: // OSC static const int DEFAULT_OSC_PORT = 12345; + // Default values + static const bool DISPLAY_TEST_SIGNAL = false; + static const bool DISPLAY_OUTPUT_WINDOW = false; + static const bool DISPLAY_CONTROLS = true; + static const bool DISPLAY_ALL_CONTROLS = true; + static const bool DISPLAY_UNDO_STACK = false; + static const bool DISPLAY_ZOOM_TOOLBAR = true; + static const bool DISPLAY_MENU_BAR = true; + static const bool STICKY_VERTICES = true; + static const int DEFAULT_TEST_CARD = 0; + static const bool SHOW_OUTPUT_RESOLUTION = true; + static const QString DEFAULT_LANGUAGE; + // Style. static const QColor WHITE; static const QColor BLUE_GRAY; @@ -118,6 +132,12 @@ public: IconAndNameColum, GroupButtonColum }; + + enum TestCard { + Classic, + PAL, + NTSC + }; }; MM_END_NAMESPACE diff --git a/MainApplication.cpp b/MainApplication.cpp index 93af2a1..398ad83 100644 --- a/MainApplication.cpp +++ b/MainApplication.cpp @@ -3,6 +3,7 @@ * * (c) 2014 Sofian Audry -- info(@)sofianaudry(.)com * (c) 2014 Alexandre Quessy -- alexandre(@)quessy(.)net + * (c) 2016 Dame Diongue -- baydamd(@)gmail(.)com * * 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 @@ -25,13 +26,16 @@ MM_BEGIN_NAMESPACE MainApplication::MainApplication(int &argc, char *argv[]) : QApplication(argc, argv) { -#ifdef Q_OS_WIN +#ifdef Q_OS_WIN32 // Set GStreamer plugins path on Windows QString pluginPath = QCoreApplication::applicationDirPath() + "/plugins"; QString libPath = QCoreApplication::applicationDirPath() + "/lib"; _putenv_s("GST_PLUGIN_PATH", pluginPath.toLocal8Bit()); _putenv_s("PATH", libPath.toLocal8Bit()); + + // Set settings default format + QSettings::setDefaultFormat(QSettings::IniFormat); #endif // Initialize GStreamer. diff --git a/MainApplication.h b/MainApplication.h index 52d5645..6f21494 100644 --- a/MainApplication.h +++ b/MainApplication.h @@ -3,6 +3,7 @@ * * (c) 2014 Sofian Audry -- info(@)sofianaudry(.)com * (c) 2014 Alexandre Quessy -- alexandre(@)quessy(.)net + * (c) 2016 Dame Diongue -- baydamd(@)gmail(.)com * * 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 @@ -25,7 +26,7 @@ #include #include #include "MM.h" -#include "PreferencesDialog.h" +#include MM_BEGIN_NAMESPACE diff --git a/MainWindow.cpp b/MainWindow.cpp index 15c3844..12706c1 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -3,6 +3,7 @@ * * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com * (c) 2013 Alexandre Quessy -- alexandre(@)quessy(.)net + * (c) 2014 Dame Diongue -- baydamd(@)gmail(.)com * * 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 @@ -19,6 +20,7 @@ */ #include "MainWindow.h" +#include "PreferenceDialog.h" #include "Commands.h" #include "ProjectWriter.h" #include "ProjectReader.h" @@ -95,9 +97,6 @@ MainWindow::MainWindow() // Start playing by default. play(); - - // after readSettings(): - _preferences_dialog = new PreferencesDialog(this, this); } MainWindow::~MainWindow() @@ -362,7 +361,7 @@ void MainWindow::keyPressEvent(QKeyEvent *event) } } #endif -#ifdef Q_OS_WIN +#ifdef Q_OS_WIN32 if (event->modifiers() & Qt::AltModifier) { if (!_showMenuBar) { menuBar()->setHidden(!menuBar()->isHidden()); @@ -436,11 +435,6 @@ void MainWindow::open() videoTimer->start(); } -void MainWindow::preferences() -{ - this->_preferences_dialog->show(); -} - bool MainWindow::save() { // Popup save-as dialog if file has never been saved. @@ -731,7 +725,7 @@ void MainWindow::showMenuBar(bool shown) if (currentDesktop != "unity") menuBar()->setVisible(shown); #endif -#ifdef Q_OS_WIN // On Windows +#ifdef Q_OS_WIN32 // On Windows menuBar()->setVisible(shown); #endif } @@ -1419,6 +1413,9 @@ void MainWindow::createLayout() destinationLayout->addWidget(destinationCanvasToolbar, 0, Qt::AlignRight); destinationPanel->setLayout(destinationLayout); + // Preferences dialog + _preferenceDialog = new PreferenceDialog(this); + outputWindow = new OutputGLWindow(this, destinationCanvas); outputWindow->installEventFilter(destinationCanvas); @@ -1696,7 +1693,7 @@ void MainWindow::createActions() //preferencesAction->setIconVisibleInMenu(false); preferencesAction->setShortcutContext(Qt::ApplicationShortcut); addAction(preferencesAction); - connect(preferencesAction, SIGNAL(triggered()), this, SLOT(preferences())); + connect(preferencesAction, SIGNAL(triggered()), _preferenceDialog, SLOT(exec())); // Add mesh. addMeshAction = new QAction(tr("Add &Mesh"), this); @@ -2015,7 +2012,7 @@ void MainWindow::createMenus() if (QString(getenv("XDG_CURRENT_DESKTOP")).toLower() != "unity") toolBarsMenu->addAction(showMenuBarAction); #endif -#ifdef Q_OS_WIN +#ifdef Q_OS_WIN32 toolBarsMenu->addAction(showMenuBarAction); #endif windowMenu->addAction(displayUndoStackAction); @@ -2086,7 +2083,6 @@ void MainWindow::createPaintContextMenu() void MainWindow::createToolBars() { mainToolBar = addToolBar(tr("&Toolbar")); - mainToolBar->setIconSize(QSize(MM::TOP_TOOLBAR_ICON_SIZE, MM::TOP_TOOLBAR_ICON_SIZE)); mainToolBar->setMovable(false); mainToolBar->addAction(importMediaAction); mainToolBar->addAction(openCameraAction); @@ -2168,7 +2164,7 @@ void MainWindow::readSettings() { // FIXME: for each setting that is new since the first release in the major version number branch, // make sure it exists before reading its value. - QSettings settings("MapMap", "MapMap"); + QSettings settings; // settings present since 0.1.0: restoreGeometry(settings.value("geometry").toByteArray()); @@ -2181,45 +2177,31 @@ void MainWindow::readSettings() outputWindow->restoreGeometry(settings.value("outputWindow").toByteArray()); // new in 0.1.2: - if (settings.contains("displayOutputWindow")) - { - outputFullScreenAction->setChecked(settings.value("displayOutputWindow").toBool()); - outputWindow->setFullScreen(outputFullScreenAction->isChecked()); - } - if (settings.contains("displayTestSignal")) - { - displayTestSignalAction->setChecked(settings.value("displayTestSignal").toBool()); - enableTestSignal(displayTestSignalAction->isChecked()); - } - if (settings.contains("displayControls")) - { - displayControlsAction->setChecked(settings.value("displayControls").toBool()); - outputWindow->setDisplayCrosshair(displayControlsAction->isChecked()); - } - if (settings.contains("displayAllControls")) - { - displayPaintControlsAction->setChecked(settings.value("displayAllControls").toBool()); - // outputWindow->setDisplayCrosshair(displayPaintControlsAction->isChecked()); - } - - config_osc_receive_port = settings.value("osc_receive_port", MM::DEFAULT_OSC_PORT).toInt(); + outputFullScreenAction->setChecked(settings.value("displayOutputWindow", MM::DISPLAY_OUTPUT_WINDOW).toBool()); + displayTestSignalAction->setChecked(settings.value("displayTestSignal", MM::DISPLAY_TEST_SIGNAL).toBool()); + displayControlsAction->setChecked(settings.value("displayControls", MM::DISPLAY_CONTROLS).toBool()); + oscListeningPort = settings.value("oscListeningPort", MM::DEFAULT_OSC_PORT).toInt(); // Update Recent files and video updateRecentFileActions(); updateRecentVideoActions(); // new in 0.3.2 - if (settings.contains("displayUndoStack")) - displayUndoStackAction->setChecked(settings.value("displayUndoStack").toBool()); - if (settings.contains("zoomToolBar")) - displayZoomToolAction->setChecked(settings.value("zoomToolBar").toBool()); - if (settings.contains("showMenuBar")) - showMenuBarAction->setChecked(settings.value("showMenuBar").toBool()); + displayUndoStackAction->setChecked(settings.value("displayUndoStack", MM::DISPLAY_UNDO_STACK).toBool()); + displayZoomToolAction->setChecked(settings.value("zoomToolBar", MM::DISPLAY_ZOOM_TOOLBAR).toBool()); + showMenuBarAction->setChecked(settings.value("showMenuBar", MM::DISPLAY_MENU_BAR).toBool()); + + // New in 0.4.1 + displayPaintControlsAction->setChecked(settings.value("displayAllControls", MM::DISPLAY_ALL_CONTROLS).toBool()); + stickyVerticesAction->setChecked(settings.value("stickyVertices", MM::STICKY_VERTICES).toBool()); + // Set toolbar icon size + int toolBarIconSize = settings.value("toolbarIconSize", MM::TOOLBAR_ICON_SIZE).toInt(); + mainToolBar->setIconSize(QSize(toolBarIconSize, toolBarIconSize)); } void MainWindow::writeSettings() { - QSettings settings("MapMap", "MapMap"); + QSettings settings; settings.setValue("geometry", saveGeometry()); settings.setValue("windowState", saveState()); @@ -2233,10 +2215,11 @@ void MainWindow::writeSettings() settings.setValue("displayTestSignal", displayTestSignalAction->isChecked()); settings.setValue("displayControls", displayControlsAction->isChecked()); settings.setValue("displayAllControls", displayPaintControlsAction->isChecked()); - settings.setValue("osc_receive_port", config_osc_receive_port); + settings.setValue("oscListeningPort", oscListeningPort); settings.setValue("displayUndoStack", displayUndoStackAction->isChecked()); settings.setValue("zoomToolBar", displayZoomToolAction->isChecked()); settings.setValue("showMenuBar", showMenuBarAction->isChecked()); + settings.setValue("stickyVertices", stickyVerticesAction->isChecked()); } bool MainWindow::okToContinue() @@ -2717,9 +2700,6 @@ void MainWindow::addMappingItem(uid mappingId) mappingListModel->updateModel(); setCurrentMapping(mappingId); - // Disable Test signal when add Shapes - enableTestSignal(false); - // Add items to scenes. if (mapper->getInputGraphicsItem()) sourceCanvas->scene()->addItem(mapper->getInputGraphicsItem().data()); @@ -2878,12 +2858,12 @@ QString MainWindow::locateMediaFile(const QString &uri, bool isImage) return url; } -MainWindow* MainWindow::instance() { - static MainWindow* inst = 0; - if (!inst) { - inst = new MainWindow; +MainWindow* MainWindow::window() { + static MainWindow* instance = 0; + if (!instance) { + instance = new MainWindow; } - return inst; + return instance; } void MainWindow::updateCanvases() @@ -2978,12 +2958,6 @@ void MainWindow::enableDisplayPaintControls(bool display) updateCanvases(); } - -void MainWindow::enableTestSignal(bool enable) -{ - updateCanvases(); -} - void MainWindow::displayUndoStack(bool display) { _displayUndoStack = display; @@ -3231,7 +3205,7 @@ void MainWindow::removeCurrentMapping() { void MainWindow::startOscReceiver() { #ifdef HAVE_OSC - int port = config_osc_receive_port; + int port = oscListeningPort; std::ostringstream os; os << port; #if QT_VERSION >= 0x050500 @@ -3258,7 +3232,7 @@ bool MainWindow::setOscPort(int port) return false; } - config_osc_receive_port = port; + oscListeningPort = port; startOscReceiver(); return true; @@ -3266,7 +3240,7 @@ bool MainWindow::setOscPort(int port) int MainWindow::getOscPort() const { - return config_osc_receive_port; + return oscListeningPort; } bool MainWindow::setOscPort(QString portNumber) diff --git a/MainWindow.h b/MainWindow.h index 58a62c2..cb39a46 100644 --- a/MainWindow.h +++ b/MainWindow.h @@ -3,6 +3,7 @@ * * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com * (c) 2013 Alexandre Quessy -- alexandre(@)quessy(.)net + * (c) 2014 Dame Diongue -- baydamd(@)gmail(.)com * * 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 @@ -41,7 +42,6 @@ #endif #include "OutputGLWindow.h" -#include "PreferencesDialog.h" #include "ConsoleWindow.h" #include "MappingManager.h" @@ -57,6 +57,7 @@ MM_BEGIN_NAMESPACE +class PreferenceDialog; /** * This is the main window of MapMap. It acts as both a view and a controller interface. @@ -88,7 +89,6 @@ private slots: // File menu. void newFile(); void open(); - void preferences(); bool save(); bool saveAs(); void importMedia(); @@ -236,7 +236,6 @@ public slots: void enableDisplayControls(bool display); void enableDisplayPaintControls(bool display); void enableStickyVertices(bool display); - void enableTestSignal(bool enable); void displayUndoStack(bool display); // Show Mapping Context Menu @@ -307,7 +306,7 @@ public: // Locate the file not found QString locateMediaFile(const QString& uri, bool isImage); - static MainWindow* instance(); + static MainWindow* window(); // Returns a short version of filename. static QString strippedName(const QString &fullFileName); @@ -469,7 +468,7 @@ private: #ifdef HAVE_OSC OscInterface::ptr osc_interface; #endif - int config_osc_receive_port; + int oscListeningPort; QTimer *osc_timer; // View. @@ -510,7 +509,7 @@ private: QTimer *videoTimer; QElapsedTimer *systemTimer; - PreferencesDialog* _preferences_dialog; + PreferenceDialog* _preferenceDialog; // UndoStack QUndoStack *undoStack; @@ -560,7 +559,7 @@ public: bool displayPaintControls() const { return _displayPaintControls; } /// Returns true iff we want vertices to stick to each other. - bool stickyVertices() const { return _stickyVertices; } + bool isStickyVertices() const { return _stickyVertices; } // Use the same undoStack for whole program QUndoStack* getUndoStack() const { return undoStack; } diff --git a/MapperGLCanvas.cpp b/MapperGLCanvas.cpp index 08a0b1b..2e41245 100644 --- a/MapperGLCanvas.cpp +++ b/MapperGLCanvas.cpp @@ -3,6 +3,7 @@ * * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com * (c) 2013 Alexandre Quessy -- alexandre(@)quessy(.)net + * (c) 2014 Dame Diongue -- baydamd(@)gmail(.)com * * 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 @@ -82,7 +83,7 @@ MShape::ptr MapperGLCanvas::getShapeFromMapping(Mapping::ptr mapping) MShape::ptr MapperGLCanvas::getCurrentShape() { - return getShapeFromMapping(MainWindow::instance()->getCurrentMapping()); + return getShapeFromMapping(MainWindow::window()->getCurrentMapping()); } QSharedPointer MapperGLCanvas::getShapeGraphicsItemFromMapping(Mapping::ptr mapping) @@ -93,7 +94,7 @@ QSharedPointer MapperGLCanvas::getShapeGraphicsItemFromMappin } else { - MappingGui::ptr mappingGui = MainWindow::instance()->getMappingGuiByMappingId(mapping->getId()); + MappingGui::ptr mappingGui = MainWindow::window()->getMappingGuiByMappingId(mapping->getId()); return (isOutput() ? mappingGui->getGraphicsItem() : mappingGui->getInputGraphicsItem()); } } @@ -107,9 +108,9 @@ QSharedPointer MapperGLCanvas::getCurrentShapeGraphicsItem() void MapperGLCanvas::drawForeground(QPainter *painter , const QRectF &rect) { Q_UNUSED(rect); - if (_mainWindow->displayControls()) + if (MainWindow::window()->displayControls()) { - uid mid = _mainWindow->getCurrentMappingId(); + uid mid = MainWindow::window()->getCurrentMappingId(); if (mid != NULL_UID) { @@ -317,9 +318,9 @@ void MapperGLCanvas::mouseReleaseEvent(QMouseEvent* event) QPointF p = mapToScene(event->pos()); // Stick to vertices. - if (xOr(_mainWindow->stickyVertices(), (event->modifiers() & Qt::ShiftModifier))) + if (xOr(_mainWindow->isStickyVertices(), (event->modifiers() & Qt::ShiftModifier))) { - _glueVertex(&p); + _snapVertex(&p); } undoStack->push(new MoveVertexCommand(this, @@ -358,9 +359,9 @@ void MapperGLCanvas::mouseMoveEvent(QMouseEvent* event) QPointF p = scenePos; // Stick to vertices. - if (xOr(_mainWindow->stickyVertices(), (event->modifiers() & Qt::ShiftModifier))) + if (xOr(_mainWindow->isStickyVertices(), (event->modifiers() & Qt::ShiftModifier))) { - _glueVertex(&p); + _snapVertex(&p); } undoStack->push(new MoveVertexCommand(this, @@ -681,9 +682,11 @@ void MapperGLCanvas::setZoomFromMenu(const QString &text) applyZoomToView(); } -void MapperGLCanvas::_glueVertex(QPointF* p) +void MapperGLCanvas::_snapVertex(QPointF* p) { - MappingManager manager = MainWindow::instance()->getMappingManager(); + QSettings settings; + int vertexStickRadius = settings.value("vertexStickRadius", MM::VERTEX_STICK_RADIUS).toInt(); + MappingManager manager = MainWindow::window()->getMappingManager(); MShape::ptr currentShape = getCurrentShape(); for (int i = 0; i < manager.nMappings(); i++) { @@ -693,7 +696,7 @@ void MapperGLCanvas::_glueVertex(QPointF* p) for (int vertex = 0; vertex < shape->nVertices(); vertex++) { const QPointF& v = shape->getVertex(vertex); - if (distIsInside(v, *p, MM::VERTEX_STICK_RADIUS)) + if (distIsInside(v, *p, vertexStickRadius)) { p->setX(v.x()); p->setY(v.y()); diff --git a/MapperGLCanvas.h b/MapperGLCanvas.h index 52c9964..db4ab7f 100644 --- a/MapperGLCanvas.h +++ b/MapperGLCanvas.h @@ -2,6 +2,7 @@ * MapperGLCanvas.h * * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com + * (c) 2014 Dame Diongue -- baydamd(@)gmail(.)com * * 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 @@ -196,7 +197,7 @@ public slots: protected: // TODO: Perhaps the sticky-sensitivity should be configurable through GUI - void _glueVertex(QPointF* p); + void _snapVertex(QPointF* p); public: static const int NO_VERTEX = -1; diff --git a/Mapping.cpp b/Mapping.cpp index 7779e14..2f8ba51 100644 --- a/Mapping.cpp +++ b/Mapping.cpp @@ -3,6 +3,7 @@ * * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com * (c) 2013 Alexandre Quessy -- alexandre(@)quessy(.)net + * (c) 2016 Dame Diongue -- baydamd(@)gmail(.)com * * 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 @@ -91,7 +92,7 @@ void Mapping::read(const QDomElement& obj) // Read paint. int paintId = obj.attribute("paintId").toInt(); - setPaint(MainWindow::instance()->getMappingManager().getPaintById(paintId)); + setPaint(MainWindow::window()->getMappingManager().getPaintById(paintId)); // Read output shape. _readShape(obj, true); diff --git a/Mapping.h b/Mapping.h index b8978d4..9ee38a2 100644 --- a/Mapping.h +++ b/Mapping.h @@ -3,6 +3,7 @@ * * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com * (c) 2013 Alexandre Quessy -- alexandre(@)quessy(.)net + * (c) 2016 Dame Diongue -- baydamd(@)gmail(.)com * * 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 diff --git a/OutputGLCanvas.cpp b/OutputGLCanvas.cpp index ef94103..1620cfb 100644 --- a/OutputGLCanvas.cpp +++ b/OutputGLCanvas.cpp @@ -3,6 +3,7 @@ * * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com * (c) 2013 Alexandre Quessy -- alexandre(@)quessy(.)net + * (c) 2014 Dame Diongue -- baydamd(@)gmail(.)com * * 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 @@ -28,7 +29,8 @@ OutputGLCanvas::OutputGLCanvas(MainWindow* mainWindow, QWidget* parent, const QG _displayCrosshair(false), _displayTestSignal(false), _svg_test_signal(":/test-signal"), - _brush_test_signal(_svg_test_signal) + _brush_test_signal(_svg_test_signal), + _palTestCard(":/pal-test-card") { // Disable scrollbars. setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -46,10 +48,25 @@ void OutputGLCanvas::drawForeground(QPainter *painter , const QRectF &rect) { if (_displayTestSignal) { + // Draw the preferred signal test card + QSettings settings; + int testCard = settings.value("signalTestCard", MM::DEFAULT_TEST_CARD).toInt(); glPushMatrix(); painter->translate(rect.x(), rect.y()); painter->save(); - _drawTestSignal(painter); + switch (testCard) { + case MM::Classic: + _drawTestSignal(painter); + break; + case MM::PAL: + _drawPALTestCard(painter); + break; + case MM::NTSC: + _drawNTSCTestCard(painter); + break; + default: // Do nothing; + break; + } painter->restore(); glPopMatrix(); } @@ -75,38 +92,152 @@ void OutputGLCanvas::drawForeground(QPainter *painter , const QRectF &rect) void OutputGLCanvas::_drawTestSignal(QPainter* painter) { const QRect& geo = geometry(); - painter->setPen(MM::CONTROL_COLOR); - int rect_size = 10; - QColor color_0(191, 191, 191); - QColor color_1(128, 128, 128); - QBrush brush_0(color_0); - QBrush brush_1(color_1); + int width = geo.width(); + int height = geo.height(); + int rectSize = 10; + QColor darkerGray(191, 191, 191); + QColor darkGray(Qt::darkGray); painter->setPen(Qt::NoPen); // Draw checkerboard pattern. - for (int x = geo.x(); x < geo.width(); x += rect_size) + for (int x = geo.x(); x < width; x += rectSize) { - for (int y = geo.y(); y < geo.height(); y += rect_size) + for (int y = geo.y(); y < height; y += rectSize) { if (((x + y) % 20) == 0) { - painter->setBrush(brush_0); + painter->setBrush(darkerGray); } else { - painter->setBrush(brush_1); + painter->setBrush(darkGray); } - painter->drawRect(x, y, rect_size, rect_size); + painter->drawRect(x, y, rectSize, rectSize); } } // Create responsive image - QImage test_signal = _svg_test_signal.scaled(geo.height(), geo.height(), Qt::KeepAspectRatio); - // Set new brush - this->_brush_test_signal = QBrush(test_signal); - // Center the brush - painter->translate((geo.width() - test_signal.width()) / 2, (geo.height() - test_signal.height()) / 2); - // Draw the actual brush. - painter->fillRect(0, 0, test_signal.width(), test_signal.height(), this->_brush_test_signal); + QImage image = _svg_test_signal.scaled(height, height, Qt::KeepAspectRatio, Qt::SmoothTransformation); + int imageX = (width - image.width()) / 2; + int imageY = (height - image.height()) / 2; + + // Draw the image. + painter->drawImage(imageX, imageY, image); +} + +void OutputGLCanvas::_drawPALTestCard(QPainter* painter) +{ + const QRect& geo = geometry(); + int width = geo.width(); + int height = geo.height(); + int rectSize = 85; + int marginX = (rectSize - width % rectSize) / 2; + int marginY = (rectSize - height % rectSize) / 2; + QColor black(Qt::black); + QColor white(Qt::white); + QColor darkGray(Qt::darkGray); + + // Draw checkerboard pattern. + for (int x = geo.x(); x < width; x += rectSize) + { + for (int y = geo.y(); y < height; y += rectSize) + { + painter->setPen(Qt::NoPen); + if (((x + y) % (rectSize * 2)) == 0) + { + painter->setBrush(QBrush(white)); + } else { + painter->setBrush(QBrush(black)); + } + + if ((x > 0 && x <= (width - rectSize)) && (y > 0 && y <= (height - rectSize))) { + painter->setBrush(QBrush(darkGray)); + painter->setPen(QPen(QBrush(white), 3)); + } + + painter->drawRect(x - marginX, y - marginY, rectSize, rectSize); + } + } + + // Create responsive image + QImage image = _palTestCard.scaled(height - (rectSize * 2), height - (rectSize * 2), + Qt::KeepAspectRatio, Qt::SmoothTransformation); + // Draw image + int imageX = (width - image.width()) / 2; + int imageY = (height - image.height()) / 2; + int imageWidth = image.width(); + int imageHeight = image.height(); + painter->drawImage(imageX, imageY, image); + // Draw text for screen resolution + int fontSize = imageHeight / 20; + QRect textRect((width / 2) - (fontSize * 3), imageY + (imageHeight / 13), fontSize * 6, fontSize); + _drawResolutionText(painter, textRect, fontSize); +} + +void OutputGLCanvas::_drawNTSCTestCard(QPainter* painter) +{ + const QRect& geo = geometry(); + int width = geo.width(); + int height = geo.height(); + QList colors; + QColor white(Qt::white); + QColor yellow(Qt::yellow); + QColor cyan(Qt::cyan); + QColor green(Qt::green); + QColor magenta(Qt::magenta); + QColor red(Qt::red); + QColor blue(Qt::blue); + QColor black(Qt::black); + + colors.push_back(white); + colors.push_back(yellow); + colors.push_back(cyan); + colors.push_back(green); + colors.push_back(magenta); + colors.push_back(red); + colors.push_back(blue); + colors.push_back(black); + + const int bandWidth = width / colors.size(); + + painter->setPen(Qt::NoPen); + + // Draw checkerboard pattern. + for (int x = 0; x < width / bandWidth; x++) + { + painter->setBrush(colors.at(x)); + painter->drawRect(x * bandWidth, 0, bandWidth, height); + } + + // Create responsive image +// QImage image = _palTestCard.scaled(height - (rectSize * 2), height - (rectSize * 2), +// Qt::KeepAspectRatio, Qt::SmoothTransformation); +// // Draw image +// int imageX = (width - image.width()) / 2; +// int imageY = (height - image.height()) / 2; +// int imageWidth = image.width(); +// int imageHeight = image.height(); +// painter->drawImage(imageX, imageY, image); + // Draw text for screen resolution + int fontSize = height / 30; + QRect textRect((width / 2) - (fontSize * 3), height / 3, fontSize * 6, fontSize); + _drawResolutionText(painter, textRect, fontSize); +} + +void OutputGLCanvas::_drawResolutionText(QPainter *painter, const QRect &rect, int fontSize) +{ + QSettings settings; + + if (settings.value("showResolution").toBool()) + { + painter->fillRect(rect, Qt::black); + QFont font = painter->font(); + font.setPixelSize(fontSize); + painter->setFont(font); + painter->setPen(Qt::white); + painter->drawText(rect, Qt::AlignCenter, + QString::number(geometry().width()) + + " x " + QString::number(geometry().height())); + } } void OutputGLCanvas::resizeGL(int width, int height) diff --git a/OutputGLCanvas.h b/OutputGLCanvas.h index 10c4e95..9c54b61 100644 --- a/OutputGLCanvas.h +++ b/OutputGLCanvas.h @@ -3,6 +3,7 @@ * * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com * (c) 2013 Alexandre Quessy -- alexandre(@)quessy(.)net + * (c) 2014 Dame Diongue -- baydamd(@)gmail(.)com * * 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 @@ -50,11 +51,16 @@ public: private: void _drawTestSignal(QPainter* painter); + void _drawPALTestCard(QPainter *painter); + void _drawNTSCTestCard(QPainter *painter); + + void _drawResolutionText(QPainter *painter, const QRect &rect, int fontSize); bool _displayCrosshair; bool _displayTestSignal; QImage _svg_test_signal; QBrush _brush_test_signal; + QImage _palTestCard; protected: // overriden from QGlWidget: diff --git a/PreferenceDialog.cpp b/PreferenceDialog.cpp new file mode 100644 index 0000000..3bbcfe6 --- /dev/null +++ b/PreferenceDialog.cpp @@ -0,0 +1,415 @@ +/* + * PreferenceDialog.cpp + * + * (c) 2014 Sofian Audry -- info(@)sofianaudry(.)com + * (c) 2014 Alexandre Quessy -- alexandre(@)quessy(.)net + * (c) 2016 Dame Diongue -- baydamd(@)gmail(.)com + * + * 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 . + */ + +#include "PreferenceDialog.h" + +MM_BEGIN_NAMESPACE + +PreferenceDialog::PreferenceDialog(QWidget* parent) : + QDialog(parent) +{ + // configure size + resize(PREFERENCES_WINDOW_WIDTH, PREFERENCES_WINDOW_HEIGHT); + setMinimumSize(PREFERENCES_WINDOW_WIDTH, PREFERENCES_WINDOW_HEIGHT); + + // Create different pages + createInterfacePage(); + createMappingPage(); + createOutputPage(); + createControlsPage(); + createAdvancedPage(); + + // | Cancel || OK | + _buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok + | QDialogButtonBox::Cancel); + + // Preferences list + createPreferencesList(); + + // Rearrange position + QGridLayout *mainLayout = new QGridLayout; + mainLayout->setColumnStretch(0, 1); + mainLayout->setColumnStretch(1, 3); + mainLayout->addWidget(_listWidget, 0, 0); + mainLayout->addLayout(_stackedLayout, 0, 1); + mainLayout->addWidget(_buttonBox, 1, 0, 1, 2); + setLayout(mainLayout); + + connect(_buttonBox, SIGNAL(accepted()), this, SLOT(accept())); + connect(_buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + + setWindowTitle(tr("Preferences")); + _listWidget->setCurrentRow(0); +} + +PreferenceDialog::~PreferenceDialog() +{ + +} + +void PreferenceDialog::showDialog() +{ + exec(); +} + +void PreferenceDialog::closeEvent(QCloseEvent *event) +{ + emit closed(); + event->accept(); +} + +void PreferenceDialog::accept() +{ + applySettings(); + QDialog::accept(); +} + +void PreferenceDialog::reject() +{ + close(); +} + +int PreferenceDialog::exec() +{ + // Make sure settings is loaded + if (!loadSettings()) + return QDialog::Rejected; + + return QDialog::exec(); +} + +bool PreferenceDialog::loadSettings() +{ + QSettings settings; + // Listening port + _listenPortNumber->setValue(settings.value("oscListeningPort", MM::DEFAULT_OSC_PORT).toInt()); + // Sticky vertices enabled + _stickyVerticesBox->setChecked(settings.value("stickyVertices", MM::STICKY_VERTICES).toBool()); + // Sticky vertices radius + _stickyRadiusBox->setCurrentText(settings.value("vertexStickRadius", MM::VERTEX_STICK_RADIUS).toString()); + // Show screen resolution on output + _showResolutionBox->setChecked(settings.value("showResolution", MM::SHOW_OUTPUT_RESOLUTION).toBool()); + // Set preferred test signal pattern + _radioGroup.at(settings.value("signalTestCard", MM::DEFAULT_TEST_CARD).toInt())->setChecked(true); + // Set toolbar icon size + _toolbarIconSizeBox->setCurrentIndex(_toolbarIconSizeBox->findData( + settings.value("toolbarIconSize", MM::TOOLBAR_ICON_SIZE))); + // Set language + _languageBox->setCurrentIndex(_languageBox->findData(settings.value("language", MM::DEFAULT_LANGUAGE))); + + return true; +} + +void PreferenceDialog::applySettings() +{ + QSettings settings; + MainWindow *mainWindow = MainWindow::window(); + // Listen port + settings.setValue("oscListeningPort", _listenPortNumber->value()); + mainWindow->setOscPort(settings.value("oscListeningPort").toInt()); + // Sticky vertices enabled + settings.setValue("stickyVertices", _stickyVerticesBox->isChecked()); + // Sticky vertices radius + settings.setValue("vertexStickRadius", _stickyRadiusBox->currentText()); + // Show screen resolution on output + settings.setValue("showResolution", _showResolutionBox->isChecked()); + // Set preferred test signal pattern + foreach (QRadioButton *radio, _radioGroup) { + if (radio->isChecked()) { + settings.setValue("signalTestCard", _radioGroup.indexOf(radio)); + break; + } + } + // Set toolbar icon size + settings.setValue("toolbarIconSize", _toolbarIconSizeBox->currentData()); + // Set language + settings.setValue("language", _languageBox->currentData()); +} + +void PreferenceDialog::refreshCurrentIP() +{ + foreach (const QHostAddress &address, QNetworkInterface::allAddresses()) { + if (address.protocol() == QAbstractSocket::IPv4Protocol + && address != QHostAddress(QHostAddress::LocalHost)) + _machineAddressLabel->setText(address.toString()); + } +} + +void PreferenceDialog::createInterfacePage() +{ + _interfacePage = new QWidget; + + // Create language box + createLanguageList(); + + _toolbarIconSizeBox = new QComboBox; + _toolbarIconSizeBox->addItem(tr("Large"), 64); + _toolbarIconSizeBox->addItem(tr("Medium"), 48); + _toolbarIconSizeBox->addItem(tr("Small"), 32); + + QFormLayout *languageForm = new QFormLayout; + languageForm->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint); + languageForm->addRow(tr("Language (requires restart)"), _languageBox); + + QFormLayout *toolbarIconSizeForm = new QFormLayout; + toolbarIconSizeForm->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint); + toolbarIconSizeForm->addRow(tr("Toolbar icon size (requires restart)"), _toolbarIconSizeBox); + + QVBoxLayout *interfaceLayout = new QVBoxLayout; + interfaceLayout->addLayout(languageForm); + interfaceLayout->addLayout(toolbarIconSizeForm); + + _interfacePage->setLayout(interfaceLayout); +} + +void PreferenceDialog::createMappingPage() +{ + _mappingPage = new QWidget; + QMargins marginLeft(40, 0, 0, 0); + + // Vertex + _stickyVerticesBox = new QCheckBox(tr("Enable Sticky vertices")); + + _stickyRadiusBox = new QComboBox; + QStringList stickList; + for (int i(1); i <= 10; ++i) + stickList.append(QString::number(i * 10)); + _stickyRadiusBox->addItems(stickList); + // Enable box only if sticky vertices is enabled + connect(_stickyVerticesBox, SIGNAL(toggled(bool)), _stickyRadiusBox, SLOT(setEnabled(bool))); + + QFormLayout *stickRadiusForm = new QFormLayout; + stickRadiusForm->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint); + stickRadiusForm->setContentsMargins(marginLeft); + stickRadiusForm->addRow(tr("Sensitivity"), _stickyRadiusBox); + + QGroupBox *vertexGroupBox = new QGroupBox(tr("Vertex")); + + QVBoxLayout *vertexLayout = new QVBoxLayout; + vertexLayout->addWidget(_stickyVerticesBox); + vertexLayout->addLayout(stickRadiusForm); + + vertexGroupBox->setLayout(vertexLayout); + + // Shape + QGroupBox *shapeGroupBox = new QGroupBox(tr("Shape")); + + // Mapping + QGroupBox *layerGroupBox = new QGroupBox(tr("Layers")); + + QVBoxLayout *pageLayout = new QVBoxLayout; + pageLayout->addWidget(vertexGroupBox); + pageLayout->addWidget(shapeGroupBox); + pageLayout->addWidget(layerGroupBox); + + _mappingPage->setLayout(pageLayout); +} + +void PreferenceDialog::createOutputPage() +{ + _outputPage = new QWidget; + + _showResolutionBox = new QCheckBox(tr("Show resolution on output")); + + _classicRadio = new QRadioButton(tr("Classic test card")); + _palTestRadio = new QRadioButton(tr("PAL test card")); + _ntscTestRadio = new QRadioButton(tr("NTSC test card")); + + _radioGroup.append(_classicRadio); + _radioGroup.append(_palTestRadio); + _radioGroup.append(_ntscTestRadio); + + _classicTestImg = new QLabel; + _palTestImg = new QLabel; + _ntscTestImg = new QLabel; + + _classicTestImg->setPixmap(QPixmap(":/classic-test")); + _palTestImg->setPixmap(QPixmap(":/pal-test")); + _ntscTestImg->setPixmap(QPixmap(":/ntsc-test")); + + QGridLayout *testLayout = new QGridLayout; + testLayout->setContentsMargins(0, 0, 0, 0); + testLayout->addWidget(_classicTestImg, 0, 0); + testLayout->addWidget(_palTestImg, 0, 1); + testLayout->addWidget(_ntscTestImg, 0, 2); + testLayout->addWidget(_classicRadio, 1, 0); + testLayout->addWidget(_palTestRadio, 1, 1); + testLayout->addWidget(_ntscTestRadio, 1, 2); + + QVBoxLayout *outputLayout = new QVBoxLayout; + outputLayout->addWidget(_showResolutionBox); + outputLayout->addSpacing(30); + outputLayout->addLayout(testLayout); + outputLayout->addStretch(); + + _outputPage->setLayout(outputLayout); +} + +void PreferenceDialog::createControlsPage() +{ + _controlsPage = new QTabWidget; + + // Osc Tab + _oscWidget = new QWidget; + + QFont bold; + bold.setWeight(QFont::Bold); + // Set IP Address validator + QString octet("(?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])"); + QRegExp rx(octet + "\\." + octet + "\\." + octet + "\\." + octet); + QRegExpValidator *ipValidator = new QRegExpValidator(rx); + QMargins margins(40, 0, 0, 0); + + _sendMessageBox = new QCheckBox; + _sendMessageBox->setFont(bold); + _sendMessageBox->setText(tr("Send OSC messages")); + _sendMessageBox->setEnabled(false); // Disable until supported + + _sendAddressEdit = new QLineEdit; + _sendAddressEdit->setValidator(ipValidator); + _sendAddressEdit->setEnabled(false); // Disable until supported + + _sendPortNumber = new QSpinBox; + _sendPortNumber->setRange(1024, 65534); + _sendPortNumber->setFixedWidth(120); + _sendPortNumber->setEnabled(false); // Disable until supported + + QFormLayout *sendMessageForm = new QFormLayout; + sendMessageForm->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint); + sendMessageForm->setContentsMargins(margins); + sendMessageForm->addRow(tr("to machine"), _sendAddressEdit); + sendMessageForm->addRow(tr("at port"), _sendPortNumber); + + _listenMessageBox = new QCheckBox; + _listenMessageBox->setFont(bold); + _listenMessageBox->setText(tr("Listen OSC messages")); + _listenMessageBox->setChecked(true); // TODO: Give the choice to the user + + _listenPortNumber = new QSpinBox; + _listenPortNumber->setRange(1024, 65534); + _listenPortNumber->setFixedWidth(120); + + QFormLayout *listenPortForm = new QFormLayout; + listenPortForm->setContentsMargins(margins); + listenPortForm->addRow(tr("on port"), _listenPortNumber); + + _machineAddressLabel = new QLabel; + _ipRefreshButton = new QPushButton(tr("Refresh")); + connect(_ipRefreshButton, SIGNAL(clicked()), this, SLOT(refreshCurrentIP())); + + QHBoxLayout *listenAddressLayout = new QHBoxLayout; + listenAddressLayout->addWidget(_machineAddressLabel); + listenAddressLayout->addWidget(_ipRefreshButton); + + QFormLayout *listenAddressForm = new QFormLayout; + listenAddressForm->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint); + listenAddressForm->setFormAlignment(Qt::AlignCenter); + listenAddressForm->addRow(tr("Local IP"), listenAddressLayout); + + QVBoxLayout *oscLayout = new QVBoxLayout; + oscLayout->addWidget(_sendMessageBox, 1); + oscLayout->addLayout(sendMessageForm, 4); + oscLayout->addWidget(_listenMessageBox, 1); + oscLayout->addLayout(listenPortForm, 1); + oscLayout->addLayout(listenAddressForm, 3); + + _oscWidget->setLayout(oscLayout); + + _controlsPage->addTab(_oscWidget, tr("OSC Setup")); + + refreshCurrentIP(); +} + +void PreferenceDialog::createAdvancedPage() +{ + _advancedPage = new QTabWidget; +} + +void PreferenceDialog::createPreferencesList() +{ + // Apparence Item + QListWidgetItem *interfaceItem = new QListWidgetItem(QIcon(":/add-color"), tr("Interface")); + + // Mapping & Shape Item + QListWidgetItem *shapeItem = new QListWidgetItem(QIcon(":/control-points"), tr("Mapping & Shape")); + + // Output Item + QListWidgetItem *outputItem = new QListWidgetItem(QIcon(":/output-window"), tr("Output")); + + // Controls Item + QListWidgetItem *controlsItem = new QListWidgetItem(QIcon(":/preferences"), tr("Controls")); + + // Advanced Item + QListWidgetItem *advancedItem = new QListWidgetItem(QIcon(":/preferences"), tr("Advanced")); + + // Add items in the list + _listWidget = new QListWidget; + _listWidget->addItem(interfaceItem); + _listWidget->addItem(shapeItem); + _listWidget->addItem(outputItem); + _listWidget->addItem(controlsItem); + _listWidget->addItem(advancedItem); + + for (int i = 0; i < _listWidget->count(); i++) { + QListWidgetItem *item = _listWidget->item(i); + item->setSizeHint(QSize(item->sizeHint().width(), PreferenceDialog::LIST_ITEM_HEIGHT)); + } + + // Add pages in the stacked layout + _stackedLayout = new QStackedLayout; + _stackedLayout->addWidget(_interfacePage); + _stackedLayout->addWidget(_mappingPage); + _stackedLayout->addWidget(_outputPage); + _stackedLayout->addWidget(_controlsPage); + _stackedLayout->addWidget(_advancedPage); + // Sync list and pages + connect(_listWidget, SIGNAL(currentRowChanged(int)), _stackedLayout, SLOT(setCurrentIndex(int))); +} + +void PreferenceDialog::createLanguageList() +{ + _languageBox = new QComboBox; + + // format systems language + QString defaultLocale = QLocale::system().name(); + defaultLocale.truncate(defaultLocale.lastIndexOf('_')); + + _languageBox->addItem("System default", defaultLocale); + + QString translationPath = QApplication::applicationDirPath().append("/translations"); + QDir dir(translationPath); + QStringList translations = dir.entryList(QStringList("mapmap_*.qm")); + + for (int i(0); i < translations.size(); i++) { + // get locale extracted by filename + QString locale; + locale = translations[i]; // mapmap_fr.qm + locale.truncate(locale.lastIndexOf('.')); // mapmap_fr + locale.remove(0, locale.indexOf('_') + 1); // fr + + QString lang = QLocale::languageToString(QLocale(locale).language()); + + _languageBox->addItem(QString("%1 (%2)").arg(lang).arg(locale), locale); + } +} + + +MM_END_NAMESPACE diff --git a/PreferenceDialog.h b/PreferenceDialog.h new file mode 100644 index 0000000..0143efb --- /dev/null +++ b/PreferenceDialog.h @@ -0,0 +1,124 @@ +/* + * PreferenceDialog.h + * + * (c) 2014 Sofian Audry -- info(@)sofianaudry(.)com + * (c) 2014 Alexandre Quessy -- alexandre(@)quessy(.)net + * (c) 2016 Dame Diongue -- baydamd(@)gmail(.)com + * + * 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 . + */ + +#ifndef PREFERENCEDIALOG_H_ +#define PREFERENCEDIALOG_H_ + +#include +#include + +#include "MainWindow.h" + +MM_BEGIN_NAMESPACE + +class PreferenceDialog : public QDialog +{ + Q_OBJECT + +public: + PreferenceDialog(QWidget* parent = 0); + + ~PreferenceDialog(); + + void showDialog(); + +protected: + void closeEvent(QCloseEvent* event); + bool loadSettings(); + +signals: + void closed(); + +private slots: + void accept(); + void reject(); + int exec(); + + void applySettings(); + void refreshCurrentIP(); + +private: + // Reset port number + void updatePortNumber(); + // Create categories pages + void createInterfacePage(); + void createMappingPage(); + void createOutputPage(); + void createControlsPage(); + void createAdvancedPage(); + + // Create List + void createPreferencesList(); + + // Create pages widgets + QWidget *_interfacePage; + QWidget *_mappingPage; + QWidget *_outputPage; + QTabWidget *_controlsPage; + QWidget *_advancedPage; + + // Interface widgets + QComboBox *_languageBox; + void createLanguageList(); + QComboBox *_toolbarIconSizeBox; + + // Shape widgets + // Sticky vertices + QCheckBox *_stickyVerticesBox; + QComboBox *_stickyRadiusBox; + + // Output widgets + QCheckBox *_showResolutionBox; + QRadioButton *_classicRadio; + QRadioButton *_palTestRadio; + QRadioButton *_ntscTestRadio; + QList _radioGroup; + QLabel *_classicTestImg; + QLabel *_palTestImg; + QLabel *_ntscTestImg; + + // Controls widgets + // OSC + QWidget *_oscWidget; + QCheckBox *_sendMessageBox; + QCheckBox *_listenMessageBox; + QLineEdit *_sendAddressEdit; + QSpinBox *_sendPortNumber; + QLabel *_machineAddressLabel; + QSpinBox *_listenPortNumber; + QPushButton *_ipRefreshButton; + + // Advanced widgets + + // Common widgets + QListWidget *_listWidget; + QStackedLayout *_stackedLayout; + QDialogButtonBox* _buttonBox; + + // Constantes + static const int PREFERENCES_WINDOW_WIDTH = 720; + static const int PREFERENCES_WINDOW_HEIGHT = 540; + static const int LIST_ITEM_HEIGHT = 36; +}; + +MM_END_NAMESPACE + +#endif /* PREFERENCESDIALOG_H_ */ diff --git a/PreferencesDialog.cpp b/PreferencesDialog.cpp deleted file mode 100644 index 05e88e8..0000000 --- a/PreferencesDialog.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * OutputGLWindow.cpp - * - * (c) 2014 Sofian Audry -- info(@)sofianaudry(.)com - * (c) 2014 Alexandre Quessy -- alexandre(@)quessy(.)net - * - * 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 . - */ - -#include "PreferencesDialog.h" -#include "MainWindow.h" -#include - -MM_BEGIN_NAMESPACE - -PreferencesDialog::PreferencesDialog(MainWindow* mainWindow, QWidget* parent) : - QDialog(parent) -{ - _main_window = mainWindow; - // static const int width = 600; - // static const int height = 400; - // resize(MainWindow::OUTPUT_WINDOW_MINIMUM_WIDTH, MainWindow::OUTPUT_WINDOW_MINIMUM_HEIGHT); - - // OSC port number - QLabel* osc_port_label = new QLabel(tr("OSC port number")); - - _osc_port_numbox = new QSpinBox; - _osc_port_numbox->setRange(1024, 65534); - - QLayout* hbox_osc_port = new QHBoxLayout; - hbox_osc_port->addWidget(osc_port_label); - hbox_osc_port->addWidget(_osc_port_numbox); - - // cancel / ok - _button_box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - connect(_button_box, SIGNAL(accepted()), this, SLOT(accept_cb())); - connect(_button_box, SIGNAL(rejected()), this, SLOT(reject_cb())); - - //QLayout* hbox_confirm = new QHBoxLayout; - //hbox_confirm->addWidget(_button_box); - hbox_osc_port->addWidget(_button_box); - - // pack all rows - //QLayout* vbox = new QVBoxLayout; - //vbox->addWidget(hbox_osc_port); - setLayout(hbox_osc_port); - - this->resetValues(); -} - -void PreferencesDialog::closeEvent(QCloseEvent *event) -{ - emit closed(); - event->accept(); -} - -void PreferencesDialog::reject_cb() -{ - this->resetValues(); - this->setResult(QMessageBox::Cancel); - this->close(); -} - -void PreferencesDialog::resetValues() -{ - this->_osc_port_numbox->setValue(this->_main_window->getOscPort()); -} - -void PreferencesDialog::accept_cb() -{ - qDebug() << "Values:" << " osc port=" << _osc_port_numbox->value() << endl; - this->_main_window->setOscPort(this->_osc_port_numbox->value()); - this->setResult(QMessageBox::Ok); - this->close(); -} - - -MM_END_NAMESPACE diff --git a/PreferencesDialog.h b/PreferencesDialog.h deleted file mode 100644 index 62867ac..0000000 --- a/PreferencesDialog.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * OutputGLWindow.h - * - * (c) 2014 Sofian Audry -- info(@)sofianaudry(.)com - * (c) 2014 Alexandre Quessy -- alexandre(@)quessy(.)net - * - * 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 . - */ - -#ifndef PREFERENCESDIALOG_H_ -#define PREFERENCESDIALOG_H_ - -#include -#include "MM.h" -#include -#include -#include - -MM_BEGIN_NAMESPACE - -class MainWindow; - -class PreferencesDialog : public QDialog -{ - Q_OBJECT - -public: - PreferencesDialog(MainWindow* mainWindow, QWidget* parent = 0); - -protected: - void closeEvent(QCloseEvent* event); - -signals: - void closed(); - -private slots: - void accept_cb(); - void reject_cb(); - -private: - QSpinBox* _osc_port_numbox; - MainWindow* _main_window; - QDialogButtonBox* _button_box; - void resetValues(); -}; - -MM_END_NAMESPACE - -#endif /* PREFERENCESDIALOG_H_ */ diff --git a/ShapeGraphicsItem.cpp b/ShapeGraphicsItem.cpp index ec3c2a9..5826c65 100644 --- a/ShapeGraphicsItem.cpp +++ b/ShapeGraphicsItem.cpp @@ -3,6 +3,7 @@ * * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com * (c) 2013 Alexandre Quessy -- alexandre(@)quessy(.)net + * (c) 2016 Dame Diongue -- baydamd(@)gmail(.)com * * 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 @@ -32,16 +33,16 @@ ShapeGraphicsItem::ShapeGraphicsItem(Mapping::ptr mapping, bool output) MapperGLCanvas* ShapeGraphicsItem::getCanvas() const { - MainWindow* win = MainWindow::instance(); + MainWindow* win = MainWindow::window(); return isOutput() ? win->getDestinationCanvas() : win->getSourceCanvas(); } bool ShapeGraphicsItem::isMappingCurrent() const { - return MainWindow::instance()->getCurrentMappingId() == getMapping()->getId(); + return MainWindow::window()->getCurrentMappingId() == getMapping()->getId(); } bool ShapeGraphicsItem::isMappingVisible() const { - return MainWindow::instance()->getMappingManager().mappingIsVisible(getMapping()); + return MainWindow::window()->getMappingManager().mappingIsVisible(getMapping()); } void ShapeGraphicsItem::paint(QPainter *painter, diff --git a/ShapeGraphicsItem.h b/ShapeGraphicsItem.h index 7f2ec67..1ee23df 100644 --- a/ShapeGraphicsItem.h +++ b/ShapeGraphicsItem.h @@ -2,6 +2,7 @@ * ShapeGraphicsItem.h * * (c) 2015 Sofian Audry -- info(@)sofianaudry(.)com + * (c) 2016 Dame Diongue -- baydamd(@)gmail(.)com * * 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 diff --git a/main.cpp b/main.cpp index 974f4b6..29f9e0a 100644 --- a/main.cpp +++ b/main.cpp @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) // --lang option QCommandLineOption localeOption(QStringList() << "l" << "lang", - "Use language .", "lang", "en"); + "Use language .", "lang", ""); parser.addOption(localeOption); // --frame-rate option @@ -139,19 +139,27 @@ int main(int argc, char *argv[]) } // IMPORTANT: Translator must be set *before* the MainWindow is created for it to work. - QString langValue = parser.value("lang"); - QTranslator translator; - if (translator.load(QString(":/translation-%1").arg(langValue))) + QSettings settings; + QString lang = parser.value("lang").isEmpty() + ? settings.value("language").toString() + : parser.value("lang"); + if (MM::SUPPORTED_LANGUAGES.contains(lang)) { - qDebug() << "Setting language to " << langValue << "." << endl; - app.installTranslator(&translator); - QLocale::setDefault(QLocale(langValue)); + QLocale::setDefault(QLocale(lang)); + QTranslator qtTranslator; + qtTranslator.load(QString("qtbase_%1").arg(lang), + QLibraryInfo::location(QLibraryInfo::TranslationsPath)); + app.installTranslator(&qtTranslator); + + QTranslator localization; + localization.load(QString(":/mapmap_%1").arg(lang)); + app.installTranslator(&localization); } - else if (langValue != "en") - { - qWarning() << "Unrecognized/unsupported language: " << langValue << "." << endl; + else { + qWarning() << "Unrecognized/unsupported language: " << lang; } + #endif // USING_QT_5 if (! QGLFormat::hasOpenGL()) @@ -174,7 +182,7 @@ int main(int argc, char *argv[]) I::sleep(1); // Create window. - MainWindow* win = MainWindow::instance(); + MainWindow* win = MainWindow::window(); // Add custom font int id = QFontDatabase::addApplicationFont(":/base-font"); QString family = QFontDatabase::applicationFontFamilies(id).at(0); diff --git a/mapmap.pro b/mapmap.pro index 8decc74..db68fc2 100644 --- a/mapmap.pro +++ b/mapmap.pro @@ -3,7 +3,7 @@ TEMPLATE = app # Always use major.minor.micro version number format VERSION = 0.4.1 TARGET = mapmap -QT += gui opengl xml core +QT += gui opengl xml core network greaterThan(QT_MAJOR_VERSION, 4) { QT -= gui # using widgets instead gui in Qt5 QT += widgets multimedia @@ -36,7 +36,7 @@ HEADERS = \ Paint.h \ PaintGui.h \ Polygon.h \ - PreferencesDialog.h \ + PreferenceDialog.h \ ProjectLabels.h \ ProjectReader.h \ ProjectWriter.h \ @@ -78,7 +78,7 @@ SOURCES = \ Paint.cpp \ PaintGui.cpp \ Polygon.cpp \ - PreferencesDialog.cpp \ + PreferenceDialog.cpp \ ProjectLabels.cpp \ ProjectReader.cpp \ ProjectWriter.cpp \ @@ -98,8 +98,11 @@ SOURCES = \ include(contrib/qtpropertybrowser/src/qtpropertybrowser.pri) include(contrib/qtpropertybrowser-extension/qtpropertybrowser-extension.pri) -TRANSLATIONS = resources/texts/mapmap_fr.ts -RESOURCES = mapmap.qrc +TRANSLATIONS = \ + translations/mapmap_en.ts \ + translations/mapmap_fr.ts +RESOURCES = mapmap.qrc \ + translations/translation.qrc # Manage lrelease (for translations) isEmpty(QMAKE_LRELEASE) { diff --git a/mapmap.qrc b/mapmap.qrc index b12de50..b85420e 100644 --- a/mapmap.qrc +++ b/mapmap.qrc @@ -35,10 +35,12 @@ resources/images/icons/small/visible_w.png resources/images/icons/small/duplicate_w.png resources/images/icons/small/solo.png - resources/qss/mapmap.qss resources/fonts/Hack-Regular.otf - - resources/texts/mapmap_fr.qm + resources/images/menu/preferences.png + resources/images/test-signal/pal-test-signal.svg + resources/images/test-signal/examples/classic-test-card.png + resources/images/test-signal/examples/pal-test-card.png + resources/images/test-signal/examples/ntsc-test-card.png diff --git a/resources/texts/mapmap_fr.ts b/resources/texts/mapmap_fr.ts deleted file mode 100644 index 9fda3d4..0000000 --- a/resources/texts/mapmap_fr.ts +++ /dev/null @@ -1,721 +0,0 @@ - - - - - MainWindow - - About MapMap - À propos de MapMap - - - &New - &Nouveau - - - &Open... - &Ouvrir... - - - &Save - &Sauvegarder - - - Save &As... - S&auvegarder sous... - - - E&xit - Quitter - - - Ctrl+Q - - - - Exit the application - Quitter l'application - - - &About - &À propos - - - Show the application's About box - Afficher le dialogue À propos de l'application - - - Add triangle - Ajouter un triangle - - - &File - &Fichier - - - &Help - Aide - - - The document has been modified. -Do you want to save your changes? - Ce document a été modifié. Voulez-vous sauvegarder vos changements? - - - Error reading mapping project file - Erreur de lecture de projet - - - Cannot read file %1: -%2. - Impossible de lire le fichier %1: %2 - - - Parse error in file %1: - -%2 - Erreur de syntaxe dans le fichier %1: %2 - - - File loaded - Fichier chargé - - - Error saving mapping project - Erreur en sauvegardant le fichier de projet - - - Cannot write file %1: -%2. - Impossible d'écrire le fichier %1: %2 - - - File saved - Fichier sauvegardé - - - Untitled - Sans titre - - - %1[*] - %2 - - - - MapMap Project - Projet MapMap - - - File imported - Fichier importé - - - Open project - Ouvrir un projet - - - Save project - Sauvegarder le projet - - - <h2>MapMap - <h2>MapMap - - - MapMap - MapMap - - - Import media source file - Importer un média - - - Remove this paint and all its associated mappings? - Effacer cette peinture et tous les mappings qui y sont associés? - - - Create a new project - Créer un nouveau projet - - - Open an existing project - Ouvrir un projet existant - - - Save the project - Sauvegarder le projet - - - Save the project as... - Sauvegarder le projet sous... - - - &Import media source file... - &Importer un fichier média source... - - - Import a media source file... - Importer un fichier média source... - - - Add &Color paint... - Ajouter une peinture &Couleur... - - - Add a color paint... - Ajouter une peinture Couleur... - - - Delete - Effacer l'élément sélectionné - - - CTRL+DEL - CTRL+SUPPR - - - Delete item - Effacer l'élément sélectionné - - - Add Quad/&Mesh - Ajouter un quadrilatère/&Mesh - - - CTRL+M - CTRL+M - - - Add quad/mesh - Ajouter un quadrilatère/&Mesh - - - Add &Triangle - Ajouter un &Triangle - - - CTRL+T - CTRL+T - - - Add &Ellipse - Ajouter une &Ellipse - - - CTRL+E - CTRL+E - - - Add ellipse - Ajouter une ellipse - - - &Display output window - Afficher la fenêtre de sortie - - - Ctrl+D - CTRL+D - - - Display output window - Afficher la fenêtre de sortie - - - &Full screen - Plein écran - - - Ctrl+F - CTRL+F - - - Full screen - Plein écran - - - &Display canvas controls - Afficher les contrôles du canevas - - - Display canvas controls - Afficher les contrôles du canevas - - - &Edit - Édition - - - &View - Apparence - - - Color paint added - Peinture couleur ajoutée - - - MapMap files (*.%1) - Fichiers MapMap (*.%1) - - - All files (*) - - - - - QObject - - Texture mapping - Mapping texturé - - - Input shape - Forme en entrée - - - Output shape - Forme en sortie - - - Point %1 - - - - Dimensions - - - - %1 -Line %2, column %3 - - - - The file is not a mapmap version 0.1 file. - Ce fichier n'est pas un project MapMap version 0.1. - - - Cannot create media with URI %1. - Impossible de créer un média avec l'URI %1 - - - Cannot create color with RGB hex code %1. - Impossible de créer une couleur avec le code RVB hexadécimal %1 - - - Unsupported paint type: %1. - Type de peinture non-supporté: %1 - - - Cannot create triangle texture mapping - Impossible de créer un mapping de texture vers triangle - - - Cannot create mesh texture mapping - Impossible de créer un mapping de texture vers mesh - - - Cannot create ellipse texture mapping - Impossible de créer un mapping de texture vers ellipse - - - Cannot create triangle color mapping - Impossible de créer un mapping de couleur vers triangle - - - Cannot create quad color mapping - Impossible de créer un mapping de couleur vers quadrilatère - - - Cannot create ellipse color mapping - Impossible de créer un mapping de couleur vers ellipse - - - Unsupported mapping type: %1. - Type de mapping non supporté: %1 - - - Wrong shape type "%1" for destination: expected "%2". - Mauvais type de forme "%1" pour la destination. On s'attend à "%2" - - - Shape of type '%1' has %2 vertices: expected %3. - - - - Shape has %1 vertices: expected 4 or 5. - - - - Wrong shape type for destination: %1. - - - - Shape has wrong number of vertices. - - - - Initiating program... - Lancement du logiciel... - - - Done. - Terminé. - - - Cannot create media with uri %1. - - - - - QtBoolEdit - - True - vrai - - - False - faux - - - - QtBoolPropertyManager - - True - vrai - - - False - faux - - - - QtCharEdit - - Clear Char - Effacer le charactère - - - - QtColorEditWidget - - ... - - - - - QtColorPropertyManager - - Red - Rouge - - - Green - Vert - - - Blue - Bleu - - - Alpha - Transparence - - - - QtCursorDatabase - - Arrow - - - - Up Arrow - - - - Cross - - - - Wait - - - - IBeam - - - - Size Vertical - - - - Size Horizontal - - - - Size Backslash - - - - Size Slash - - - - Size All - - - - Blank - - - - Split Vertical - - - - Split Horizontal - - - - Pointing Hand - - - - Forbidden - - - - Open Hand - - - - Closed Hand - - - - What's This - - - - Busy - - - - - QtFontEditWidget - - ... - - - - Select Font - - - - - QtFontPropertyManager - - Family - - - - Point Size - - - - Bold - - - - Italic - - - - Underline - - - - Strikeout - - - - Kerning - - - - - QtKeySequenceEdit - - Clear Shortcut - - - - - QtLocalePropertyManager - - %1, %2 - - - - Language - - - - Country - - - - - QtPointFPropertyManager - - (%1, %2) - - - - X - - - - Y - - - - - QtPointPropertyManager - - (%1, %2) - - - - X - - - - Y - - - - - QtPropertyBrowserUtils - - [%1, %2, %3] (%4) - - - - [%1, %2] - - - - - QtRectFPropertyManager - - [(%1, %2), %3 x %4] - - - - X - - - - Y - - - - Width - - - - Height - - - - - QtRectPropertyManager - - [(%1, %2), %3 x %4] - - - - X - - - - Y - - - - Width - - - - Height - - - - - QtSizeFPropertyManager - - %1 x %2 - - - - Width - - - - Height - - - - - QtSizePolicyPropertyManager - - <Invalid> - - - - [%1, %2, %3, %4] - - - - Horizontal Policy - - - - Vertical Policy - - - - Horizontal Stretch - - - - Vertical Stretch - - - - - QtSizePropertyManager - - %1 x %2 - - - - Width - - - - Height - - - - - QtTreePropertyBrowser - - Property - - - - Value - - - - diff --git a/translations/mapmap_en.ts b/translations/mapmap_en.ts new file mode 100644 index 0000000..6740f66 --- /dev/null +++ b/translations/mapmap_en.ts @@ -0,0 +1,1450 @@ + + + + + ConsoleWindow + + + Message Log Output - Mapmap + Message Log Output - Mapmap + + + + &Close + &Close + + + + Close the console + Close the console + + + + &File + &File + + + + MMM dd yy HH:mm + MMM dd yy HH:mm + + + + FileEdit + + + Choose a file + Choose a file + + + + ImageGui + + + Image file + Image file + + + + Image files (%1);;All files (*) + Image files (%1);;All files (*) + + + + MainWindow + + + Open project + Open project + + + + + MapMap files (*.%1) + MapMap files (*.%1) + + + + Save project + Save project + + + + Import media source file + Import media source file + + + + Media files (%1 %2);;All files (*) + Media files (%1 %2);;All files (*) + + + + Available camera + Available camera + + + + Select camera + Select camera + + + + No camera available + No camera available + + + + You can not use this feature! +No camera available in your system + You can not use this feature! +No camera available in your system + + + + Select Color + Select Color + + + + About MapMap + About MapMap + + + + <h2><img src=":mapmap-title"/> %1</h2><p>Copyright &copy; 2013 %2.</p><p>MapMap is a free software for video mapping.</p><p>Projection mapping, also known as video mapping and spatial augmented reality, is a projection technology used to turn objects, often irregularly shaped, into a display surface for video projection. These objects may be complex industrial landscapes, such as buildings. By using specialized software, a two or three dimensional object is spatially mapped on the virtual program which mimics the real environment it is to be projected on. The software can interact with a projector to fit any desired image onto the surface of that object. This technique is used by artists and advertisers alike who can add extra dimensions, optical illusions, and notions of movement onto previously static objects. The video is commonly combined with, or triggered by, audio to create an audio-visual narrative.This project was made possible by the support of the International Organization of La Francophonie.</p><p>http://mapmap.info<br />http://www.francophonie.org</p> + <h2><img src=":mapmap-title"/> %1</h2><p>Copyright &copy; 2013 %2.</p><p>MapMap is a free software for video mapping.</p><p>Projection mapping, also known as video mapping and spatial augmented reality, is a projection technology used to turn objects, often irregularly shaped, into a display surface for video projection. These objects may be complex industrial landscapes, such as buildings. By using specialized software, a two or three dimensional object is spatially mapped on the virtual program which mimics the real environment it is to be projected on. The software can interact with a projector to fit any desired image onto the surface of that object. This technique is used by artists and advertisers alike who can add extra dimensions, optical illusions, and notions of movement onto previously static objects. The video is commonly combined with, or triggered by, audio to create an audio-visual narrative.This project was made possible by the support of the International Organization of La Francophonie.</p><p>http://mapmap.info<br />http://www.francophonie.org</p> + + + + + + MapMap + MapMap + + + + Remove this paint and all its associated mappings? + Remove this paint and all its associated mappings? + + + + Paints + Paints + + + + Mappings + Mappings + + + + &New + &New + + + + Create a new project + Create a new project + + + + &Open... + &Open... + + + + Open an existing project + Open an existing project + + + + &Save + &Save + + + + Save the project + Save the project + + + + Save &As... + Save &As... + + + + Save the project as... + Save the project as... + + + + No Recents Videos + No Recents Videos + + + + &Import Media File... + &Import Media File... + + + + Import a video or image file... + Import a video or image file... + + + + Open &Camera Device... + Open &Camera Device... + + + + Choose your camera device... + Choose your camera device... + + + + Add &Color Paint... + Add &Color Paint... + + + + Add a color paint... + Add a color paint... + + + + E&xit + E&xit + + + + Exit the application + Exit the application + + + + &Undo + &Undo + + + + &Redo + &Redo + + + + &About MapMap + &About MapMap + + + + Show the application's About box + Show the application's About box + + + + Duplicate + Duplicate + + + + Duplicate item + Duplicate item + + + + Delete mapping + Delete mapping + + + + + Delete item + Delete item + + + + + Rename + Rename + + + + + Rename item + Rename item + + + + Lock mapping + Lock mapping + + + + Lock mapping item + Lock mapping item + + + + Hide mapping + Hide mapping + + + + Hide mapping item + Hide mapping item + + + + Solo mapping + Solo mapping + + + + solo mapping item + solo mapping item + + + + Delete paint + Delete paint + + + + &Preferences... + &Preferences... + + + + Configure preferences... + Configure preferences... + + + + Add &Mesh + Add &Mesh + + + + Add mesh + Add mesh + + + + Add &Triangle + Add &Triangle + + + + Add triangle + Add triangle + + + + Add &Ellipse + Add &Ellipse + + + + Add ellipse + Add ellipse + + + + + Play + Play + + + + + Pause + Pause + + + + + Rewind + Rewind + + + + Toggle &Fullscreen + Toggle &Fullscreen + + + + Toggle Fullscreen + Toggle Fullscreen + + + + &Display Controls + &Display Controls + + + + Display canvas controls + Display canvas controls + + + + &Display Controls of Mappings of a Paint + &Display Controls of Mappings of a Paint + + + + Display all canvas controls related to current paint + Display all canvas controls related to current paint + + + + &Sticky Vertices + &Sticky Vertices + + + + Enable sticky vertices + Enable sticky vertices + + + + Show &Test Signal + Show &Test Signal + + + + Show Test signal + Show Test signal + + + + Display &Undo Stack + Display &Undo Stack + + + + Open Conso&le + Open Conso&le + + + + Display &Zoom Toolbar + Display &Zoom Toolbar + + + + &Menu Bar + &Menu Bar + + + + Main Perspective + Main Perspective + + + + Switch to the Main perspective. + Switch to the Main perspective. + + + + Source Perspective + Source Perspective + + + + Switch to the Source perspective. + Switch to the Source perspective. + + + + Destination Perspective + Destination Perspective + + + + Switch to the Destination perspective. + Switch to the Destination perspective. + + + + Report bug... + Report bug... + + + + Technical Support + Technical Support + + + + Documentation + Documentation + + + + &File + &File + + + + Open Recents Projects + Open Recents Projects + + + + Open Recents Videos + Open Recents Videos + + + + &Edit + &Edit + + + + &Source + &Source + + + + &Destination + &Destination + + + + &Playback + &Playback + + + + &Output + &Output + + + + &Tools + &Tools + + + + &Window + &Window + + + + Toolbars + Toolbars + + + + &Help + &Help + + + + &Toolbar + &Toolbar + + + + The document has been modified. +Do you want to save your changes? + The document has been modified. +Do you want to save your changes? + + + + + Error reading mapping project file + Error reading mapping project file + + + + + Cannot read file %1: +%2. + Cannot read file %1: +%2. + + + + Parse error in file %1: + +%2 + Parse error in file %1: + +%2 + + + + File loaded + File loaded + + + + Error saving mapping project + Error saving mapping project + + + + Cannot write file %1: +%2. + Cannot write file %1: +%2. + + + + File saved + File saved + + + + Untitled + Untitled + + + + %1[*] - %2 + %1[*] - %2 + + + + + MapMap Project + MapMap Project + + + + + &%1 %2 + &%1 %2 + + + + Clear List + Clear List + + + + No Recents Projects + No Recents Projects + + + + %1 - %2x%3 + %1 - %2x%3 + + + + File imported + File imported + + + + Color paint added + Color paint added + + + + Warning + Warning + + + + The following file is not supported: %1 + The following file is not supported: %1 + + + + Cannot load movie + Cannot load movie + + + + Unable to use the file « %1 » +The original file is not found. Will you locate? + Unable to use the file « %1 » +The original file is not found. Will you locate? + + + + Locate file « %1 » + Locate file « %1 » + + + + %1 files (%2) + %1 files (%2) + + + + Undo stack + Undo stack + + + + MapperGLCanvasToolbar + + + Enlarge the shape + Enlarge the shape + + + + Shrink the shape + Shrink the shape + + + + Reset the shape to the normal size + Reset the shape to the normal size + + + + Fit the shape to content view + Fit the shape to content view + + + + MappingItemDelegate + + + Solo mapping + Solo mapping + + + + Lock mapping + Lock mapping + + + + Duplicate mapping + Duplicate mapping + + + + Delete mapping + Delete mapping + + + + PreferenceDialog + + + Preferences + Preferences + + + + Large + Large + + + + Medium + Medium + + + + Small + Small + + + + Toolbar icon size (requires restart) + Toolbar icon size (requires restart) + + + + Enable Sticky vertices + Enable Sticky vertices + + + + Sensitivity + Sensitivity + + + + Vertex + Vertex + + + + Shape + Shape + + + + Layers + Layers + + + + Show resolution on output + Show resolution on output + + + + Classic test card + Classic test card + + + + PAL test card + PAL test card + + + + NTSC test card + NTSC test card + + + + Send OSC messages + Send OSC messages + + + + to machine + to machine + + + + at port + at port + + + + Listen OSC messages + Listen OSC messages + + + + on port + on port + + + + Refresh + Refresh + + + + Local IP + Local IP + + + + OSC Setup + OSC Setup + + + + Apparence + Apparence + + + + Mapping & Shape + Mapping & Shape + + + + Output + Output + + + + Controls + Controls + + + + Advanced + Advanced + + + + QObject + + + Add paint + Add paint + + + + Add mapping + Add mapping + + + + Duplicate mapping + Duplicate mapping + + + + Move vertex + Move vertex + + + + Move shape + Move shape + + + + Remove paint + + + + + Delete mapping + + + + + Problem at creation of shape. + Problem at creation of shape. + + + + + + Unable to create paint of type '%1'. + Unable to create paint of type '%1'. + + + + Mapping + Mapping + + + + + Opacity (%) + Opacity (%) + + + + Output shape + Output shape + + + + Point %1 + Point %1 + + + + + Dimensions + Dimensions + + + + Input shape + Input shape + + + + Paint + Paint + + + + Color + Color + + + + The file is not a mapmap version %1 file. + + + + + %1 +Line %2, column %3 + %1 +Line %2, column %3 + + + + Problem at creation of paint. + Problem at creation of paint. + + + + Problem at creation of mapping. + Problem at creation of mapping. + + + + Initiating program... + Initiating program... + + + + Done. + Done. + + + + QtBoolEdit + + + + + True + + + + + + False + False + + + + QtBoolPropertyManager + + + True + True + + + + False + False + + + + QtCharEdit + + + Clear Char + Clear Char + + + + QtColorEditWidget + + + ... + ... + + + + QtColorPropertyManager + + + Red + Red + + + + Green + Green + + + + Blue + Blue + + + + Alpha + Alpha + + + + QtCursorDatabase + + + Arrow + Arrow + + + + Up Arrow + Up Arrow + + + + Cross + Cross + + + + Wait + + + + + IBeam + IBeam + + + + Size Vertical + Size Vertical + + + + Size Horizontal + Size Horizontal + + + + Size Backslash + Size Backslash + + + + Size Slash + Size Slash + + + + Size All + Size All + + + + Blank + Blank + + + + Split Vertical + Split Vertical + + + + Split Horizontal + Split Horizontal + + + + Pointing Hand + Pointing Hand + + + + Forbidden + Forbidden + + + + Open Hand + Open Hand + + + + Closed Hand + Closed Hand + + + + What's This + What's This + + + + Busy + Busy + + + + QtFontEditWidget + + + ... + ... + + + + Select Font + Select Font + + + + QtFontPropertyManager + + + Family + Family + + + + Point Size + Point Size + + + + Bold + Bold + + + + Italic + Italic + + + + Underline + Underline + + + + Strikeout + Strikeout + + + + Kerning + Kerning + + + + QtKeySequenceEdit + + + Clear Shortcut + + + + + QtLocalePropertyManager + + + %1, %2 + %1, %2 + + + + Language + Language + + + + Country + Country + + + + QtPointFPropertyManager + + + (%1, %2) + (%1, %2) + + + + X + X + + + + Y + Y + + + + QtPointPropertyManager + + + (%1, %2) + (%1, %2) + + + + X + X + + + + Y + Y + + + + QtPropertyBrowserUtils + + + [%1, %2, %3] (%4) + [%1, %2, %3] (%4) + + + + [%1, %2] + [%1, %2] + + + + QtRectFPropertyManager + + + [(%1, %2), %3 x %4] + [(%1, %2), %3 x %4] + + + + X + X + + + + Y + Y + + + + Width + Width + + + + Height + Height + + + + QtRectPropertyManager + + + [(%1, %2), %3 x %4] + [(%1, %2), %3 x %4] + + + + X + X + + + + Y + Y + + + + Width + Width + + + + Height + Height + + + + QtSizeFPropertyManager + + + %1 x %2 + %1 x %2 + + + + Width + Width + + + + Height + Height + + + + QtSizePolicyPropertyManager + + + + <Invalid> + <Invalid> + + + + [%1, %2, %3, %4] + [%1, %2, %3, %4] + + + + Horizontal Policy + Horizontal Policy + + + + Vertical Policy + Vertical Policy + + + + Horizontal Stretch + Horizontal Stretch + + + + Vertical Stretch + Vertical Stretch + + + + QtSizePropertyManager + + + %1 x %2 + %1 x %2 + + + + Width + Width + + + + Height + Height + + + + QtTreePropertyBrowser + + + Property + Property + + + + Value + Value + + + + VideoGui + + + Video file + Video file + + + + Video files (%1);;All files (*) + Video files (%1);;All files (*) + + + + Speed (%) + Speed (%) + + + + Volume (%) + Volume (%) + + + diff --git a/translations/mapmap_fr.ts b/translations/mapmap_fr.ts new file mode 100644 index 0000000..077a7ed --- /dev/null +++ b/translations/mapmap_fr.ts @@ -0,0 +1,1290 @@ + + + + + ConsoleWindow + + Message Log Output - Mapmap + Registre des message - MapMap + + + &Close + &Fermer + + + Close the console + Fermer la console + + + &File + &Fichier + + + MMM dd yy HH:mm + dd MMM yy HH:mm + + + + FileEdit + + Choose a file + Choisir une fichier + + + + ImageGui + + Image file + Image + + + Image files (%1);;All files (*) + Images (%1);;Tous les fichiers (*) + + + + MainWindow + + About MapMap + À propos de MapMap + + + &New + &Nouveau + + + &Open... + &Ouvrir... + + + &Save + &Sauvegarder + + + Save &As... + S&auvegarder sous... + + + E&xit + &Quitter + + + Exit the application + Quitter l'application + + + &About + &À propos + + + Show the application's About box + Afficher le dialogue À propos de l'application + + + Add triangle + Ajouter un triangle + + + &File + &Fichier + + + &Help + &Aide + + + The document has been modified. +Do you want to save your changes? + Ce document a été modifié. Voulez-vous sauvegarder vos changements? + + + Error reading mapping project file + Erreur de lecture de projet + + + Cannot read file %1: +%2. + Impossible de lire le fichier %1: +%2. + + + Parse error in file %1: + +%2 + Erreur de syntaxe dans le fichier %1: %2 + + + File loaded + Fichier chargé + + + Error saving mapping project + Erreur en sauvegardant le fichier de projet + + + Cannot write file %1: +%2. + Impossible d'écrire le fichier %1:%2. + + + File saved + Fichier sauvegardé + + + Untitled + Sans titre + + + %1[*] - %2 + %1[*] - %2 + + + MapMap Project + Projet MapMap + + + File imported + Fichier importé + + + Open project + Ouvrir un projet + + + Save project + Sauvegarder le projet + + + <h2>MapMap + <h2>MapMap + + + MapMap + MapMap + + + Import media source file + Importer un média + + + Remove this paint and all its associated mappings? + Effacer cette peinture et tous les mappings qui y sont associés? + + + Create a new project + Créer un nouveau projet + + + Open an existing project + Ouvrir un projet existant + + + Save the project + Sauvegarder le projet + + + Save the project as... + Sauvegarder le projet sous... + + + &Import media source file... + &Importer un fichier média source... + + + Import a media source file... + Importer un fichier média source... + + + Add &Color paint... + Ajouter une peinture &Couleur... + + + Add a color paint... + Ajouter une peinture Couleur... + + + Delete + Effacer l'élément sélectionné + + + CTRL+DEL + CTRL+SUPPR + + + Delete item + Effacer l'élément sélectionné + + + Add Quad/&Mesh + Ajouter un quadrilatère/&Mesh + + + CTRL+M + CTRL+M + + + Add quad/mesh + Ajouter un quadrilatère/&Mesh + + + Add &Triangle + Ajouter un &Triangle + + + CTRL+T + CTRL+T + + + Add &Ellipse + Ajouter une &Ellipse + + + CTRL+E + CTRL+E + + + Add ellipse + Ajouter une ellipse + + + &Display output window + Afficher la fenêtre de sortie + + + Ctrl+D + CTRL+D + + + Display output window + Afficher la fenêtre de sortie + + + &Full screen + Plein écran + + + Ctrl+F + CTRL+F + + + Full screen + Plein écran + + + &Display canvas controls + Afficher les contrôles du canevas + + + Display canvas controls + Afficher les contrôles du canevas + + + &Edit + &Édition + + + &View + Apparence + + + Color paint added + Peinture couleur ajoutée + + + MapMap files (*.%1) + Fichiers MapMap (*.%1) + + + Media files (%1 %2);;All files (*) + + + + Available camera + Cameras disponible + + + Select camera + Selectionner camera + + + No camera available + Aucun camera disponible + + + You can not use this feature! +No camera available in your system + + + + Select Color + + + + <h2><img src=":mapmap-title"/> %1</h2><p>Copyright &copy; 2013 %2.</p><p>MapMap is a free software for video mapping.</p><p>Projection mapping, also known as video mapping and spatial augmented reality, is a projection technology used to turn objects, often irregularly shaped, into a display surface for video projection. These objects may be complex industrial landscapes, such as buildings. By using specialized software, a two or three dimensional object is spatially mapped on the virtual program which mimics the real environment it is to be projected on. The software can interact with a projector to fit any desired image onto the surface of that object. This technique is used by artists and advertisers alike who can add extra dimensions, optical illusions, and notions of movement onto previously static objects. The video is commonly combined with, or triggered by, audio to create an audio-visual narrative.This project was made possible by the support of the International Organization of La Francophonie.</p><p>http://mapmap.info<br />http://www.francophonie.org</p> + + + + Paints + + + + Mappings + + + + No Recents Videos + + + + &Import Media File... + + + + Import a video or image file... + + + + Open &Camera Device... + + + + Choose your camera device... + + + + Add &Color Paint... + + + + &Undo + Ann&uler + + + &Redo + &Retablir + + + &About MapMap + &A propos de MapMap + + + Duplicate + Dupliquer + + + Duplicate item + Dupliquer l'élément + + + Delete mapping + Supprimer l'élément + + + Rename + Renommer + + + Rename item + Renommer l'élément + + + Lock mapping + + + + Lock mapping item + + + + Hide mapping + + + + Hide mapping item + + + + Solo mapping + + + + solo mapping item + + + + Delete paint + + + + &Preferences... + + + + Configure preferences... + + + + Add &Mesh + + + + Add mesh + + + + Play + + + + Pause + + + + Rewind + + + + Toggle &Fullscreen + + + + Toggle Fullscreen + + + + &Display Controls + + + + &Display Controls of Mappings of a Paint + + + + Display all canvas controls related to current paint + + + + &Sticky Vertices + + + + Enable sticky vertices + + + + Show &Test Signal + + + + Show Test signal + + + + Display &Undo Stack + + + + Open Conso&le + Ouvrir la conso&le + + + Display &Zoom Toolbar + + + + &Menu Bar + + + + Main Perspective + + + + Switch to the Main perspective. + + + + Source Perspective + + + + Switch to the Source perspective. + + + + Destination Perspective + + + + Switch to the Destination perspective. + + + + Report bug... + + + + Technical Support + + + + Documentation + + + + Open Recents Projects + + + + Open Recents Videos + + + + &Source + + + + &Destination + + + + &Playback + + + + &Output + + + + &Tools + + + + &Window + + + + Toolbars + + + + &Toolbar + + + + &%1 %2 + + + + Clear List + + + + No Recents Projects + + + + %1 - %2x%3 + + + + Warning + + + + The following file is not supported: %1 + + + + Cannot load movie + + + + Unable to use the file « %1 » +The original file is not found. Will you locate? + + + + Locate file « %1 » + + + + %1 files (%2) + + + + Undo stack + + + + + MapperGLCanvasToolbar + + Enlarge the shape + + + + Shrink the shape + + + + Reset the shape to the normal size + + + + Fit the shape to content view + + + + + MappingItemDelegate + + Solo mapping + + + + Lock mapping + + + + Duplicate mapping + + + + Delete mapping + + + + + PreferenceDialog + + Preferences + + + + Large + + + + Medium + + + + Small + + + + Toolbar icon size (requires restart) + + + + Enable Sticky vertices + + + + Sensitivity + + + + Vertex + + + + Shape + + + + Layers + + + + Show resolution on output + + + + Classic test card + + + + PAL test card + + + + NTSC test card + + + + Send OSC messages + + + + to machine + + + + at port + + + + Listen OSC messages + + + + on port + + + + Refresh + + + + Local IP + + + + OSC Setup + + + + Apparence + + + + Mapping & Shape + + + + Output + + + + Controls + + + + Advanced + + + + + QObject + + Texture mapping + Mapping texturé + + + Input shape + Forme en entrée + + + Output shape + Forme en sortie + + + Point %1 + Point %1 + + + Dimensions + Dimensions + + + %1 +Line %2, column %3 + %1 +Ligne %2, colonne %3 + + + The file is not a mapmap version 0.1 file. + Ce fichier n'est pas un project MapMap version 0.1. + + + Cannot create media with URI %1. + Impossible de créer un média avec l'URI %1 + + + Cannot create color with RGB hex code %1. + Impossible de créer une couleur avec le code RVB hexadécimal %1 + + + Unsupported paint type: %1. + Type de peinture non-supporté: %1 + + + Cannot create triangle texture mapping + Impossible de créer un mapping de texture vers triangle + + + Cannot create mesh texture mapping + Impossible de créer un mapping de texture vers mesh + + + Cannot create ellipse texture mapping + Impossible de créer un mapping de texture vers ellipse + + + Cannot create triangle color mapping + Impossible de créer un mapping de couleur vers triangle + + + Cannot create quad color mapping + Impossible de créer un mapping de couleur vers quadrilatère + + + Cannot create ellipse color mapping + Impossible de créer un mapping de couleur vers ellipse + + + Unsupported mapping type: %1. + Type de mapping non supporté: %1 + + + Wrong shape type "%1" for destination: expected "%2". + Mauvais type de forme "%1" pour la destination. On s'attend à "%2" + + + Initiating program... + Lancement du logiciel... + + + Done. + Terminé. + + + Add paint + + + + Add mapping + + + + Duplicate mapping + + + + Move vertex + + + + Move shape + + + + Remove paint + + + + Delete mapping + + + + Problem at creation of shape. + + + + Unable to create paint of type '%1'. + + + + Mapping + + + + Opacity (%) + + + + Paint + + + + Color + + + + The file is not a mapmap version %1 file. + + + + Problem at creation of paint. + + + + Problem at creation of mapping. + + + + + QtBoolEdit + + True + vrai + + + False + faux + + + + QtBoolPropertyManager + + True + vrai + + + False + faux + + + + QtCharEdit + + Clear Char + Effacer le charactère + + + + QtColorEditWidget + + ... + ... + + + + QtColorPropertyManager + + Red + Rouge + + + Green + Vert + + + Blue + Bleu + + + Alpha + Transparence + + + + QtCursorDatabase + + Arrow + + + + Up Arrow + + + + Cross + + + + Wait + + + + IBeam + + + + Size Vertical + + + + Size Horizontal + + + + Size Backslash + + + + Size Slash + + + + Size All + + + + Blank + + + + Split Vertical + + + + Split Horizontal + + + + Pointing Hand + + + + Forbidden + + + + Open Hand + + + + Closed Hand + + + + What's This + + + + Busy + + + + + QtFontEditWidget + + ... + + + + Select Font + + + + + QtFontPropertyManager + + Family + + + + Point Size + + + + Bold + + + + Italic + + + + Underline + + + + Strikeout + + + + Kerning + + + + + QtKeySequenceEdit + + Clear Shortcut + + + + + QtLocalePropertyManager + + %1, %2 + + + + Language + + + + Country + + + + + QtPointFPropertyManager + + (%1, %2) + + + + X + + + + Y + + + + + QtPointPropertyManager + + (%1, %2) + + + + X + + + + Y + + + + + QtPropertyBrowserUtils + + [%1, %2, %3] (%4) + + + + [%1, %2] + + + + + QtRectFPropertyManager + + [(%1, %2), %3 x %4] + + + + X + + + + Y + + + + Width + + + + Height + + + + + QtRectPropertyManager + + [(%1, %2), %3 x %4] + + + + X + + + + Y + + + + Width + + + + Height + + + + + QtSizeFPropertyManager + + %1 x %2 + + + + Width + + + + Height + + + + + QtSizePolicyPropertyManager + + <Invalid> + + + + [%1, %2, %3, %4] + + + + Horizontal Policy + + + + Vertical Policy + + + + Horizontal Stretch + + + + Vertical Stretch + + + + + QtSizePropertyManager + + %1 x %2 + + + + Width + + + + Height + + + + + QtTreePropertyBrowser + + Property + + + + Value + + + + + VideoGui + + Video file + + + + Video files (%1);;All files (*) + + + + Speed (%) + + + + Volume (%) + + + + diff --git a/translations/translation.qrc b/translations/translation.qrc new file mode 100644 index 0000000..d57ca3e --- /dev/null +++ b/translations/translation.qrc @@ -0,0 +1,6 @@ + + + mapmap_fr.qm + mapmap_en.qm + +