#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "tabs.h"
#include <QHBoxLayout>
MainWindow
::MainWindow(QWidget *parent
) :{
//Add a tab bar at the top
//tab_main->setTabsClosable(true); //shows a x but doesn't work i.e doesn't close tab
SystemTab *tab1 = new SystemTab;
LiveTrafficTab *tab2 = new LiveTrafficTab;
PacketPoolTab * tab3 = new PacketPoolTab;
ConnectionPoolTab *tab4 = new ConnectionPoolTab;
HostPoolTab *tab5 = new HostPoolTab;
ReportsTab *tab6 = new ReportsTab;
MoreTab *tab7 = new MoreTab;
tab_main->addTab(tab1, tr("System") );
tab_main->addTab(tab2, tr("Live Traffic"));
tab_main->addTab(tab3, tr("Packet Pool"));
tab_main->addTab(tab4, tr("Connection\nPool"));
tab_main->addTab(tab5, tr("Host Pool"));
tab_main->addTab(tab6, tr("Reports"));
tab_main->addTab(tab7, tr("More"));
start->setStyleSheet("QPushButton {"
"margin-left: 1px;"
"border: 2px solid;"
"height: 50px;"
"width: 50px;"
"font: 12pt;"
"font: bold;"
"background-color:white;"
"border-top-left-radius:20px;"
"border-top-right-radius: 20px;"
"border-bottom-left-radius: 20px;"
"border-bottom-right-radius: 20px;"
"} QPushButton::selected{color:#000000; background-color:red;}"
); //all features should be set in one statement with stylesheet
stop->setStyleSheet("QPushButton {"
"margin-left: 1px;"
"border: 2px solid;"
"height: 50px;"
"width: 50px;"
"font: 12pt;"
"font: bold;"
"background-color:white;"
"border-top-left-radius:20px;"
"border-top-right-radius: 20px;"
"border-bottom-left-radius: 20px;"
"border-bottom-right-radius: 20px;"
"} QPushButton::selected{color:#000000; background-color:red;}"
); //all features should be set in one statement with stylesheet
start
->setIcon
(QIcon("/home/gita/Traffic/start-icon.png"));
tab_main->setCornerWidget(start, Qt::TopLeftCorner);
stop
->setIcon
(QIcon("/home/gita/Traffic/Stop-Normal-Red-icon.png"));
tab_main->setCornerWidget(stop, Qt::TopRightCorner);
//tab_main->setTabShape(QTabWidget::Triangular); //default is rectangular
tab_main->setStyleSheet("QTabBar::tab {"
"selection-color: yellow;"
"margin-left: 1px;"
"border: 2px solid;"
"height: 50px;"
"width: 150px;"
"font:12pt;"
"font: bold;"
"background-color:white;"
"border-top-left-radius:20px;"
"border-top-right-radius: 20px;"
"border-bottom-left-radius: 20px;"
"border-bottom-right-radius: 20px;"
"} QTabBar::tab:selected{color:#000000; background-color:#C2DFFF; QTabBar::pane{color:red;}}"
); //all features should be set in one statement with stylesheet
vLayout->addWidget(tab_main);
vLayout->setSpacing(2);
setCentralWidget(centralWidget);
//tab_main->setFixedSize(500,500);
centralWidget->setLayout(vLayout);
}
MainWindow::~MainWindow()
{
delete ui;
}