Exemplo n.º 1
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()));
}
Exemplo n.º 2
0
bool Uri::set( const std::string& url )
{
    proto_  = "";
    host_   = "";
    port_   = 80;
	std::string path   = "/";

	// find proto
    size_t pos = url.find("://");
    if ( pos != std::string::npos )
	{
		proto_ = url.substr(0,pos);
		if ( mol::stricmp( proto_.c_str(), "https" ) == 0 )
		{
			port_ = 443;
		}
		if ( mol::stricmp( proto_.c_str(), "ssh" ) == 0 )
		{
			port_ = 22;
		}
		if ( mol::stricmp( proto_.c_str(), "scp" ) == 0 )
		{
			port_ = 22;
		}
		host_  = url.substr(pos+3);
	}
	else
	{
		proto_ = "http";
		host_  = url;
	}

	pos    = host_.find("/");
    if ( pos != std::string::npos )
    {
         path  = host_.substr(pos);
         host_ = host_.substr(0,pos);
		 if ( pos > 0 && host_[pos-1] == ':' )
		 {
			 host_ = host_.substr(0,host_.size()-1);
		 }
    }
	pos = host_.find("@");
    if ( pos != std::string::npos )
    {
		std::string tmp = host_.substr(0,pos);
		host_ = host_.substr(pos+1);
		pos = tmp.find(":");
		if ( pos != std::string::npos )
		{
			user_ = tmp.substr(0,pos);
			pwd_ = tmp.substr(pos+1);
		}
		else
		{
			user_ = tmp;
		}
	}
    pos = host_.find(":");
    if ( pos != std::string::npos )
    {
         std::string tmp = host_.substr(pos+1);
         port_ = atoi(tmp.c_str());
         host_ = host_.substr(0,pos);
    }
	setFullPath(path);
	return true;
}