Rename Main class to MainWindow

pull/133/head
Koncord 8 years ago
parent 610ba1d867
commit 3c9eaad5ce

@ -6,7 +6,7 @@ set(NETLAUNCHER_UI
) )
set(NETLAUNCHER set(NETLAUNCHER
main.cpp main.cpp
Main.cpp MainWindow.cpp
ServerModel.cpp ServerModel.cpp
NetController.cpp NetController.cpp
ServerInfoDialog.cpp ServerInfoDialog.cpp
@ -16,7 +16,7 @@ set(NETLAUNCHER
) )
set(NETLAUNCHER_HEADER_MOC set(NETLAUNCHER_HEADER_MOC
Main.hpp MainWindow.hpp
ServerModel.hpp ServerModel.hpp
ServerInfoDialog.hpp ServerInfoDialog.hpp
) )

@ -2,7 +2,7 @@
// Created by koncord on 06.01.17. // Created by koncord on 06.01.17.
// //
#include "Main.hpp" #include "MainWindow.hpp"
#include "NetController.hpp" #include "NetController.hpp"
#include "ServerInfoDialog.hpp" #include "ServerInfoDialog.hpp"
#include <qdebug.h> #include <qdebug.h>
@ -10,7 +10,7 @@
using namespace Process; using namespace Process;
Main::Main(QWidget *parent) MainWindow::MainWindow(QWidget *parent)
{ {
setupUi(this); setupUi(this);
@ -36,12 +36,12 @@ Main::Main(QWidget *parent)
connect(tblFavorites, SIGNAL(clicked(QModelIndex)), this, SLOT(serverSelected())); connect(tblFavorites, SIGNAL(clicked(QModelIndex)), this, SLOT(serverSelected()));
} }
Main::~Main() MainWindow::~MainWindow()
{ {
delete mGameInvoker; delete mGameInvoker;
} }
void Main::addServer() void MainWindow::addServer()
{ {
int id = tblServerBrowser->selectionModel()->currentIndex().row(); int id = tblServerBrowser->selectionModel()->currentIndex().row();
@ -52,7 +52,7 @@ void Main::addServer()
} }
} }
void Main::addServerByIP() void MainWindow::addServerByIP()
{ {
bool ok; bool ok;
QString text = QInputDialog::getText(this, tr("Add Server by address"), tr("Address:"), QLineEdit::Normal, "", &ok); QString text = QInputDialog::getText(this, tr("Add Server by address"), tr("Address:"), QLineEdit::Normal, "", &ok);
@ -65,7 +65,7 @@ void Main::addServerByIP()
} }
} }
void Main::deleteServer() void MainWindow::deleteServer()
{ {
if(tabWidget->currentIndex() != 1) if(tabWidget->currentIndex() != 1)
return; return;
@ -79,7 +79,7 @@ void Main::deleteServer()
} }
} }
bool Main::refresh() bool MainWindow::refresh()
{ {
return NetController::get()->updateInfo(proxyModel->sourceModel()); return NetController::get()->updateInfo(proxyModel->sourceModel());
/*tblServerBrowser->resizeColumnToContents(ServerData::HOSTNAME); /*tblServerBrowser->resizeColumnToContents(ServerData::HOSTNAME);
@ -88,7 +88,7 @@ bool Main::refresh()
tblFavorites->resizeColumnToContents(ServerData::MODNAME);*/ tblFavorites->resizeColumnToContents(ServerData::MODNAME);*/
} }
void Main::play() void MainWindow::play()
{ {
QTableView *curTable = tabWidget->currentIndex() ? tblFavorites : tblServerBrowser; QTableView *curTable = tabWidget->currentIndex() ? tblFavorites : tblServerBrowser;
int id = curTable->selectionModel()->currentIndex().row(); int id = curTable->selectionModel()->currentIndex().row();
@ -111,7 +111,7 @@ void Main::play()
return qApp->quit(); return qApp->quit();
} }
void Main::tabSwitched(int index) void MainWindow::tabSwitched(int index)
{ {
if(index == 0) if(index == 0)
{ {
@ -127,7 +127,7 @@ void Main::tabSwitched(int index)
actionAdd->setEnabled(false); actionAdd->setEnabled(false);
} }
void Main::serverSelected() void MainWindow::serverSelected()
{ {
actionPlay->setEnabled(true); actionPlay->setEnabled(true);
if(tabWidget->currentIndex() == 0) if(tabWidget->currentIndex() == 0)

@ -11,12 +11,12 @@
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
#include <components/process/processinvoker.hpp> #include <components/process/processinvoker.hpp>
class Main : public QMainWindow, private Ui::MainWindow class MainWindow : public QMainWindow, private Ui::MainWindow
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit Main(QWidget *parent = 0); explicit MainWindow(QWidget *parent = 0);
virtual ~Main(); virtual ~MainWindow();
protected: protected:
public slots: public slots:
bool refresh(); bool refresh();

@ -1,7 +1,7 @@
#include <QApplication> #include <QApplication>
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
#include <components/files/configurationmanager.hpp> #include <components/files/configurationmanager.hpp>
#include "Main.hpp" #include "MainWindow.hpp"
#include "NetController.hpp" #include "NetController.hpp"
std::string loadSettings (Settings::Manager & settings) std::string loadSettings (Settings::Manager & settings)
@ -43,7 +43,7 @@ int main(int argc, char *argv[])
NetController::Create(addr, port); NetController::Create(addr, port);
atexit(NetController::Destroy); atexit(NetController::Destroy);
QApplication app(argc, argv); QApplication app(argc, argv);
Main d; MainWindow d;
if (d.refresh()) if (d.refresh())
{ {
d.show(); d.show();

Loading…
Cancel
Save