瀏覽代碼

UI: Fix twitch stream stat window not centering

Fixes an issue where if you auth to twitch, then close the program
without unhiding the twitch stream stats panel, the next time that panel
was unhidden it would be at position 0,0 on your screen.  This
explicitly sets its position to be center of the window beforehand to
ensure that won't occur.
jp9000 6 年之前
父節點
當前提交
58be029b14
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      UI/auth-twitch.cpp

+ 5 - 0
UI/auth-twitch.cpp

@@ -248,6 +248,7 @@ void TwitchAuth::LoadSecondaryUIPanes()
 	std::string url;
 	std::string url;
 	std::string script;
 	std::string script;
 
 
+	QSize size = main->frameSize();
 	QPoint pos = main->pos();
 	QPoint pos = main->pos();
 
 
 	script = "localStorage.setItem('twilight.theme', 1);";
 	script = "localStorage.setItem('twilight.theme', 1);";
@@ -304,7 +305,11 @@ void TwitchAuth::LoadSecondaryUIPanes()
 	info->setFloating(true);
 	info->setFloating(true);
 	stat->setFloating(true);
 	stat->setFloating(true);
 
 
+	QSize statSize = stat->frameSize();
+
 	info->move(pos.x() + 50, pos.y() + 50);
 	info->move(pos.x() + 50, pos.y() + 50);
+	stat->move(pos.x() + size.width()  / 2 - statSize.width()  / 2,
+	           pos.y() + size.height() / 2 - statSize.height() / 2);
 
 
 	if (firstLoad) {
 	if (firstLoad) {
 		info->setVisible(true);
 		info->setVisible(true);