Beispiel #1
0
void
MainWindow::handleOpenFile()
{
    auto name = QFileDialog::getOpenFileName( this
                                              , tr( "Open QtPlatz publisher xml" )
                                              , recentFile( "RecentFiles", "Files" )
                                              , tr( "QtPlatz publisher xml(*.xml);;HTML(*.html)" ) );
    if ( !name.isEmpty() ) {
        boost::filesystem::path path( name.toStdWString() );
        if ( path.extension() == ".xml" ) {

            addRecentFiles( "RecentFiles", "Files", name );

            auto doc = std::make_shared< adpublisher::document>();

            if ( doc->load_file( name.toStdString().c_str() ) ) {

                setWindowTitle( name );
                xmlpath_ = name.toStdString();

                ui->actionApply->setEnabled( true );
                processed_.clear();

                docEditor_->setDocument( doc );
            }
        }
        else if ( path.extension() == ".html" ) {
            docEditor_->setOutput( QUrl( QString( "file:///%1" ).arg( path.string().c_str() ) ) );
        }
    }
}
Beispiel #2
0
MainWindow::MainWindow() : 
QMainWindow(), Ui_MainWindow(), 
maxNumRecentFiles(15), recentFileActs(15)
{
  setupUi(this);

  // init scene
  m_scene = new Scene;
  viewer->set_scene(m_scene);

  // options
  m_verbose = 0;
  m_mchoice = 0;
  m_relevance = 1.0;
  m_use_flip = true;
  m_percent  = 100.0;
  m_relocation = 2;

  // accepts drop events
  setAcceptDrops(true);

  // Handling actions
  addRecentFiles(menuFile, actionQuit);
  connect(actionQuit, SIGNAL(triggered()), this, SLOT(close()));
  connect(this, SIGNAL(openRecentFile(QString)), this, SLOT(open(QString)));
  Q_EMIT update();
  viewer->update();
}
Beispiel #3
0
Controls::Controls(QWidget *parent)
    : QMainWindow(parent)
    , m_ui(new Ui::Controls)
    , m_view(0)
    , m_scaleLinked(true)
{
    m_ui->setupUi(this);
    connect(m_ui->actionQuit, SIGNAL(triggered()),
            this, SLOT(close()));

    m_view = new Viewer(m_ui->frame);
    QHBoxLayout *lay = new QHBoxLayout();
    lay->addWidget(m_view);
    m_ui->frame->setLayout(lay);
    connect(m_view, SIGNAL(manualControlEngaged()),
            this, SLOT(setManualControl()));

    QString initialModel = populateModelMenu();

    m_model = new Model(this);

    connect(this, SIGNAL(openFile(QString)),
            m_model, SLOT(setFullPath(QString)));
    connect(this, SIGNAL(openFile(QString)),
            this, SLOT(addRecentFiles(QString)));

    connect(m_model, SIGNAL(modelLoaded(QString)),
            this, SLOT(loadModelDefaults(QString)));
    connect(m_model, SIGNAL(modelLoaded(QString)),
            this, SLOT(loadSettings(QString)));
    connect(m_model, SIGNAL(modelLoaded(QString)),
            this, SLOT(setWindowTitle(QString)));
    connect(m_model, SIGNAL(modelLoaded(QString)),
            m_ui->treeView, SLOT(expandAll()));

    connect(m_model, SIGNAL(modelUnloaded(QString)),
            this, SLOT(saveModelDefaults(QString)));
    connect(m_model, SIGNAL(modelUnloaded(QString)),
            this, SLOT(saveSettings(QString)));
    connect(m_model, SIGNAL(modelLoadTime(int)),
            this , SLOT(fileLoadTimeNotified(int)));
    connect(m_model, SIGNAL(modelTriangles(int)),
            this, SLOT(triangleCountUpdated(int)));

    m_triangleCount = new QLabel(tr("0 triangles"));
    m_ui->statusbar->addPermanentWidget(m_triangleCount);

    m_view->setModel(m_model);
    m_ui->treeView->setModel(m_model);
    m_view->setTreeView(m_ui->treeView);

    emit openFile(initialModel);

    connect(m_ui->actionForce_Smooth, SIGNAL(triggered(bool)),
            this, SLOT(optionMenuToggled(bool)));
    connect(m_ui->actionForce_Faceted, SIGNAL(triggered(bool)),
            this, SLOT(optionMenuToggled(bool)));
    connect(m_ui->actionNative_Indices, SIGNAL(triggered(bool)),
            this, SLOT(optionMenuToggled(bool)));
    connect(m_ui->actionCorrect_Normals, SIGNAL(triggered(bool)),
            this, SLOT(optionMenuToggled(bool)));
    connect(m_ui->actionCorrect_Acute, SIGNAL(triggered(bool)),
            this, SLOT(optionMenuToggled(bool)));
    connect(m_ui->actionShow_Warnings, SIGNAL(triggered(bool)),
            this, SLOT(optionMenuToggled(bool)));
    connect(m_ui->generateQmlPushButton, SIGNAL(clicked()),
            m_ui->actionSave_QML, SIGNAL(triggered()));
}
Beispiel #4
0
void
MainWindow::addRecentFiles( const QString& group, const QString& pfx, const QString& value, const QString& key )
{
    addRecentFiles( *settings_, group, pfx, value, key );
}