UI: Use non-native file dialog w/ Linux
This commit is contained in:
committed by
jp9000
parent
934cff582a
commit
762983b5d8
@@ -9,10 +9,13 @@ if(UNIX AND NOT APPLE)
|
||||
find_package(X11 REQUIRED)
|
||||
link_libraries(${X11_LIBRARIES})
|
||||
include_directories(${X11_INCLUDE_DIR})
|
||||
|
||||
find_package(Qt5X11Extras REQUIRED)
|
||||
endif()
|
||||
|
||||
set(decklink-ouput-ui_HEADERS
|
||||
${decklink-ouput-ui_HEADERS}
|
||||
../../qt-wrappers.hpp
|
||||
../../properties-view.hpp
|
||||
../../properties-view.moc.hpp
|
||||
../../vertical-scroll-area.hpp
|
||||
@@ -25,6 +28,7 @@ set(decklink-ouput-ui_HEADERS
|
||||
)
|
||||
set(decklink-ouput-ui_SOURCES
|
||||
${decklink-ouput-ui_SOURCES}
|
||||
../../qt-wrappers.cpp
|
||||
../../properties-view.cpp
|
||||
../../vertical-scroll-area.cpp
|
||||
../../double-slider.cpp
|
||||
@@ -64,6 +68,12 @@ target_link_libraries(decklink-ouput-ui
|
||||
obs-frontend-api
|
||||
Qt5::Widgets
|
||||
libobs)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_link_libraries(decklink-ouput-ui
|
||||
Qt5::X11Extras)
|
||||
endif()
|
||||
|
||||
set_target_properties(decklink-ouput-ui PROPERTIES FOLDER "frontend")
|
||||
|
||||
install_obs_plugin_with_data(decklink-ouput-ui data)
|
||||
|
@@ -9,6 +9,8 @@ if(UNIX AND NOT APPLE)
|
||||
find_package(X11 REQUIRED)
|
||||
link_libraries(${X11_LIBRARIES})
|
||||
include_directories(${X11_INCLUDE_DIR})
|
||||
|
||||
find_package(Qt5X11Extras REQUIRED)
|
||||
endif()
|
||||
|
||||
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/deps/obs-scripting")
|
||||
@@ -31,6 +33,7 @@ set(frontend-tools_HEADERS
|
||||
../../slider-ignorewheel.hpp
|
||||
../../combobox-ignorewheel.hpp
|
||||
../../spinbox-ignorewheel.hpp
|
||||
../../qt-wrappers.hpp
|
||||
)
|
||||
set(frontend-tools_SOURCES
|
||||
${frontend-tools_SOURCES}
|
||||
@@ -44,6 +47,7 @@ set(frontend-tools_SOURCES
|
||||
../../slider-ignorewheel.cpp
|
||||
../../combobox-ignorewheel.cpp
|
||||
../../spinbox-ignorewheel.cpp
|
||||
../../qt-wrappers.cpp
|
||||
)
|
||||
set(frontend-tools_UI
|
||||
${frontend-tools_UI}
|
||||
@@ -122,6 +126,12 @@ target_link_libraries(frontend-tools
|
||||
obs-frontend-api
|
||||
Qt5::Widgets
|
||||
libobs)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_link_libraries(frontend-tools
|
||||
Qt5::X11Extras)
|
||||
endif()
|
||||
|
||||
set_target_properties(frontend-tools PROPERTIES FOLDER "frontend")
|
||||
|
||||
install_obs_plugin_with_data(frontend-tools data)
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "scripts.hpp"
|
||||
#include "frontend-tools-config.h"
|
||||
#include "../../properties-view.hpp"
|
||||
#include "../../qt-wrappers.hpp"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QPlainTextEdit>
|
||||
@@ -319,19 +320,16 @@ void ScriptsTool::on_addScripts_clicked()
|
||||
lastBrowsedDir = baseScriptPath;
|
||||
}
|
||||
|
||||
QFileDialog dlg(this, obs_module_text("AddScripts"));
|
||||
dlg.setFileMode(QFileDialog::ExistingFiles);
|
||||
dlg.setDirectory(QDir(lastBrowsedDir.c_str()));
|
||||
dlg.setNameFilter(filter);
|
||||
dlg.exec();
|
||||
|
||||
QStringList files = dlg.selectedFiles();
|
||||
QStringList files = OpenFiles(this,
|
||||
QT_UTF8(obs_module_text("AddScripts")),
|
||||
QT_UTF8(lastBrowsedDir.c_str()), filter);
|
||||
if (!files.count())
|
||||
return;
|
||||
|
||||
lastBrowsedDir = dlg.directory().path().toUtf8().constData();
|
||||
|
||||
for (const QString &file : files) {
|
||||
lastBrowsedDir =
|
||||
QFileInfo(file).absolutePath().toUtf8().constData();
|
||||
|
||||
QByteArray pathBytes = file.toUtf8();
|
||||
const char *path = pathBytes.constData();
|
||||
|
||||
@@ -396,8 +394,8 @@ void ScriptsTool::on_scriptLog_clicked()
|
||||
void ScriptsTool::on_pythonPathBrowse_clicked()
|
||||
{
|
||||
QString curPath = ui->pythonPath->text();
|
||||
QString newPath = QFileDialog::getExistingDirectory(
|
||||
this, ui->pythonPathLabel->text(), curPath);
|
||||
QString newPath =
|
||||
SelectDirectory(this, ui->pythonPathLabel->text(), curPath);
|
||||
|
||||
if (newPath.isEmpty())
|
||||
return;
|
||||
|
Reference in New Issue
Block a user