Ejemplo n.º 1
0
void DataLayer::loadDataFromFile()
{
    QFile file(_DATAFILE);
    if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
        return;

    QList<QObject*> Appointments;
    QString nextDay;
    QString prevDay;

    if(!file.atEnd())
    {
        QByteArray otherDayLine = file.readLine();
        QList<QByteArray> otherDays = otherDayLine.split('\t');

        if (otherDays.size()==2)
        {
            nextDay = otherDays.at(0);
            prevDay = otherDays.at(1);
        }
        else
        {
            return;
        }

        while (!file.atEnd())
        {
            QString desc,time,place,link;

            QByteArray line = file.readLine();
            QList<QByteArray> data = line.split('\t');

            if (data.size()>=4)
            {
                desc = QString(data.at(0));
                time = QString(data.at(1));
                place = QString(data.at(2));
                link = QString(data.at(3));

                Appointments.push_back(new Termin(desc,time,place,link));
            }
        }
    }
    setDataModel(new Day(Appointments,nextDay,prevDay));
}
Ejemplo n.º 2
0
void MasterWindow::_setupMasterWindowUI()
{
    // add main tab widget
    setCentralWidget(new QTabWidget());

    // create menus in menu bar
    auto fileMenu = menuBar()->addMenu("&File");
    auto editMenu = menuBar()->addMenu("&Edit");
    auto viewMenu = menuBar()->addMenu("&View");
    auto helpMenu = menuBar()->addMenu("&Help");

    // create tool bar
    auto toolbar = addToolBar("toolbar");

    /** FILE menu */

    // open content action
    auto openContentAction = new QAction("Open Content", this);
    openContentAction->setStatusTip("Open content");
    connect(openContentAction, &QAction::triggered, this,
            &MasterWindow::_openContent);

    // open contents directory action
    auto openContentsDirectoryAction = new QAction("Open Directory", this);
    openContentsDirectoryAction->setStatusTip("Open directory of contents");
    connect(openContentsDirectoryAction, &QAction::triggered, this,
            &MasterWindow::_openContentsDirectory);

    // clear contents action
    auto clearContentsAction = new QAction("Clear", this);
    clearContentsAction->setStatusTip("Clear all contents");
    connect(clearContentsAction, &QAction::triggered,
            [this]() { _getActiveGroup().clear(); });

    // save session action
    auto saveSessionAction = new QAction("Save Session", this);
    saveSessionAction->setStatusTip("Save current session");
    connect(saveSessionAction, &QAction::triggered, this,
            &MasterWindow::_saveSession);

    // load session action
    auto loadSessionAction = new QAction("Load Session", this);
    loadSessionAction->setStatusTip("Load a session");
    connect(loadSessionAction, &QAction::triggered, this,
            &MasterWindow::_openSession);

#if TIDE_ENABLE_WEBBROWSER_SUPPORT
    // Open webbrowser action
    auto webbrowserAction = new QAction("Web Browser", this);
    webbrowserAction->setStatusTip("Open a web browser");
    connect(webbrowserAction, &QAction::triggered, _webbrowserWidget,
            &WebbrowserWidget::show);
#endif

    // Open whiteboard action
    auto whiteboardAction = new QAction("Whiteboard", this);
    whiteboardAction->setStatusTip("Open a whiteboard");
    connect(whiteboardAction, &QAction::triggered,
            [this] { emit openWhiteboard(_getActiveSceneIndex()); });

    // quit action
    auto quitAction = new QAction("Quit", this);
    quitAction->setStatusTip("Quit application");
    connect(quitAction, &QAction::triggered, this, &MasterWindow::close);

    /** EDIT menu */

    // background content action
    auto backgroundAction = new QAction("Background", this);
    backgroundAction->setStatusTip("Select the background color and content");
    connect(backgroundAction, &QAction::triggered, _backgroundWidget,
            &BackgroundWidget::show);
    connect(static_cast<QTabWidget*>(centralWidget()),
            &QTabWidget::currentChanged, _backgroundWidget,
            &BackgroundWidget::setActiveSurface);

    /** VIEW menu */

    // enable alpha blending
    auto enableAlphaBlendingAction = new QAction("Alpha Blending", this);
    enableAlphaBlendingAction->setStatusTip(
        "Enable alpha blending for transparent contents (png, svg, etc..)");
    enableAlphaBlendingAction->setCheckable(true);
    enableAlphaBlendingAction->setChecked(_options->isAlphaBlendingEnabled());
    connect(enableAlphaBlendingAction, &QAction::toggled, _options.get(),
            &Options::enableAlphaBlending);
    connect(_options.get(), &Options::alphaBlendingEnabledChanged,
            enableAlphaBlendingAction, &QAction::setChecked);

    // auto focus pixel streams
    auto autoFocusStreamersAction = new QAction("Auto-focus streamers", this);
    autoFocusStreamersAction->setStatusTip(
        "Open the windows of the external streamers in focus mode");
    autoFocusStreamersAction->setCheckable(true);
    autoFocusStreamersAction->setChecked(_options->getAutoFocusPixelStreams());
    connect(autoFocusStreamersAction, &QAction::toggled, _options.get(),
            &Options::setAutoFocusPixelStreams);
    connect(_options.get(), &Options::autoFocusPixelStreamsChanged,
            autoFocusStreamersAction, &QAction::setChecked);

    // show clock action
    auto showClockAction = new QAction("Clock", this);
    showClockAction->setStatusTip("Show a clock on the background");
    showClockAction->setCheckable(true);
    showClockAction->setChecked(_options->getShowClock());
    connect(showClockAction, &QAction::toggled, _options.get(),
            &Options::setShowClock);
    connect(_options.get(), &Options::showClockChanged, showClockAction,
            &QAction::setChecked);

    // show content tiles action
    auto showContentTilesAction = new QAction("Content Tiles", this);
    showContentTilesAction->setStatusTip("Show Content Tiles");
    showContentTilesAction->setCheckable(true);
    showContentTilesAction->setChecked(_options->getShowContentTiles());
    connect(showContentTilesAction, &QAction::toggled, _options.get(),
            &Options::setShowContentTiles);
    connect(_options.get(), &Options::showContentTilesChanged,
            showContentTilesAction, &QAction::setChecked);

    // show control area action
    auto showControlAreaAction = new QAction("Control Area", this);
    showControlAreaAction->setStatusTip("Show the Control Area");
    showControlAreaAction->setCheckable(true);
    showControlAreaAction->setChecked(_options->getShowControlArea());
    connect(showControlAreaAction, &QAction::toggled, _options.get(),
            &Options::setShowControlArea);
    connect(_options.get(), &Options::showControlAreaChanged,
            showControlAreaAction, &QAction::setChecked);

    // show file paths action
    auto showFilePathsAction = new QAction("File Paths", this);
    showFilePathsAction->setStatusTip("Show full file paths in the title bar");
    showFilePathsAction->setCheckable(true);
    showFilePathsAction->setChecked(_options->getShowFilePaths());
    connect(showFilePathsAction, &QAction::toggled, _options.get(),
            &Options::setShowFilePaths);
    connect(_options.get(), &Options::showFilePathsChanged, showFilePathsAction,
            &QAction::setChecked);

    // show streaming statistics action
    auto showStatisticsAction = new QAction("Statistics", this);
    showStatisticsAction->setStatusTip("Show statistics");
    showStatisticsAction->setCheckable(true);
    showStatisticsAction->setChecked(_options->getShowStatistics());
    connect(showStatisticsAction, &QAction::toggled, _options.get(),
            &Options::setShowStatistics);
    connect(_options.get(), &Options::showStatisticsChanged,
            showStatisticsAction, &QAction::setChecked);

    // show test pattern action
    auto showTestPatternAction = new QAction("Test Pattern", this);
    showTestPatternAction->setStatusTip("Show test pattern");
    showTestPatternAction->setCheckable(true);
    showTestPatternAction->setChecked(_options->getShowTestPattern());
    connect(showTestPatternAction, &QAction::toggled, _options.get(),
            &Options::setShowTestPattern);
    connect(_options.get(), &Options::showTestPatternChanged,
            showTestPatternAction, &QAction::setChecked);

    // show touch points action
    auto showTouchPoints = new QAction("Touch Points", this);
    showTouchPoints->setStatusTip("Show touch points");
    showTouchPoints->setCheckable(true);
    showTouchPoints->setChecked(_options->getShowTouchPoints());
    connect(showTouchPoints, &QAction::toggled, _options.get(),
            &Options::setShowTouchPoints);
    connect(_options.get(), &Options::showTouchPointsChanged, showTouchPoints,
            &QAction::setChecked);

    // show window borders action
    auto showWindowBordersAction = new QAction("Window Borders", this);
    showWindowBordersAction->setStatusTip("Show window borders");
    showWindowBordersAction->setCheckable(true);
    showWindowBordersAction->setChecked(_options->getShowWindowBorders());
    connect(showWindowBordersAction, &QAction::toggled, _options.get(),
            &Options::setShowWindowBorders);
    connect(_options.get(), &Options::showWindowBordersChanged,
            showWindowBordersAction, &QAction::setChecked);

    // show window title action
    auto showWindowTitlesAction = new QAction("Window Titles", this);
    showWindowTitlesAction->setStatusTip("Show window titles");
    showWindowTitlesAction->setCheckable(true);
    showWindowTitlesAction->setChecked(_options->getShowWindowTitles());
    connect(showWindowTitlesAction, &QAction::toggled, _options.get(),
            &Options::setShowWindowTitles);
    connect(_options.get(), &Options::showWindowTitlesChanged,
            showWindowTitlesAction, &QAction::setChecked);

    // show zoom context action
    auto showZoomContextAction = new QAction("Zoom Context", this);
    showZoomContextAction->setStatusTip("Show zoom context");
    showZoomContextAction->setCheckable(true);
    showZoomContextAction->setChecked(_options->getShowZoomContext());
    connect(showZoomContextAction, &QAction::toggled, _options.get(),
            &Options::setShowZoomContext);
    connect(_options.get(), &Options::showZoomContextChanged,
            showZoomContextAction, &QAction::setChecked);

    /** HELP menu */

    auto showAboutDialog = new QAction("About", this);
    showAboutDialog->setStatusTip("About Tide");
    connect(showAboutDialog, &QAction::triggered, this,
            &MasterWindow::_openAboutWidget);

    // add actions to menus
    fileMenu->addAction(openContentAction);
    fileMenu->addAction(openContentsDirectoryAction);
    fileMenu->addAction(loadSessionAction);
    fileMenu->addAction(saveSessionAction);
#if TIDE_ENABLE_WEBBROWSER_SUPPORT
    fileMenu->addAction(webbrowserAction);
#endif
    fileMenu->addAction(whiteboardAction);
    fileMenu->addAction(clearContentsAction);
    fileMenu->addAction(quitAction);
    editMenu->addAction(backgroundAction);
    viewMenu->addAction(autoFocusStreamersAction);
    viewMenu->addAction(enableAlphaBlendingAction);
    viewMenu->addAction(showClockAction);
    viewMenu->addAction(showContentTilesAction);
    viewMenu->addAction(showControlAreaAction);
    viewMenu->addAction(showFilePathsAction);
    viewMenu->addAction(showStatisticsAction);
    viewMenu->addAction(showTestPatternAction);
    viewMenu->addAction(showTouchPoints);
    viewMenu->addAction(showWindowBordersAction);
    viewMenu->addAction(showWindowTitlesAction);
    viewMenu->addAction(showZoomContextAction);
    helpMenu->addAction(showAboutDialog);

    // add actions to toolbar
    toolbar->addAction(openContentAction);
    toolbar->addAction(openContentsDirectoryAction);
    toolbar->addAction(loadSessionAction);
    toolbar->addAction(saveSessionAction);
#if TIDE_ENABLE_WEBBROWSER_SUPPORT
    toolbar->addAction(webbrowserAction);
#endif
    toolbar->addAction(whiteboardAction);
    toolbar->addAction(clearContentsAction);
    toolbar->addAction(backgroundAction);

    // create left dock widget
    auto contentsDockWidget = new QDockWidget("Contents", this);
    auto contentsWidget = new QWidget();
    auto contentsLayout = new QVBoxLayout();
    contentsWidget->setLayout(contentsLayout);
    contentsDockWidget->setWidget(contentsWidget);
    addDockWidget(Qt::LeftDockWidgetArea, contentsDockWidget);

    // add list widget (first display group only at the moment)
    auto displayGroupWidget = new DisplayGroupListWidget(this);
    displayGroupWidget->setDataModel(_scene->getGroup(0).shared_from_this());
    contentsLayout->addWidget(displayGroupWidget);
}