From 3c9eaad5ce26a0e8f234b43a4a00ec8fd4902c59 Mon Sep 17 00:00:00 2001 From: Koncord Date: Thu, 12 Jan 2017 10:46:48 +0800 Subject: [PATCH] Rename Main class to MainWindow --- apps/netlauncher/CMakeLists.txt | 4 ++-- apps/netlauncher/{Main.cpp => MainWindow.cpp} | 20 +++++++++---------- apps/netlauncher/{Main.hpp => MainWindow.hpp} | 6 +++--- apps/netlauncher/main.cpp | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) rename apps/netlauncher/{Main.cpp => MainWindow.cpp} (92%) rename apps/netlauncher/{Main.hpp => MainWindow.hpp} (82%) diff --git a/apps/netlauncher/CMakeLists.txt b/apps/netlauncher/CMakeLists.txt index 24b2fed00..1d9a12739 100644 --- a/apps/netlauncher/CMakeLists.txt +++ b/apps/netlauncher/CMakeLists.txt @@ -6,7 +6,7 @@ set(NETLAUNCHER_UI ) set(NETLAUNCHER main.cpp - Main.cpp + MainWindow.cpp ServerModel.cpp NetController.cpp ServerInfoDialog.cpp @@ -16,7 +16,7 @@ set(NETLAUNCHER ) set(NETLAUNCHER_HEADER_MOC - Main.hpp + MainWindow.hpp ServerModel.hpp ServerInfoDialog.hpp ) diff --git a/apps/netlauncher/Main.cpp b/apps/netlauncher/MainWindow.cpp similarity index 92% rename from apps/netlauncher/Main.cpp rename to apps/netlauncher/MainWindow.cpp index 57c16bb3d..a68c10a5e 100644 --- a/apps/netlauncher/Main.cpp +++ b/apps/netlauncher/MainWindow.cpp @@ -2,7 +2,7 @@ // Created by koncord on 06.01.17. // -#include "Main.hpp" +#include "MainWindow.hpp" #include "NetController.hpp" #include "ServerInfoDialog.hpp" #include @@ -10,7 +10,7 @@ using namespace Process; -Main::Main(QWidget *parent) +MainWindow::MainWindow(QWidget *parent) { setupUi(this); @@ -36,12 +36,12 @@ Main::Main(QWidget *parent) connect(tblFavorites, SIGNAL(clicked(QModelIndex)), this, SLOT(serverSelected())); } -Main::~Main() +MainWindow::~MainWindow() { delete mGameInvoker; } -void Main::addServer() +void MainWindow::addServer() { int id = tblServerBrowser->selectionModel()->currentIndex().row(); @@ -52,7 +52,7 @@ void Main::addServer() } } -void Main::addServerByIP() +void MainWindow::addServerByIP() { bool 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) return; @@ -79,7 +79,7 @@ void Main::deleteServer() } } -bool Main::refresh() +bool MainWindow::refresh() { return NetController::get()->updateInfo(proxyModel->sourceModel()); /*tblServerBrowser->resizeColumnToContents(ServerData::HOSTNAME); @@ -88,7 +88,7 @@ bool Main::refresh() tblFavorites->resizeColumnToContents(ServerData::MODNAME);*/ } -void Main::play() +void MainWindow::play() { QTableView *curTable = tabWidget->currentIndex() ? tblFavorites : tblServerBrowser; int id = curTable->selectionModel()->currentIndex().row(); @@ -111,7 +111,7 @@ void Main::play() return qApp->quit(); } -void Main::tabSwitched(int index) +void MainWindow::tabSwitched(int index) { if(index == 0) { @@ -127,7 +127,7 @@ void Main::tabSwitched(int index) actionAdd->setEnabled(false); } -void Main::serverSelected() +void MainWindow::serverSelected() { actionPlay->setEnabled(true); if(tabWidget->currentIndex() == 0) diff --git a/apps/netlauncher/Main.hpp b/apps/netlauncher/MainWindow.hpp similarity index 82% rename from apps/netlauncher/Main.hpp rename to apps/netlauncher/MainWindow.hpp index e896d9a3e..918f27bf8 100644 --- a/apps/netlauncher/Main.hpp +++ b/apps/netlauncher/MainWindow.hpp @@ -11,12 +11,12 @@ #include #include -class Main : public QMainWindow, private Ui::MainWindow +class MainWindow : public QMainWindow, private Ui::MainWindow { Q_OBJECT public: - explicit Main(QWidget *parent = 0); - virtual ~Main(); + explicit MainWindow(QWidget *parent = 0); + virtual ~MainWindow(); protected: public slots: bool refresh(); diff --git a/apps/netlauncher/main.cpp b/apps/netlauncher/main.cpp index 885ead8e6..406177c7f 100644 --- a/apps/netlauncher/main.cpp +++ b/apps/netlauncher/main.cpp @@ -1,7 +1,7 @@ #include #include #include -#include "Main.hpp" +#include "MainWindow.hpp" #include "NetController.hpp" std::string loadSettings (Settings::Manager & settings) @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) NetController::Create(addr, port); atexit(NetController::Destroy); QApplication app(argc, argv); - Main d; + MainWindow d; if (d.refresh()) { d.show();