MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), _ui( new Ui::MainWindow) { _ui->setupUi( this); _isConnect = false; _wasContact = false; _wasConnect = false; _isLoginCancel = false; _runPostLoginCancel = false; _isLoginDialog = false; _loginContextCode = 0; QLabel* curItemPathLabel = new QLabel; curItemPathLabel->setText("Path:"); _curItemPathStatus = new QLineEdit; _curItemPathStatus->setReadOnly( true); _curItemPathStatus->setStyleSheet("QLineEdit{background: lightgrey;}"); _ui->statusBar->addPermanentWidget( curItemPathLabel); _ui->statusBar->addPermanentWidget( _curItemPathStatus); _timerChatButEff = new QTimer( this); _timerChatButEff->setInterval(20); connect( _timerChatButEff, SIGNAL(timeout()), this, SLOT(doChatButtonEffect())); _countChatButEff = 0; _chatButEff = new QGraphicsColorizeEffect; _chatButEff->setColor( QColor(254,89,6)); _ui->chatButton->setGraphicsEffect( _chatButEff); setChatButEff( false); _appSettings = new QSettings("MicTron", "ArnBrowser"); _settings = new SettingsHandler( _appSettings); _settings->readSettings(); //// Error log from Arn system ArnM::setConsoleError( false); connect( &ArnM::instance(), SIGNAL(errorLogSig(QString,uint,void*)), this, SLOT(errorLog(QString))); //// Prepare connect to Arn server _connector = new Connector( this); _arnClient = new ArnClient( this); _arnClient->setDemandLogin( false); // _arnClient->setReceiveTimeout(5); // Base time for receiver timeout connect( _arnClient, SIGNAL(connectionStatusChanged(int,int)), this, SLOT(doClientStateChanged(int))); connect( _arnClient, SIGNAL(loginRequired(int)), this, SLOT(doStartLogin(int))); connect( _arnClient, SIGNAL(replyInfo(int,QByteArray)), SLOT(doRinfo(int,QByteArray))); connect( _arnClient, SIGNAL(killRequested()), this, SLOT(onKillRequest())); connect( _arnClient, SIGNAL(chatReceived(QString,int)), this, SLOT(onChatReceived(QString,int))); //// Setup model _arnModel = new ArnModel( _connector, this); _arnModel->setClient( _arnClient); _arnModel->start(); connect( _arnModel, SIGNAL(hiddenRow(int,QModelIndex,bool)), this, SLOT(updateHidden(int,QModelIndex,bool))); setWindowTitle(tr("Arn Browser ") + ver); _ui->arnView->setEnabled( false); readSettings(); QString host = _appSettings->value("connect/host").toString(); int port = _appSettings->value("connect/port").toInt(); if (host.isNull()) host = "localhost"; // Default host if (port == 0) port = Arn::defaultTcpPort; _ui->hostEdit->setText( host); // Default host _ui->portEdit->setValue( port); _ui->connectStat->hide(); _chatServWin = new ChatServWindow( _appSettings, this); connect( _chatServWin, SIGNAL(txtOutput(QString)), this, SLOT(doChatAdd(QString))); connect( _chatServWin, SIGNAL(abortKillRequest()), this , SLOT(doAbortKillRequest())); #if QT_VERSION >= 0x050000 && QT_VERSION < 0x050300 _ui->portEdit->setRange( 1, 1065535); // Fix early Qt5 layout bug giving to little space #endif connect( _ui->arnView, SIGNAL(clicked(QModelIndex)), this, SLOT(onItemClick(QModelIndex))); connect( _ui->arnView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onContextMenuRequested(QPoint))); setConnectOffGui(); // Test chat button //_ui->chatButton->setVisible(true); //setChatButEff( true); }
void kd::onDoubleClick(QTreeWidgetItem * item, int column) { onItemClick(item, column); onAddButtonPress(); return; }