nesca/nesca_3.h

271 lines
6.8 KiB
C
Raw Permalink Normal View History

2015-02-24 14:00:19 +00:00
#ifndef nesca_3_H
#define nesca_3_H
2015-03-07 17:31:48 +00:00
//Include windows.h ONLY *after* qdatetime.h
//Bug: https://bugreports.qt.io/browse/QTBUG-31469
#include <qdatetime.h>
2015-02-24 14:00:19 +00:00
#include <QMainWindow>
#include <qapplication.h>
#include <qgraphicsitem.h>
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QGraphicsItem>
2015-02-24 14:14:32 +00:00
#include <QSystemTrayIcon>
#include <QtGui/qevent.h>
2015-02-24 14:00:19 +00:00
#include <qthread.h>
#include <qtextcodec.h>
#if defined(WIN32)
#include <libssh/libssh.h>
#endif
2015-02-24 14:00:19 +00:00
#include <QStringListModel>
#include <QStandardItemModel>
#include <QList>
2016-01-06 20:40:43 +00:00
#include <ui_nesca_3.h>
2015-08-07 22:37:28 +00:00
2015-02-24 14:00:19 +00:00
extern Ui::nesca_3Class *ui;
extern bool widgetIsHidden, QOSWait,
ME2ScanFlag, QoSScanFlag, VoiceScanFlag, PieStatFlag,
smBit_8, smBit_7, smBit_6, smBit_5, smBit_4, smBit_3, smBit_2, smBit_1;
2015-02-24 14:00:19 +00:00
extern float QoSStep;
extern QVector<int> vAlivLst, vAnomLst, vWFLst, vSuspLst, vLowlLst, vBALst, vSSHLst, vOvrlLst, actLst;
extern QList<int> lstOfLabels;
extern QSystemTrayIcon *tray;
2015-08-07 22:37:28 +00:00
extern QStandardItemModel *BAModel;
2015-02-24 14:00:19 +00:00
class nesca_3 : public QMainWindow
{
Q_OBJECT
public:
2015-08-07 22:37:28 +00:00
nesca_3(bool isWM, QWidget *parent);
2015-02-24 14:00:19 +00:00
~nesca_3();
void ConnectEvrthng();
2016-01-06 20:40:43 +00:00
// void ChangeLabelIpRange_Value(QString str);
// void ChangeLabelIPS_Value(QString str);
// void newListItem(QString str);
2015-08-07 22:37:28 +00:00
static int addBARow(QString ip, QString loginPass, QString percentage);
bool etEventFilter(QObject* object, QEvent* event);
2015-03-20 14:28:51 +00:00
public:
static int perc;
2015-08-09 11:22:02 +00:00
static int savedTabIndex;
2015-02-24 14:00:19 +00:00
protected:
bool eventFilter(QObject* obj, QEvent *event);
void run();
QString GetSSLContent(QString str);
void SSLConnect(QString str);
protected slots:
void saveTLD(QString str);
2015-03-23 21:49:38 +00:00
void onLinkClicked(QUrl);
2015-02-24 14:00:19 +00:00
void MaxBrutingThr_ChangeValue(QString str);
void ThreadDelay_ChangeValue(QString val);
void ChangePingerOK(bool val);
void changeNSTrackLabel(bool status);
2015-02-27 13:55:35 +00:00
void DNSLine_ValueChanged();
void slotShowRedVersion();
2015-03-10 14:35:50 +00:00
void slotTabChanged(int index);
2015-02-24 14:00:19 +00:00
void IPScanSeq();
void DNSScanSeq();
void ImportScanSeq();
void smReaction();
void slotShowDataflow();
2015-03-10 20:09:05 +00:00
void slotOutData(QString str);
2015-02-24 14:00:19 +00:00
void slotIncData(QString ip, QString str);
void slotShowServerMsg(QString str);
2015-03-22 00:43:15 +00:00
void slotSaveImage(QAction *qwe);
2015-02-24 14:00:19 +00:00
void slotUpdatePie();
2015-03-23 12:52:07 +00:00
void slotClearLogs();
2015-02-24 14:00:19 +00:00
void slotDrawVoiceGrid(int factor);
2015-03-23 12:52:07 +00:00
void slotDrawTextPlacers();
2016-01-06 20:40:43 +00:00
// void CheckPersKey();
// bool CheckPersKeyMain();
2015-03-23 12:52:07 +00:00
void slotRestoreDefPorts();
void switchToJobMode();
2015-02-24 14:00:19 +00:00
void switchDataFields();
void importAndScan();
void slotQoSAddGrid();
void slotVoiceAddLine();
void slotDrawDelimLines();
void slotDrawActivityLine(QString data);
void slotDrawActivityGrid();
void activateME2ScanScene();
void activateQoSScanBut();
void activateVoiceScanBut();
void activatePieStatBut();
void slotAddPolyLine();
void slotQoSAddLine();
void slotAddLine(int x1, int y1, int x2, int y2);
void slotDrawGrid();
void exitButtonClicked();
void trayButtonClicked();
void mouseMoveEvent(QMouseEvent * event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void logoLabelClicked();
void startScanButtonClicked();
void startScanButtonClickedDNS();
2015-03-20 14:28:51 +00:00
void saveOptions();
2015-02-24 14:00:19 +00:00
void ChangeTrackerOK(bool val);
void ChangeShuffle(bool val);
void ChangeLabelThreads_ValueChanged(QString);
void PingTO_ChangeValue(QString);
void ChangeLabelTO_ValueChanged(QString);
void appendErrText(QString str);
void appendOKText(QString str);
void appendTextCustom(QString str, QString color);
2015-02-24 14:00:19 +00:00
void appendDebugText(QString str);
void appendNotifyText(QString str);
2015-03-23 12:52:07 +00:00
void appendDefaultText(QString str);
void STTTerminate();
2015-04-03 14:36:22 +00:00
void drawVerboseArcs(unsigned long gTargets);
2015-05-01 15:30:14 +00:00
void finishLoading();
2015-04-23 05:23:02 +00:00
void slotBlockButtons(bool value);
2015-08-07 22:37:28 +00:00
//BA TablelistView
void slotChangeBARow(const int index, const QString loginPass, const QString percentage);
2016-02-28 16:07:10 +00:00
void slotEditFilter();
2015-08-07 22:37:28 +00:00
2015-02-24 14:00:19 +00:00
private:
QPoint dragPosition;
};
class PieStatView : public QGraphicsView
{
Q_OBJECT
public:
PieStatView(QWidget *parent = 0) : QGraphicsView(parent) {};
public:
void contextMenuEvent(QContextMenuEvent *event);
};
2015-08-07 22:37:28 +00:00
class PekoWidget : public QWidget
{
Q_OBJECT;
public:
static int m_xPos;
static int m_yPos;
static int m_windowCounter;
static int offset;
PekoWidget(QWidget *parent = 0) : QWidget(parent)
{
}
PekoWidget(const int qmwXPos, const int qmwYPos, QWidget *parent = 0) : QWidget(parent)
{
offset = 5;
setWindowFlags(Qt::FramelessWindowHint | Qt::SubWindow);
installEventFilter(this);
setStyleSheet(
"background-color:qlineargradient(spread:pad, x1:0.541, y1:0.500364, x2:0.54, y2:0, stop:0 rgba(16, 16, 16, 255), stop:1 rgba(0, 0, 0, 255));");
if (m_xPos >= 1200) {
m_xPos = 305;
offset += 5;
}
setGeometry(qmwXPos - m_xPos, qmwYPos + m_yPos, 300, 200);
if (m_windowCounter++ < 3) {
m_yPos += 200 + offset;
}
else {
m_windowCounter = 0;
m_xPos += 305;
m_yPos = 0;
}
};
2015-11-08 15:44:33 +00:00
protected slots:
void pekoExitButtonClicked();
2015-08-07 22:37:28 +00:00
protected:
bool switchWindows;
void paintEvent(QPaintEvent *e)
{
QPainter painter(this);
painter.setPen(QColor(255, 255, 255, 60));
painter.drawRoundedRect(0, 0, width() - 1, height() - 1, 0, 1);
QWidget::paintEvent(e);
}
void mousePressEvent(QMouseEvent *evt)
{
switchWindows = false;
if (evt->button() == Qt::LeftButton)
{
switchWindows = true;
oldPos = evt->globalPos();
evt->accept();
}
else if (evt->button() == Qt::RightButton)
{
ui->newMessageLabel->setStyleSheet("color:rgba(255, 0, 0, 0);background-color: rgba(2, 2, 2, 0);");
2015-11-08 15:44:33 +00:00
this->close();
2015-08-07 22:37:28 +00:00
};
}
void mouseMoveEvent(QMouseEvent *evt)
{
switchWindows = false;
const QPoint delta = evt->globalPos() - oldPos;
move(x() + delta.x(), y() + delta.y());
oldPos = evt->globalPos();
}
void mouseReleaseEvent()
{
if (switchWindows)
{
switchWindows = false;
};
}
private:
QPoint oldPos;
};
2015-02-24 14:00:19 +00:00
class PopupMsgWidget : public QWidget
{
Q_OBJECT
public:
PopupMsgWidget(QWidget* parent = 0) : QWidget(parent)
{ };
public: signals: void clicked(bool checked = false);
protected:
bool switchWindows;
void mousePressEvent(QMouseEvent *evt)
{
switchWindows = false;
if (evt->button() == Qt::LeftButton)
{
switchWindows = true;
oldPos = evt->globalPos();
evt->accept();
}
else if (evt->button() == Qt::RightButton)
{
ui->newMessageLabel->setStyleSheet("color:rgba(255, 0, 0, 0);background-color: rgba(2, 2, 2, 0);");
this->hide();
};
}
void mouseMoveEvent(QMouseEvent *evt)
{
switchWindows = false;
const QPoint delta = evt->globalPos() - oldPos;
move(x()+delta.x(), y()+delta.y());
oldPos = evt->globalPos();
}
2015-02-24 14:14:32 +00:00
void mouseReleaseEvent()
2015-02-24 14:00:19 +00:00
{
if(switchWindows)
{
2015-03-23 12:52:07 +00:00
switchWindows = false;
2015-02-24 14:00:19 +00:00
};
}
private:
QPoint oldPos;
};
#endif // nesca_3_H