mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 18:21:16 +02:00
removed unused widgets
This commit is contained in:
parent
11bf9b8a50
commit
8855a32526
4 changed files with 139 additions and 30 deletions
39
interface/resources/styles/import_dialog.qss
Normal file
39
interface/resources/styles/import_dialog.qss
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* import_dialog.qss
|
||||||
|
* hifi
|
||||||
|
*
|
||||||
|
* Created by Stojce on 1/5/2014.
|
||||||
|
* Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
QSidebar, QTreeView {
|
||||||
|
border: 1px solid #E5E5E5;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTreeView {
|
||||||
|
border-left: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
QSplitter::handle, QDialog {
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton {
|
||||||
|
border-width: 0;
|
||||||
|
border-radius: 9px;
|
||||||
|
font-size: 18px;
|
||||||
|
padding: 14px 0px;
|
||||||
|
width: 107px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton#importButton {
|
||||||
|
background: #333333;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton#cancelButton {
|
||||||
|
color: #333333;
|
||||||
|
background: #FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,45 +6,48 @@
|
||||||
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||||
//
|
//
|
||||||
#include "ImportDialog.h"
|
#include "ImportDialog.h"
|
||||||
#include "Application.h"
|
|
||||||
|
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QMouseEvent>
|
#include <QSplitter>
|
||||||
|
|
||||||
const QString WINDOW_NAME = QObject::tr("Import Voxels");
|
const QString WINDOW_NAME = QObject::tr("Import Voxels");
|
||||||
const QString IMPORT_BUTTON_NAME = QObject::tr("Import");
|
const QString IMPORT_BUTTON_NAME = QObject::tr("Import");
|
||||||
const QString IMPORT_FILE_TYPES = QObject::tr("Sparse Voxel Octree Files, "
|
const QString CANCEL_BUTTON_NAME = QObject::tr("Cancel");
|
||||||
"Square PNG, "
|
const QString IMPORT_FILE_TYPES = QObject::tr("Sparse Voxel Octree Files, "
|
||||||
"Schematic Files "
|
"Square PNG, "
|
||||||
"(*.svo *.png *.schematic)");
|
"Schematic Files "
|
||||||
|
"(*.svo *.png *.schematic)");
|
||||||
|
const QString INFO_LABEL_TEXT = QObject::tr("This will load selected file into Hifi and\n"
|
||||||
|
"allow you to place it with Command V");
|
||||||
|
|
||||||
const QString DESKTOP_LOCATION = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
const QString DESKTOP_LOCATION = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
||||||
|
|
||||||
ImportDialog::ImportDialog(QWidget *parent)
|
ImportDialog::ImportDialog(QWidget *parent) : QFileDialog(parent, WINDOW_NAME, DESKTOP_LOCATION, IMPORT_FILE_TYPES),
|
||||||
: QFileDialog(parent, WINDOW_NAME, DESKTOP_LOCATION, IMPORT_FILE_TYPES),
|
_importButton(IMPORT_BUTTON_NAME, this),
|
||||||
_importButton (IMPORT_BUTTON_NAME, this) {
|
_cancelButton(CANCEL_BUTTON_NAME, this),
|
||||||
|
_importLabel(IMPORT_BUTTON_NAME),
|
||||||
|
_infoLabel(INFO_LABEL_TEXT) {
|
||||||
|
|
||||||
setOption(QFileDialog::DontUseNativeDialog, true);
|
setOption(QFileDialog::DontUseNativeDialog, true);
|
||||||
setFileMode(QFileDialog::ExistingFile);
|
setFileMode(QFileDialog::ExistingFile);
|
||||||
setViewMode(QFileDialog::Detail);
|
setViewMode(QFileDialog::Detail);
|
||||||
|
|
||||||
|
setLayout();
|
||||||
QGridLayout* gridLayout = (QGridLayout*) layout();
|
QGridLayout* gridLayout = (QGridLayout*) layout();
|
||||||
gridLayout->addWidget(&_importButton , 2, 2);
|
gridLayout->addWidget(&_importLabel, 0, 0);
|
||||||
|
gridLayout->addWidget(&_infoLabel, 2, 0);
|
||||||
|
gridLayout->addWidget(&_cancelButton, 2, 1);
|
||||||
|
gridLayout->addWidget(&_importButton, 2, 2);
|
||||||
gridLayout->setColumnStretch(3, 1);
|
gridLayout->setColumnStretch(3, 1);
|
||||||
|
|
||||||
connect(&_importButton, SIGNAL(pressed()), SLOT(import()));
|
connect(&_importButton, SIGNAL(pressed()), SLOT(import()));
|
||||||
|
|
||||||
connect(this, SIGNAL(currentChanged(QString)), SLOT(saveCurrentFile(QString)));
|
connect(this, SIGNAL(currentChanged(QString)), SLOT(saveCurrentFile(QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ImportDialog::~ImportDialog() {
|
ImportDialog::~ImportDialog() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportDialog::init() {
|
|
||||||
VoxelSystem* voxelSystem = Application::getInstance()->getSharedVoxelSystem();
|
|
||||||
connect(voxelSystem, SIGNAL(importSize(float,float,float)), SLOT(setGLCamera(float,float,float)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImportDialog::import() {
|
void ImportDialog::import() {
|
||||||
_importButton.setDisabled(true);
|
_importButton.setDisabled(true);
|
||||||
emit accepted();
|
emit accepted();
|
||||||
|
@ -69,3 +72,72 @@ void ImportDialog::reset() {
|
||||||
void ImportDialog::saveCurrentFile(QString filename) {
|
void ImportDialog::saveCurrentFile(QString filename) {
|
||||||
_currentFile = filename;
|
_currentFile = filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImportDialog::setLayout() {
|
||||||
|
|
||||||
|
// set ObjectName used in qss
|
||||||
|
_importButton.setObjectName("importButton");
|
||||||
|
_cancelButton.setObjectName("cancelButton");
|
||||||
|
|
||||||
|
// set size policy used in
|
||||||
|
_importButton.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
|
_cancelButton.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
|
|
||||||
|
// hide unused embeded widgets in QFileDialog
|
||||||
|
QWidget* widget = findChild<QWidget*>("lookInLabel");
|
||||||
|
widget->hide();
|
||||||
|
|
||||||
|
widget = findChild<QWidget*>("lookInCombo");
|
||||||
|
widget->hide();
|
||||||
|
|
||||||
|
widget = findChild<QWidget*>("backButton");
|
||||||
|
widget->hide();
|
||||||
|
|
||||||
|
widget = findChild<QWidget*>("forwardButton");
|
||||||
|
widget->hide();
|
||||||
|
|
||||||
|
widget = findChild<QWidget*>("toParentButton");
|
||||||
|
widget->hide();
|
||||||
|
|
||||||
|
widget = findChild<QWidget*>("newFolderButton");
|
||||||
|
widget->hide();
|
||||||
|
|
||||||
|
widget = findChild<QWidget*>("listModeButton");
|
||||||
|
widget->hide();
|
||||||
|
|
||||||
|
widget = findChild<QWidget*>("detailModeButton");
|
||||||
|
widget->hide();
|
||||||
|
|
||||||
|
widget = findChild<QWidget*>("fileNameEdit");
|
||||||
|
widget->hide();
|
||||||
|
|
||||||
|
widget = findChild<QWidget*>("fileNameLabel");
|
||||||
|
widget->hide();
|
||||||
|
|
||||||
|
widget = findChild<QWidget*>("fileTypeCombo");
|
||||||
|
widget->hide();
|
||||||
|
|
||||||
|
widget = findChild<QWidget*>("fileTypeLabel");
|
||||||
|
widget->hide();
|
||||||
|
|
||||||
|
widget = findChild<QWidget*>("buttonBox");
|
||||||
|
widget->hide();
|
||||||
|
|
||||||
|
QSplitter *splitter = findChild<QSplitter*>("splitter");
|
||||||
|
splitter->setHandleWidth(0);
|
||||||
|
|
||||||
|
// remove blue outline on Mac
|
||||||
|
widget = findChild<QWidget*>("sidebar");
|
||||||
|
widget->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||||
|
widget = findChild<QWidget*>("treeView");
|
||||||
|
widget->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||||
|
|
||||||
|
// set custom file icons
|
||||||
|
// setIconProvider(new HiFiIconProvider());
|
||||||
|
|
||||||
|
switchToResourcesParentIfRequired();
|
||||||
|
QFile styleSheet("resources/styles/import_dialog.qss");
|
||||||
|
if (styleSheet.open(QIODevice::ReadOnly)) {
|
||||||
|
setStyleSheet(styleSheet.readAll());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -9,24 +9,18 @@
|
||||||
#ifndef __hifi__ImportDialog__
|
#ifndef __hifi__ImportDialog__
|
||||||
#define __hifi__ImportDialog__
|
#define __hifi__ImportDialog__
|
||||||
|
|
||||||
#include <VoxelSystem.h>
|
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QCheckBox>
|
#include <QLabel>
|
||||||
#include <QProgressBar>
|
#include <SharedUtil.h>
|
||||||
#include <QGLWidget>
|
|
||||||
#include <QTimer>
|
|
||||||
|
|
||||||
class GLWidget;
|
|
||||||
|
|
||||||
class ImportDialog : public QFileDialog {
|
class ImportDialog : public QFileDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ImportDialog(QWidget* parent = NULL);
|
ImportDialog(QWidget* parent = NULL);
|
||||||
~ImportDialog();
|
~ImportDialog();
|
||||||
|
|
||||||
void init();
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
QString getCurrentFile() const { return _currentFile; }
|
QString getCurrentFile() const { return _currentFile; }
|
||||||
|
@ -44,8 +38,13 @@ private slots:
|
||||||
void saveCurrentFile(QString);
|
void saveCurrentFile(QString);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString _currentFile;
|
QString _currentFile;
|
||||||
QPushButton _importButton;
|
QPushButton _importButton;
|
||||||
|
QPushButton _cancelButton;
|
||||||
|
QLabel _importLabel;
|
||||||
|
QLabel _infoLabel;
|
||||||
|
|
||||||
|
void setLayout();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__hifi__ImportDialog__) */
|
#endif /* defined(__hifi__ImportDialog__) */
|
||||||
|
|
|
@ -34,7 +34,6 @@ VoxelImporter::VoxelImporter(QWidget* parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoxelImporter::init() {
|
void VoxelImporter::init() {
|
||||||
_importDialog.init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VoxelImporter::~VoxelImporter() {
|
VoxelImporter::~VoxelImporter() {
|
||||||
|
|
Loading…
Reference in a new issue