示例#1
0
void MainWindow::createActions()
{
	openAction = new QAction(tr("&Otevřít seznam..."), this);
	openAction->setIcon(QIcon(":/images/fileopen.svg"));
	openAction->setShortcut(QKeySequence::Open);
	openAction->setStatusTip(tr("Otevřít existující soubor se seznamem"));
	QObject::connect(openAction, SIGNAL(triggered()),
					 mainWidget, SLOT(openDatabase()));

	saveAction = new QAction(QIcon(":/images/filesave.svg"),
							 tr("&Uložit seznam"), this);
	saveAction->setShortcut(QKeySequence::Save);
	QObject::connect(saveAction, SIGNAL(triggered()),
					 mainWidget, SLOT(saveDatabase()));

	saveAsAction = new QAction(QIcon(":/images/filesaveas.svg"),
							   tr("&Uložit seznam jako..."), this);
	saveAsAction->setShortcut(QKeySequence::SaveAs);
	QObject::connect(saveAsAction, SIGNAL(triggered()),
					 mainWidget, SLOT(saveDatabaseAs()));

	findAction = new QAction(tr("&Vyhledat položku..."), this);
	findAction->setIcon(QIcon(":/images/search.svg"));
	findAction->setShortcut(QKeySequence::Find);
	findAction->setStatusTip(tr("Vyhledat položku v otevřeném seznamu"));
	QObject::connect(findAction, SIGNAL(triggered()),
					 mainWidget, SLOT(findFile()));

	exportAction = new QAction(tr("&Exportovat seznam..."), this);
	exportAction->setIcon(QIcon(":/images/export.svg"));
	exportAction->setShortcut(QKeySequence("Ctrl+E"));
	exportAction->setStatusTip(tr("Exportovat seznam do HTML"));
	QObject::connect(exportAction, SIGNAL(triggered()),
					 mainWidget, SLOT(exportDatabase()));

	settingsAction = new QAction(tr("&Nastavení..."), this);
	settingsAction->setIcon(QIcon(":/images/settings.svg"));
	settingsAction->setStatusTip(tr("Upravit nastavení programu"));
	QObject::connect(settingsAction, SIGNAL(triggered()),
					 mainWidget, SLOT(editSettings()));

	viewPhoneListAction = new QAction(tr("&Zobrazit seznam linek..."), this);
	viewPhoneListAction->setIcon(QIcon(":/images/spreadsheet.svg"));
	QObject::connect(viewPhoneListAction, SIGNAL(triggered()),
					 mainWidget, SLOT(viewPhoneList()));

	aboutQtAction = new QAction(tr("O toolkitu &Qt"), this);
	aboutQtAction->setIcon(QIcon(":/images/qt.png"));
	aboutQtAction->setShortcut(QKeySequence(tr("Ctrl+Q")));
	QObject::connect(aboutQtAction, SIGNAL(triggered()),
					 qApp, SLOT(aboutQt()));
}
示例#2
0
ExportDialog::ExportDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ExportDialog)
{
    ui->setupUi(this);

#ifdef Q_WS_MAC
    setWindowFlags((windowFlags() & ~Qt::WindowType_Mask) | Qt::Sheet);
    setStyleSheet(styleSheet() + " #ExportDialog { border: 1px solid rgba(0, 0, 0, 100); border-top: none; }");
#else
    setWindowFlags((windowFlags() & ~Qt::WindowType_Mask) | Qt::Dialog);
#endif

    connect(ui->buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
    connect(ui->buttonExport, SIGNAL(clicked()), this, SLOT(exportDatabase()));
    connect(ui->buttonChooseDir, SIGNAL(clicked()), this, SLOT(chooseExportDirectory()));
    connect(Manager::instance()->mediaCenterInterface(), SIGNAL(sigExportStarted()), this, SLOT(onExportStarted()));
    connect(Manager::instance()->mediaCenterInterface(), SIGNAL(sigExportProgress(int,int)), this, SLOT(onExportProgress(int,int)));
    connect(Manager::instance()->mediaCenterInterface(), SIGNAL(sigExportDone()), this, SLOT(onExportFinished()));
    connect(Manager::instance()->mediaCenterInterface(), SIGNAL(sigExportRaiseError(QString)), this, SLOT(onExportError(QString)));
}
示例#3
0
SQLConfigWindow::SQLConfigWindow()
{
    setAttribute(Qt::WA_DeleteOnClose, true);

    QVBoxLayout *v = new QVBoxLayout(this);

    QLabel *desc = new QLabel(tr("<b><span style='color:red'>Don't touch anything if you've no clue what SQL is!</span></b><br /><br />For any change to have effect, you need to restart the server."
                                 "<br />If you change the settings without knowledge of what you are doing, you'll probably end up without any users stored anymore.<br/><br/>SQLite is the "
                                 "only system fully supported by default. PostGreSQL needs an external installation, and you then just have to put the .dlls in that are located in PostGreSQL's bin folder in the server folder. "
                                 "MySQL needs the user to get the right DLLs, the MySQL driver and to install a MySQL database too (it is advised to be on linux to do this as this is far less complicated)."));
    desc->setWordWrap(true);
    v->addWidget(desc);

    QLabel *desc2 = new QLabel(tr("If you have a player database from before BW 2, you may want to export it, delete the database file, and rerun the server. That way it's converted and players "
                                  "from that time will have their last login properly stored, which enables the functionality to delete old alts to work fine."));
    desc2->setWordWrap(true);
    v->addWidget(desc2);

    QSettings s("config", QSettings::IniFormat);

    b = new QComboBox();
    b->addItem("SQLite");
    b->addItem("PostGreSQL");
    b->addItem("MySQL");
    v->addLayout(new QSideBySide(new QLabel(tr("SQL Database type: ")), b));
    if (s.value("SQL/Driver").toInt() == SQLCreator::PostGreSQL) {
        b->setCurrentIndex(1);
    } else if (s.value("SQL/Driver").toInt() == SQLCreator::MySQL) {
        b->setCurrentIndex(2);
    }

    name = new QLineEdit();
    name->setText(s.value("SQL/Database").toString());
    v->addLayout(new QSideBySide(new QLabel(tr("Database name: ")), name));
    
    schema = new QLineEdit();
    schema->setText(s.value("SQL/DatabaseSchema", "").toString());
    v->addLayout(new QSideBySide(new QLabel(tr("Schema: ")), schema));

    user = new QLineEdit();
    user->setText(s.value("SQL/User").toString());
    v->addLayout(new QSideBySide(new QLabel(tr("User: "******"SQL/Pass").toString());
    v->addLayout(new QSideBySide(new QLabel(tr("Password: "******"SQL/Host").toString());
    v->addLayout(new QSideBySide(new QLabel(tr("Host: ")), host));

    port = new QSpinBox();
    port->setRange(0, 65535);
    port->setValue(s.value("SQL/Port").toInt());
    v->addLayout(new QSideBySide(new QLabel(tr("Port: ")), port));

    doVacuum = new QCheckBox("Do VACUUM on start if possible (recommended).");
    doVacuum->setChecked(s.value("SQL/VacuumOnStartup", true).toBool());
    v->addWidget(doVacuum);

    QPushButton *exporting = new QPushButton(tr("&Export"));
    connect(exporting, SIGNAL(clicked()), SLOT(exportDatabase()));

    QPushButton *apply = new QPushButton(tr("&Apply"));
    connect(apply, SIGNAL(clicked()), this, SLOT(apply()));

    v->addLayout(new QSideBySide(exporting, apply));

    connect(b, SIGNAL(activated(int)), SLOT(changeEnabled()));
    changeEnabled();
}