Exemplo n.º 1
0
void Statistic::onFTPLoad()
{
	ui.mFTPButton->setEnabled(false);

	CXSettings* settings = CXSettings::inst();
	//считываем настройки
	host = settings->value(E_FTPHost).toString();
  user = CXSettings::inst()->value(E_TelnetUser).toString();
  password = CXSettings::inst()->value(E_TelnetPassword).toString();

  //приходится каждый раз убивать, так как не дает переподключатся
  if(tlClient != NULL){
    delete tlClient;
    tlClient = NULL;
  }
  ui.curOperationLabel->setText(trUtf8("Соединение с сервером..."));
  setCursor(Qt::WaitCursor);
  tlClient = new QtTelnet(this);

  connect(tlClient, SIGNAL(loginRequired()), this, SLOT(telnetLoginRequired()));
  connect(tlClient, SIGNAL(loginFailed()), this, SLOT(telnetLoginFailed()));
  connect(tlClient, SIGNAL(connectionError(QAbstractSocket::SocketError)),
      this, SLOT(telnetConnectionError(QAbstractSocket::SocketError)));
  connect(tlClient, SIGNAL(message(const QString &)),this, SLOT(telnetMessage(const QString &)));

  //соединяемся с telnet клиентом
  if(!tlClient->connectToHost(host, TELNET_PORT)){
    onFtpError(trUtf8("Не удалось подключиться к Telnet-серверу. Сервер недоступен.\n[%1]").arg(host));
  };
}
Exemplo n.º 2
0
Statistic::Statistic(QWidget *parent, Qt::WFlags flags) : QWidget(parent, flags)
{
	Engine::removeOldDirs();

	ui.setupUi(this);
	QString title = trUtf8("Статистика v") + VERSION;
	title += trUtf8(", сборка от "); title +=  __DATE__;
	this->setWindowTitle(title);

	mSettingsDialog = new CXSettingsDialog(this);

	mFtp = new QFtp(this);
	mLoadFile = NULL;
	waitTimer = -1;
	mIsArchiveAccept = false;
	start_arch = false;

	CXSettings* settings = CXSettings::inst();

	if (settings->value(E_StartDate).toDateTime().isValid())
	{
		ui.mStartDateEdit->setDateTime(settings->value(E_StartDate).toDateTime());
		ui.mStartTimeEdit->setTime(settings->value(E_StartDate).toDateTime().time());
	}

	if (settings->value(E_EndDate).toDateTime().isValid())
	{
		ui.mEndDateEdit->setDateTime(settings->value(E_EndDate).toDateTime());
		ui.mEndTimeEdit->setTime(settings->value(E_EndDate).toDateTime().time());
	}

	connect(ui.mArchiveButton,	SIGNAL(clicked()), this, SLOT(onArchiveLoad()));
	connect(ui.mFTPButton,		SIGNAL(clicked()), this, SLOT(onFTPLoad()));
	connect(ui.mReportButton,	SIGNAL(clicked()), this, SLOT(onReport()));
	connect(ui.mSaveReportButton,	SIGNAL(clicked()), this, SLOT(onSaveReport()));
	connect(ui.mSettingsButton,	SIGNAL(clicked()), mSettingsDialog, SLOT(exec()));

	connect(mFtp, SIGNAL(commandStarted(int)), this, SLOT(onCommandStarted(int)));
	connect(mFtp, SIGNAL(commandFinished(int,bool)), this, SLOT(onFtpCommandFinish(int,bool)));
	connect(mFtp, SIGNAL(listInfo(const QUrlInfo&)), this, SLOT(onListInfo(const QUrlInfo&)));
//	connect(mFtp, SIGNAL(readyRead()), this, SLOT(onReadyRead()));

	tlClient = new QtTelnet(this);

	connect(tlClient, SIGNAL(loginRequired()), this, SLOT(telnetLoginRequired()));
  connect(tlClient, SIGNAL(loginFailed()), this, SLOT(telnetLoginFailed()));
  connect(tlClient, SIGNAL(connectionError(QAbstractSocket::SocketError)),
      this, SLOT(telnetConnectionError(QAbstractSocket::SocketError)));
  connect(tlClient, SIGNAL(message(const QString &)),this, SLOT(telnetMessage(const QString &)));

//#ifdef QT_NO_DEBUG
//	ui.mErrorGroupBox->hide();
//#endif
}
Exemplo n.º 3
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    t = new QtTelnet;

    connect(t, SIGNAL(message(const QString &)),
                   this, SLOT(telnetMessage(const QString &)));
    connect(t, SIGNAL(loginRequired()),
                    this, SLOT(telnetLoginRequired()));
    connect(t, SIGNAL(loginFailed()),
                    this, SLOT(telnetLoginFailed()));
    connect(t, SIGNAL(loggedOut()),
                   this, SLOT(telnetLoggedOut()));
    connect(t, SIGNAL(loggedIn()),
                   this, SLOT(telnetLoggedIn()));
    connect(t, SIGNAL(connectionError(QAbstractSocket::SocketError)),
                    this, SLOT(telnetConnectionError(QAbstractSocket::SocketError)));

}