[KLF Application][KLF Tools][KLF Backend][KLF Home]
KLatexFormula Project
klfdbus.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * file klfdbus.cpp
3  * This file is part of the KLatexFormula Project.
4  * Copyright (C) 2011 by Philippe Faist
5  * philippe.faist at bluewin.ch
6  * *
7  * This program is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program; if not, write to the *
19  * Free Software Foundation, Inc., *
20  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  ***************************************************************************/
22 /* $Id: klfdbus.cpp 603 2011-02-26 23:14:55Z phfaist $ */
23 
24 #include "klfmainwin.h"
25 #include "klfdbus.h"
26 
27 
29  : QDBusAbstractAdaptor(application), app(application), _mainwin(mainWin)
30 {
31 }
32 
33 
35 {
36 }
37 
39 {
40  if ( ! _mainwin->isVisible() )
41  _mainwin->show();
42 
43  _mainwin->setWindowState(_mainwin->windowState() & ~Qt::WindowMinimized);
44  _mainwin->raise();
45  _mainwin->activateWindow();
46 }
47 
48 Q_NOREPLY void KLFDBusAppAdaptor::quit()
49 {
50  app->quit();
51 }
52 
53 void KLFDBusAppAdaptor::setInputData(const QString& key, const QString& svalue, int ivalue)
54 {
55  if (key == "latex") {
56  _mainwin->slotSetLatex(svalue);
57  } else if (key == "fgcolor") {
58  _mainwin->slotSetFgColor(svalue);
59  } else if (key == "bgcolor") {
60  _mainwin->slotSetBgColor(svalue);
61  } else if (key == "mathmode") {
62  _mainwin->slotSetMathMode(svalue);
63  } else if (key == "preamble") {
64  _mainwin->slotSetPreamble(svalue);
65  } else if (key == "dpi") {
66  _mainwin->slotSetDPI(ivalue);
67  }
68 }
69 
70 void KLFDBusAppAdaptor::setAlterSetting_i(int setting, int value)
71 {
72  _mainwin->alterSetting((KLFMainWin::altersetting_which)setting, value);
73 }
74 void KLFDBusAppAdaptor::setAlterSetting_s(int setting, const QString& value)
75 {
76  _mainwin->alterSetting((KLFMainWin::altersetting_which)setting, value);
77 }
78 
79 void KLFDBusAppAdaptor::evaluateAndSave(const QString& output, const QString& fmt)
80 {
81  _mainwin->slotEvaluateAndSave(output, fmt);
82 }
83 
84 void KLFDBusAppAdaptor::openFile(const QString& fileName)
85 {
86  klfDbg("opening file: "<<fileName) ;
87  _mainwin->openFile(fileName);
88 }
89 void KLFDBusAppAdaptor::openFiles(const QStringList& fileNameList)
90 {
91  klfDbg("opening files: "<<fileNameList) ;
92  _mainwin->openFiles(fileNameList);
93 }
95 {
96  klfDbg("opening data: length="<<data.length()<<", data="<<data) ;
97  _mainwin->openData(data);
98 }
99 
101 {
102  klfDbg("opening files: "<<files) ;
103  _mainwin->openLibFiles(files);
104 }
105 
106 
107 
109  const QDBusConnection &connection, QObject *parent)
110  : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
111 {
112 }
113 
115 {
116 }
117 
119 {
120  QList<QVariant> argumentList;
121  return callWithArgumentList(QDBus::Block, QString("quit"), argumentList);
122 }
123 
125 {
126  QList<QVariant> argumentList;
127  return callWithArgumentList(QDBus::Block, QString("raiseWindow"), argumentList);
128 }
129 
131 {
132  QList<QVariant> argumentList;
133  argumentList << QVariant(key) << QVariant(svalue) << QVariant(ivalue);
134  return callWithArgumentList(QDBus::Block, QString("setInputData"), argumentList);
135 }
136 
138 {
139  QList<QVariant> argumentList;
140  argumentList << QVariant(setting) << QVariant(value);
141  return callWithArgumentList(QDBus::Block, QString("setAlterSetting_i"), argumentList);
142 }
143 
145 {
146  QList<QVariant> argumentList;
147  argumentList << QVariant(setting) << QVariant(value);
148  return callWithArgumentList(QDBus::Block, QString("setAlterSetting_s"), argumentList);
149 }
150 
152 {
153  return callWithArgumentList( QDBus::Block, QString("evaluateAndSave"),
154  QList<QVariant>() << QVariant(output) << QVariant(fmt) );
155 }
156 
158 {
159  return callWithArgumentList( QDBus::Block, QString("openFile"),
160  QList<QVariant>() << QVariant(fileName) );
161 }
163 {
164  return callWithArgumentList( QDBus::Block, QString("openFiles"),
165  QList<QVariant>() << QVariant(fileNameList) );
166 }
168 {
169  return callWithArgumentList( QDBus::Block, QString("openData"),
170  QList<QVariant>() << QVariant(data) );
171 }
172 
174 {
175  QList<QVariant> argumentList;
176  argumentList << QVariant(fnames);
177  return callWithArgumentList(QDBus::Block, QString("importCmdlKLFFiles"), argumentList);
178 }

Generated by doxygen 1.8.2