LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
util.cpp
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #include "util.h"
10 #include <QDialogButtonBox>
11 #include <QDialog>
12 #include <QVBoxLayout>
13 #include <xmlsettingsdialog/xmlsettingsdialog.h>
14 
15 namespace LC
16 {
17 namespace Util
18 {
19  XmlSettingsDialog* OpenXSD (const QString& title, const QString& filename, Util::BaseSettingsManager *bsm)
20  {
21  auto lay = new QVBoxLayout;
22 
23  auto xsd = new Util::XmlSettingsDialog;
24  xsd->RegisterObject (bsm, filename);
25  lay->addWidget (xsd->GetWidget ());
26 
27  auto bbox = new QDialogButtonBox { QDialogButtonBox::Ok | QDialogButtonBox::Cancel };
28  lay->addWidget (bbox);
29 
30  auto dia = new QDialog;
31  dia->setLayout (lay);
32 
33  QObject::connect (bbox,
34  SIGNAL (accepted ()),
35  xsd,
36  SLOT (accept ()));
37  QObject::connect (bbox,
38  SIGNAL (rejected ()),
39  xsd,
40  SLOT (reject ()));
41  QObject::connect (bbox,
42  SIGNAL (accepted ()),
43  dia,
44  SLOT (accept ()));
45  QObject::connect (bbox,
46  SIGNAL (rejected ()),
47  dia,
48  SLOT (reject ()));
49 
50  dia->setAttribute (Qt::WA_DeleteOnClose);
51  dia->setWindowTitle (title);
52  dia->show ();
53 
54  return xsd;
55  }
56 }
57 }
LC
Definition: constants.h:14
util.h
LC::Util::OpenXSD
XmlSettingsDialog * OpenXSD(const QString &title, const QString &filename, Util::BaseSettingsManager *bsm)
Opens XML settings dialog for the given XML filename.
Definition: util.cpp:31