99consoleTab::consoleTab (RedisConnectionConfig& config)
1010{
1111 appendHtml (" <span style='color: orange;'>List of unsupported commands: PTTL, DUMP, RESTORE, AUTH, QUIT, MONITOR</span>" );
12+ appendHtml (" Connecting ..." );
1213
1314 QPalette p = palette ();
1415 p.setColor (QPalette::Base, QColor (57 , 57 , 57 ));
@@ -20,16 +21,23 @@ consoleTab::consoleTab(RedisConnectionConfig& config)
2021 insertPrompt (false );
2122 isLocked = false ;
2223
23- connection = new ConsoleConnectionWrapper (config, *this );
24+ connection = new ConsoleConnectionWrapper (config);
25+ connection->moveToThread (&connectionThread);
2426
27+ connect (&connectionThread, &QThread::finished, connection, &QObject::deleteLater);
2528 connect (this , SIGNAL (onCommand (QString)), connection, SLOT (executeCommand (QString)));
29+ connect (connection, SIGNAL (changePrompt (QString)), this , SLOT (setPrompt (QString)));
30+ connect (connection, SIGNAL (addOutput (QString)), this , SLOT (output (QString)));
31+ connect (&connectionThread, SIGNAL (started ()), connection, SLOT (init ()));
32+
33+ connectionThread.start ();
2634}
2735
2836
2937consoleTab::~consoleTab (void )
3038{
31- // connectionThread.quit();
32- // / connectionThread.wait();
39+ connectionThread.quit ();
40+ connectionThread.wait ();
3341}
3442
3543void consoleTab::setPrompt (QString str)
0 commit comments