Added settings for getting drop down filled and set list to hide folders.
Need to make a dirList setter plus get settings window to keep dirList for editing.
This commit is contained in:
parent
cdda1922fa
commit
b089fcdaf6
@ -73,7 +73,7 @@
|
||||
<widget class="QComboBox" name="dirDropDownList"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeView" name="fileListView"/>
|
||||
<widget class="QListView" name="fileListView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
@ -36,6 +36,7 @@ private:
|
||||
void setAsset(QString);
|
||||
void searchMeshFiles(QString path);
|
||||
void openFile();
|
||||
void open(QString);
|
||||
void takeScreenShot();
|
||||
void aboutTool();
|
||||
|
||||
@ -50,4 +51,9 @@ public slots:
|
||||
// signals
|
||||
signals:
|
||||
void loadFile(QString);
|
||||
|
||||
// private slots
|
||||
private slots:
|
||||
void on_fileListView_doubleClicked(const QModelIndex &index);
|
||||
void on_dirDropDownList_currentTextChanged(const QString &arg1);
|
||||
};
|
||||
|
@ -41,13 +41,20 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
// set default text to file info
|
||||
m_fileInfo = "Filename: -\nMaterials: -\nVertices: -\nTriangle: -<detail>No file is open";
|
||||
|
||||
// set filter and apply drop down tabs/links
|
||||
filters << "*.msh" << "*.MSH" << "*.mesh" << "*.MESH";
|
||||
fmodel = new QFileSystemModel(this);
|
||||
fmodel->setNameFilters(filters);
|
||||
fmodel->setFilter(QDir::NoDotAndDotDot | QDir::Files);
|
||||
fmodel->setNameFilterDisables(false);
|
||||
|
||||
filters << "*.msh" << "*.MSH" << "*.mesh" << "*.MESH" << "*/";
|
||||
fmodel = new QFileSystemModel(this);
|
||||
fmodel->setNameFilters(filters);
|
||||
// fmodel->setFilter(QDir::NoDotAndDotDot | QDir::Files); // Need to get a way to scan dirs recursivly for mush files
|
||||
// maybe add it to a qstringlist and then set it as a model.
|
||||
fmodel->setNameFilterDisables(false);
|
||||
ui->dirDropDownList->addItem("BF1_ModTools", "C:/BF1_ModTools/Assets/Shipped Worlds/"); // temp here
|
||||
ui->dirDropDownList->addItem("BF2_ModTools", "C:/BF2_ModTools/assets/Sides/"); // temp here
|
||||
|
||||
SettingsWindow obj;
|
||||
QStringList tmpList = obj.getDirList().split(";");
|
||||
for (int i = 0; i < tmpList.size(); i++)
|
||||
ui->dirDropDownList->addItem(tmpList[i], tmpList[i]); // temp here
|
||||
|
||||
// add widgets to the window
|
||||
setupWidgets();
|
||||
@ -58,7 +65,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
this->setStyleSheet(styleSheet.readAll());
|
||||
|
||||
getAssetLibrary();
|
||||
|
||||
printMessage("MeshViewer by Anakin", 0);
|
||||
}
|
||||
|
||||
@ -168,21 +174,20 @@ void MainWindow::setupWidgets()
|
||||
m_output->setAlignment(Qt::AlignTop);
|
||||
m_output->setText(m_fileInfo.left(m_fileInfo.indexOf("<detail>")));
|
||||
m_output->raise();
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::getAssetLibrary()
|
||||
{
|
||||
QString path;
|
||||
path = "C:/BF2_ModTools/data_MAX/Worlds/MAX/msh"; // temp path setting
|
||||
setAsset(path);
|
||||
QString path;
|
||||
path = "C:/BF2_ModTools/data_MAX/Worlds/MAX/msh"; // temp path setting
|
||||
setAsset(path);
|
||||
}
|
||||
|
||||
void MainWindow::setAsset(QString path)
|
||||
{
|
||||
fmodel->setRootPath(path);
|
||||
ui->fileListView->setModel(fmodel);
|
||||
ui->fileListView->setRootIndex(fmodel->index(path));
|
||||
fmodel->setRootPath(path);
|
||||
ui->fileListView->setModel(fmodel);
|
||||
ui->fileListView->setRootIndex(fmodel->index(path));
|
||||
}
|
||||
|
||||
void MainWindow::searchMeshFiles(QString path)
|
||||
@ -205,10 +210,16 @@ void MainWindow::searchMeshFiles(QString path)
|
||||
void MainWindow::openFile()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, "Open File", "", "Mesh (*.msh)");
|
||||
open(fileName);
|
||||
}
|
||||
|
||||
void MainWindow::open(QString fileName)
|
||||
{
|
||||
if(!fileName.isEmpty())
|
||||
emit loadFile(fileName);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::takeScreenShot()
|
||||
{
|
||||
QString destination = QFileDialog::getSaveFileName(this, "Save as...", "", "PNG (*.png);; BMP (*.bmp);;TIFF (*.tiff, *.tif);;JPEG (*.jpg *jpeg)");
|
||||
@ -246,6 +257,20 @@ void MainWindow::resizeEvent(QResizeEvent * e)
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// slots
|
||||
|
||||
void MainWindow::on_fileListView_doubleClicked(const QModelIndex &index)
|
||||
{
|
||||
QString clickedFile = fmodel->fileInfo(index).absoluteFilePath();
|
||||
open(clickedFile);
|
||||
}
|
||||
|
||||
void MainWindow::on_dirDropDownList_currentTextChanged(const QString &arg1)
|
||||
{
|
||||
QString selectedDir;
|
||||
selectedDir = ui->dirDropDownList->itemData(ui->dirDropDownList->currentIndex()).toString();
|
||||
printMessage(arg1 + " : " + selectedDir, 0);
|
||||
setAsset(selectedDir);
|
||||
}
|
||||
|
||||
void MainWindow::printMessage(QString message, int severity)
|
||||
{
|
||||
if (!ui->statusBar->currentMessage().isEmpty() && severity < m_curSeverity)
|
||||
|
Loading…
Reference in New Issue
Block a user