mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-12 18:59:59 +01:00
Improved windows titles management
Display filename (no path) before APP_NAME, clean APP_TITLE when no file, bugs fixed.
This commit is contained in:
@@ -54,7 +54,7 @@ static void saveSession(const std::string& filename, Session *session)
|
|||||||
// set session filename
|
// set session filename
|
||||||
session->setFilename(filename);
|
session->setFilename(filename);
|
||||||
// cosmetics saved ok
|
// cosmetics saved ok
|
||||||
Rendering::manager().setMainWindowTitle(filename);
|
Rendering::manager().setMainWindowTitle(SystemToolkit::filename(filename));
|
||||||
Settings::application.recentSessions.push(filename);
|
Settings::application.recentSessions.push(filename);
|
||||||
Log::Notify("Session %s saved.", filename.c_str());
|
Log::Notify("Session %s saved.", filename.c_str());
|
||||||
|
|
||||||
@@ -144,10 +144,14 @@ void Mixer::update()
|
|||||||
swap();
|
swap();
|
||||||
++View::need_deep_update_;
|
++View::need_deep_update_;
|
||||||
// inform new session filename
|
// inform new session filename
|
||||||
Rendering::manager().setMainWindowTitle(session_->filename());
|
if (session_->filename().empty()) {
|
||||||
|
Rendering::manager().setMainWindowTitle(Settings::application.windows[0].name);
|
||||||
|
} else {
|
||||||
|
Rendering::manager().setMainWindowTitle(SystemToolkit::filename(session_->filename()));
|
||||||
Settings::application.recentSessions.push(session_->filename());
|
Settings::application.recentSessions.push(session_->filename());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if there is a source candidate for this session
|
// if there is a source candidate for this session
|
||||||
if (candidate_sources_.size() > 0) {
|
if (candidate_sources_.size() > 0) {
|
||||||
|
|||||||
@@ -488,9 +488,11 @@ RenderingWindow::~RenderingWindow()
|
|||||||
|
|
||||||
void RenderingWindow::setTitle(const std::string &title)
|
void RenderingWindow::setTitle(const std::string &title)
|
||||||
{
|
{
|
||||||
std::string fulltitle = Settings::application.windows[index_].name;
|
std::string fulltitle;
|
||||||
if ( !title.empty() )
|
if ( title.empty() )
|
||||||
fulltitle = std::string(APP_NAME) + " -- " + title;
|
fulltitle = Settings::application.windows[index_].name;
|
||||||
|
else
|
||||||
|
fulltitle = title + std::string(" - " APP_NAME);
|
||||||
|
|
||||||
glfwSetWindowTitle(window_, fulltitle.c_str());
|
glfwSetWindowTitle(window_, fulltitle.c_str());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,13 +39,12 @@ void Settings::Save()
|
|||||||
{
|
{
|
||||||
XMLElement *windowsNode = xmlDoc.NewElement( "Windows" );
|
XMLElement *windowsNode = xmlDoc.NewElement( "Windows" );
|
||||||
|
|
||||||
for (int i = 0; i < application.windows.size(); i++)
|
for (int i = 0; i < application.windows.size(); ++i)
|
||||||
{
|
{
|
||||||
const Settings::WindowConfig& w = application.windows[i];
|
const Settings::WindowConfig& w = application.windows[i];
|
||||||
|
|
||||||
XMLElement *window = xmlDoc.NewElement( "Window" );
|
XMLElement *window = xmlDoc.NewElement( "Window" );
|
||||||
window->SetAttribute("id", i);
|
window->SetAttribute("id", i);
|
||||||
window->SetAttribute("name", w.name.c_str());
|
|
||||||
window->SetAttribute("x", w.x);
|
window->SetAttribute("x", w.x);
|
||||||
window->SetAttribute("y", w.y);
|
window->SetAttribute("y", w.y);
|
||||||
window->SetAttribute("w", w.w);
|
window->SetAttribute("w", w.w);
|
||||||
@@ -334,16 +333,18 @@ void Settings::Load()
|
|||||||
for( ; windowNode ; windowNode=windowNode->NextSiblingElement())
|
for( ; windowNode ; windowNode=windowNode->NextSiblingElement())
|
||||||
{
|
{
|
||||||
Settings::WindowConfig w;
|
Settings::WindowConfig w;
|
||||||
w.name = std::string(windowNode->Attribute("name"));
|
|
||||||
windowNode->QueryIntAttribute("x", &w.x); // If this fails, original value is left as-is
|
windowNode->QueryIntAttribute("x", &w.x); // If this fails, original value is left as-is
|
||||||
windowNode->QueryIntAttribute("y", &w.y);
|
windowNode->QueryIntAttribute("y", &w.y);
|
||||||
windowNode->QueryIntAttribute("w", &w.w);
|
windowNode->QueryIntAttribute("w", &w.w);
|
||||||
windowNode->QueryIntAttribute("h", &w.h);
|
windowNode->QueryIntAttribute("h", &w.h);
|
||||||
windowNode->QueryBoolAttribute("f", &w.fullscreen);
|
windowNode->QueryBoolAttribute("f", &w.fullscreen);
|
||||||
w.monitor = std::string(windowNode->Attribute("m"));
|
const char *text = windowNode->Attribute("m");
|
||||||
|
if (text)
|
||||||
|
w.monitor = std::string(text);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
windowNode->QueryIntAttribute("id", &i);
|
windowNode->QueryIntAttribute("id", &i);
|
||||||
|
w.name = application.windows[i].name; // keep only original name
|
||||||
application.windows[i] = w;
|
application.windows[i] = w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -225,10 +225,10 @@ struct Application
|
|||||||
current_workspace= 1;
|
current_workspace= 1;
|
||||||
brush = glm::vec3(0.5f, 0.1f, 0.f);
|
brush = glm::vec3(0.5f, 0.1f, 0.f);
|
||||||
windows = std::vector<WindowConfig>(3);
|
windows = std::vector<WindowConfig>(3);
|
||||||
windows[0].name = APP_NAME APP_TITLE;
|
windows[0].name = APP_TITLE;
|
||||||
windows[0].w = 1600;
|
windows[0].w = 1600;
|
||||||
windows[0].h = 900;
|
windows[0].h = 900;
|
||||||
windows[1].name = APP_NAME " -- Output";
|
windows[1].name = "Output " APP_TITLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1715,7 +1715,7 @@ void UserInterface::RenderMetrics(bool *p_open, int* p_corner, int *p_mode)
|
|||||||
void UserInterface::RenderAbout(bool* p_open)
|
void UserInterface::RenderAbout(bool* p_open)
|
||||||
{
|
{
|
||||||
ImGui::SetNextWindowPos(ImVec2(1000, 20), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowPos(ImVec2(1000, 20), ImGuiCond_FirstUseEver);
|
||||||
if (!ImGui::Begin("About " APP_NAME APP_TITLE, p_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize))
|
if (!ImGui::Begin("About " APP_TITLE, p_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize))
|
||||||
{
|
{
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#define VMIX_DEFINES_H
|
#define VMIX_DEFINES_H
|
||||||
|
|
||||||
#define APP_NAME "vimix"
|
#define APP_NAME "vimix"
|
||||||
#define APP_TITLE " -- Video Live Mixer"
|
#define APP_TITLE "Video Live Mixer"
|
||||||
#define APP_SETTINGS "vimix.xml"
|
#define APP_SETTINGS "vimix.xml"
|
||||||
#define XML_VERSION_MAJOR 0
|
#define XML_VERSION_MAJOR 0
|
||||||
#define XML_VERSION_MINOR 2
|
#define XML_VERSION_MINOR 2
|
||||||
|
|||||||
Reference in New Issue
Block a user