MCPcopy Create free account
hub / github.com/KDE/labplot / initGUI

Method initGUI

src/frontend/MainWin.cpp:222–434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220}
221
222void MainWin::initGUI(const QString& fileName) {
223 if (statusBar()->isEnabled())
224 statusBar()->showMessage(i18nc("%1 is the LabPlot version", "Welcome to LabPlot %1", QLatin1String(LVERSION)));
225
226 initActions();
227
228#ifdef Q_OS_MAC
229#ifdef HAVE_TOUCHBAR
230 // setup touchbar before GUI (otherwise actions in the toolbar are not selectable)
231 m_touchBar = new KDMacTouchBar(this);
232 // m_touchBar->setTouchButtonStyle(KDMacTouchBar::IconOnly);
233#endif
234 setUnifiedTitleAndToolBarOnMac(true);
235#endif
236 setupGUI();
237
238 // all toolbars created via the KXMLGUI framework are locked on default:
239 // * on the very first program start, unlock all toolbars
240 // * on later program starts, set stored lock status
241 // Furthermore, we want to show icons only after the first program start.
242 KConfigGroup groupMain = Settings::group(QStringLiteral("MainWindow"));
243 if (groupMain.exists()) {
244 // KXMLGUI framework automatically stores "Disabled" for the key "ToolBarsMovable"
245 // in case the toolbars are locked -> load this value
246 const QString& str = groupMain.readEntry(QLatin1String("ToolBarsMovable"), "");
247 bool locked = (str == QLatin1String("Disabled"));
248 KToolBar::setToolBarsLocked(locked);
249 }
250
251 // in case we're starting for the first time, put all toolbars into the IconOnly mode
252 // and maximize the main window. The occurence of LabPlot's own section "MainWin"
253 // indicates whether this is the first start or not
254 groupMain = Settings::group(QStringLiteral("MainWin"));
255 if (!groupMain.exists()) {
256 // first start
257 KToolBar::setToolBarsLocked(false);
258
259 // show icons only
260 const auto& toolbars = factory()->containers(QLatin1String("ToolBar"));
261 for (auto* container : toolbars) {
262 auto* toolbar = dynamic_cast<QToolBar*>(container);
263 if (toolbar)
264 toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
265 }
266
267 showMaximized();
268 }
269
270 initMenus();
271
272 auto* mainToolBar = qobject_cast<QToolBar*>(factory()->container(QLatin1String("main_toolbar"), this));
273
274#ifdef HAVE_CANTOR_LIBS
275 groupMain = Settings::group(QStringLiteral("MainWin"));
276 if (groupMain.exists()) {
277 const QString& lastUsedNotebook = groupMain.readEntry(QLatin1String("lastUsedNotebook"), QString());
278 if (!lastUsedNotebook.isEmpty()) {
279 for (auto* action : m_newNotebookMenu->actions()) {

Callers

nothing calls this directly

Calls 15

groupFunction · 0.85
showMessageMethod · 0.80
existsMethod · 0.80
setToolButtonStyleMethod · 0.80
containerMethod · 0.80
heightMethod · 0.80
setIntervalMethod · 0.80
QStringClass · 0.50
isEmptyMethod · 0.45
toStringMethod · 0.45
dataMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected