1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2014-2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #include <nel/misc/types_nl.h>
18 #include "main_window.h"
27 #include <QScrollArea>
28 #include <QApplication>
32 #include <QDockWidget>
35 #include <QStyleFactory>
36 #include <QMessageBox>
39 // #include <nel/misc/debug.h>
40 #include <nel/misc/i18n.h>
41 #include <nel/3d/u_driver.h>
44 #include "../shared_widgets/command_log.h"
45 #include "panoply_preview.h"
48 using namespace NLMISC
;
54 QString
nli18n(const char *label
)
56 return QString::fromUtf16((const ushort
*)CI18N::get(label
).c_str());
59 } /* anonymous namespace */
61 CMainWindow::CMainWindow(const QMap
<QString
, QSize
> &customSizeHints
, QWidget
*parent
, Qt::WindowFlags flags
)
62 : QMainWindow(parent
, flags
),
63 m_PanoplyPreview(NULL
),
64 m_CommandLog(NULL
), m_CommandLogDock(NULL
),
65 m_WidgetsMenu(NULL
), m_HelpMenu(NULL
),
68 setObjectName("CMainWindow");
69 setWindowTitle(tr("NeL Panoply Preview"));
76 m_PanoplyPreview
= new CPanoplyPreview(this);
77 setCentralWidget(m_PanoplyPreview
);
82 CMainWindow::~CMainWindow()
87 void CMainWindow::createActions()
89 m_AboutAct
= new QAction(this);
90 connect(m_AboutAct
, SIGNAL(triggered()), this, SLOT(about()));
92 m_AboutAct
->setText(tr("About"));
93 m_AboutAct
->setStatusTip(tr("About"));
96 void CMainWindow::createMenus()
98 m_WidgetsMenu
= menuBar()->addMenu(QString::null
);
100 m_HelpMenu
= menuBar()->addMenu(QString::null
);
101 m_HelpMenu
->addAction(m_AboutAct
);
103 m_WidgetsMenu
->setTitle(tr("Widgets"));
104 m_HelpMenu
->setTitle(tr("Help"));
107 void CMainWindow::createToolBars()
112 void CMainWindow::createStatusBar()
114 statusBar()->showMessage(tr("Ready"));
117 void CMainWindow::createDockWindows()
119 // CommandLog (Console)
121 m_CommandLogDock
= new QDockWidget(this);
122 m_CommandLogDock
->setWindowTitle(tr("Console"));
123 m_CommandLogDock
->setAllowedAreas(Qt::TopDockWidgetArea
| Qt::BottomDockWidgetArea
);
124 m_CommandLog
= new NLQT::CCommandLogDisplayer(m_CommandLogDock
);
125 m_CommandLogDock
->setWidget(m_CommandLog
);
126 addDockWidget(Qt::BottomDockWidgetArea
, m_CommandLogDock
);
127 m_WidgetsMenu
->addAction(m_CommandLogDock
->toggleViewAction());
131 void CMainWindow::about()
133 QMessageBox::about(this, tr("Panoply Preview"), tr("Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)"));
136 } /* namespace NLTOOLS */