@@ -19,17 +19,22 @@ Q_DECLARE_LOGGING_CATEGORY(customcommand)
1919
2020CustomCommandPlugin::CustomCommandPlugin (QObject *parent) : MainWindowPluginInterface(parent)
2121{
22+ qCDebug (customcommand) << " Creating CustomCommandPlugin" ;
2223 Utils::set_Object_Name (this );
2324 m_pluginName = " Custom Command" ;
25+ qCDebug (customcommand) << " Plugin name set to:" << m_pluginName;
2426}
2527
2628void CustomCommandPlugin::initPlugin (MainWindow *mainWindow)
2729{
30+ qCDebug (customcommand) << " Initializing CustomCommandPlugin" ;
2831 m_mainWindow = mainWindow;
2932 connect (m_mainWindow, &MainWindow::showPluginChanged, this , &CustomCommandPlugin::doShowPlugin);
3033 connect (m_mainWindow, &MainWindow::quakeHidePlugin, this , [ = ]() {
34+ qCDebug (customcommand) << " Hiding command panel in quake mode" ;
3135 getCustomCommandTopPanel ()->hide ();
3236 });
37+ qCDebug (customcommand) << " Plugin initialization complete" ;
3338}
3439
3540QAction *CustomCommandPlugin::titlebarMenu (MainWindow *mainWindow)
@@ -45,12 +50,14 @@ QAction *CustomCommandPlugin::titlebarMenu(MainWindow *mainWindow)
4550
4651void CustomCommandPlugin::initCustomCommandTopPanel ()
4752{
53+ qCDebug (customcommand) << " Initializing custom command top panel" ;
4854 m_customCommandTopPanel = new CustomCommandTopPanel (m_mainWindow->centralWidget ());
4955 m_customCommandTopPanel->setObjectName (" CustomCustomCommandTopPanel" );// Add by ut001000 renfeixiang 2020-08-14
5056 connect (m_customCommandTopPanel,
5157 &CustomCommandTopPanel::handleCustomCurCommand,
5258 this ,
5359 &CustomCommandPlugin::doCustomCommand);
60+ qCDebug (customcommand) << " Custom command top panel initialized" ;
5461}
5562
5663CustomCommandTopPanel *CustomCommandPlugin::getCustomCommandTopPanel ()
@@ -63,40 +70,50 @@ CustomCommandTopPanel *CustomCommandPlugin::getCustomCommandTopPanel()
6370
6471void CustomCommandPlugin::doCustomCommand (const QString &strTxt)
6572{
73+ qCDebug (customcommand) << " Executing custom command:" << strTxt;
6674 if (!strTxt.isEmpty ()) {
75+ qCInfo (customcommand) << " Sending command to terminal:" << strTxt;
6776 m_mainWindow->currentPage ()->sendTextToCurrentTerm (strTxt);
6877 m_mainWindow->focusCurrentPage ();
6978 /* ******* Add by nt001000 renfeixiang 2020-05-28:增加 使用mainwindow的hideplugin函数隐藏自定义窗口bug#21992 Begin***************/
79+ qCDebug (customcommand) << " Hiding plugin after command execution" ;
7080 m_mainWindow->showPlugin (MainWindow::PLUGIN_TYPE_NONE );
7181 /* ******* Add by nt001000 renfeixiang 2020-05-28:增加 使用mainwindow的hideplugin函数隐藏自定义窗口bug#21992 End***************/
7282 }
7383 emit doHide ();
84+ qCDebug (customcommand) << " Command execution complete" ;
7485}
7586
7687void CustomCommandPlugin::doShowPlugin (const QString name, bool bSetFocus)
7788{
89+ qCDebug (customcommand) << " Show plugin called for:" << name << " with focus:" << bSetFocus;
7890 if (MainWindow::PLUGIN_TYPE_CUSTOMCOMMAND != name) {
7991 // 若插件已经显示,则隐藏
8092 if (m_isShow) {
81- qCWarning (customcommand) << " Command top panel hide " ;
93+ qCInfo (customcommand) << " Hiding command top panel" ;
8294 getCustomCommandTopPanel ()->hideAnim ();
8395 m_isShow = false ;
8496 }
8597 } else {
8698 /* ******* Add by nt001000 renfeixiang 2020-05-18:修改雷神窗口太小时,自定义界面使用不方便,将雷神窗口变大适应正常的自定义界面 Begin***************/
8799 if (m_mainWindow->isQuakeMode () && m_mainWindow->height () < LISTMINHEIGHT ) {
100+ qCDebug (customcommand) << " Adjusting quake window size for command panel" ;
88101 // 因为拉伸函数设置了FixSize,导致自定义界面弹出时死循环,然后崩溃的问题
89102 QuakeWindow *quakeWindow = qobject_cast<QuakeWindow *>(m_mainWindow);
90- if (!quakeWindow)
103+ if (!quakeWindow) {
104+ qCWarning (customcommand) << " Failed to cast to QuakeWindow" ;
91105 return ;
106+ }
92107 quakeWindow->switchEnableResize (true );
93108 m_mainWindow->resize (m_mainWindow->width (), LISTMINHEIGHT ); // 首先设置雷神界面的大小
94109 m_mainWindow->showPlugin (MainWindow::PLUGIN_TYPE_CUSTOMCOMMAND );// 重新打开自定义界面,当前流程结束
95110 // 窗口弹出后,重新判断雷神窗口是否需要有拉伸属性
96111 quakeWindow->switchEnableResize ();
112+ qCDebug (customcommand) << " Quake window size adjusted" ;
97113 return ;
98114 }
99115 /* ******* Add by nt001000 renfeixiang 2020-05-18:修改雷神窗口太小时,自定义界面使用不方便,将雷神窗口变大适应正常的自定义界面 End***************/
116+ qCInfo (customcommand) << " Showing command top panel" ;
100117 getCustomCommandTopPanel ()->show (bSetFocus);
101118 m_isShow = true ;
102119 }
0 commit comments