LeechCraft  0.6.70-10870-g558588d6ec
Modular cross-platform feature rich live environment.
massfontchangedialog.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  * Boost Software License - Version 1.0 - August 17th, 2003
6  *
7  * Permission is hereby granted, free of charge, to any person or organization
8  * obtaining a copy of the software and accompanying documentation covered by
9  * this license (the "Software") to use, reproduce, display, distribute,
10  * execute, and transmit the Software, and to prepare derivative works of the
11  * Software, and to permit third-parties to whom the Software is furnished to
12  * do so, all subject to the following:
13  *
14  * The copyright notices in the Software and this entire statement, including
15  * the above license grant, this restriction and the following disclaimer,
16  * must be included in all copies of the Software, in whole or in part, and
17  * all derivative works of the Software, unless such copies or derivative
18  * works are solely in the form of machine-executable object code generated by
19  * a source language processor.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
24  * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
25  * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  **********************************************************************/
29 
30 #include "massfontchangedialog.h"
31 #include <util/sll/qtutil.h>
32 
33 namespace LeechCraft
34 {
35 namespace Util
36 {
38  const QList<IWkFontsSettable::FontFamily>& families, QWidget *parent)
39  : QDialog { parent }
40  {
41  Ui_.setupUi (this);
42 
43  Family2Box_ [IWkFontsSettable::FontFamily::StandardFont] = Ui_.StandardBox_;
44  Family2Box_ [IWkFontsSettable::FontFamily::FixedFont] = Ui_.FixedBox_;
45  Family2Box_ [IWkFontsSettable::FontFamily::SerifFont] = Ui_.SerifBox_;
46  Family2Box_ [IWkFontsSettable::FontFamily::SansSerifFont] = Ui_.SansSerifBox_;
47  Family2Box_ [IWkFontsSettable::FontFamily::CursiveFont] = Ui_.CursiveBox_;
48  Family2Box_ [IWkFontsSettable::FontFamily::FantasyFont] = Ui_.FantasyBox_;
49 
50  for (const auto family : families)
51  Family2Box_ [family]->setCheckState (Qt::Checked);
52 
53  Ui_.FontChooser_->SetFont (font);
54  }
55 
57  {
58  return Ui_.FontChooser_->GetFont ();
59  }
60 
62  {
64  for (const auto& pair : Util::Stlize (Family2Box_))
65  if (pair.second->checkState () == Qt::Checked)
66  result << pair.first;
67  return result;
68  }
69 }
70 }
auto Stlize(Assoc &&assoc) -> detail::StlAssocRange< detail::Identity, detail::Identity, decltype(assoc.begin()), Assoc, PairType >
Converts an Qt&#39;s associative sequence assoc to an STL-like iteratable range.
Definition: qtutil.h:166
QList< IWkFontsSettable::FontFamily > GetFamilies() const
MassFontChangeDialog(const QFont &, const QList< IWkFontsSettable::FontFamily > &, QWidget *=nullptr)