mirror of
https://github.com/chris2511/xca.git
synced 2026-09-12 19:51:05 +05:00
If I select "Quit xca" from the "xca" menu, the application exits gracefully. Unify code paths between "Quit xca", CMD-Q, ALT-F4 and [X] button by calling mainwindow->close() from qApplication->quit() slot.
64 lines
1.3 KiB
C++
64 lines
1.3 KiB
C++
/* vi: set sw=4 ts=4:
|
|
*
|
|
* Copyright (C) 2001 - 2015 Christian Hohnstaedt.
|
|
*
|
|
* All rights reserved.
|
|
*/
|
|
|
|
#ifndef __MAIN_H
|
|
#define __MAIN_H
|
|
|
|
#include <QApplication>
|
|
#include <QAction>
|
|
#include <QTranslator>
|
|
#include <QLocale>
|
|
#include "widgets/MainWindow.h"
|
|
#include "entropy.h"
|
|
|
|
extern char segv_data[1024];
|
|
|
|
class XcaTranslator : public QTranslator
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
XcaTranslator(QObject *p = NULL) : QTranslator(p) { }
|
|
bool load(const QLocale &locale, const QString &filename,
|
|
const QString &dir)
|
|
{
|
|
#if 0
|
|
return QTranslator::load(locale, filename, "_", dir, ".qm");
|
|
#else
|
|
return QTranslator::load(QString("%1_%2").arg(filename).arg(locale.name()), dir);
|
|
#endif
|
|
}
|
|
};
|
|
|
|
class XCA_application : public QApplication
|
|
{
|
|
Q_OBJECT
|
|
|
|
private:
|
|
MainWindow *mainw;
|
|
XcaTranslator *qtTr;
|
|
XcaTranslator *xcaTr;
|
|
static QLocale lang;
|
|
Entropy entropy;
|
|
static QList<QLocale> langAvail;
|
|
|
|
public:
|
|
XCA_application(int &argc, char *argv[]);
|
|
virtual ~XCA_application();
|
|
void setMainwin(MainWindow *m);
|
|
void setupLanguage(QLocale lang);
|
|
static QLocale language() { return lang; }
|
|
static QFont tableFont;
|
|
static bool languageAvailable(QLocale l);
|
|
bool eventFilter(QObject *watched, QEvent *ev);
|
|
bool notify(QObject* receiver, QEvent* event);
|
|
|
|
public slots:
|
|
void switchLanguage(QAction* a);
|
|
void quit();
|
|
};
|
|
#endif
|