Пример #1
0
dlgPackageExporter::dlgPackageExporter(QWidget *parent, Host* host) :
    QDialog(parent),
    ui(new Ui::dlgPackageExporter)
{
    mpHost = host;
    ui->setupUi(this);
    treeWidget = ui->treeWidget;

    closeButton = ui->buttonBox->addButton (QDialogButtonBox::Close);
    exportButton = new QPushButton(tr("&Export"));

//
//HEIKO: added ability to make fully fledged Mudlet packages including a package
//       name config file and arbitray additional package content selection.
//       However, this feature is currently restricted to windows only
//       until quazip is part of the other Mudlet builds
//#ifdef Q_OS_WIN
    ui->browseButton->hide();
    ui->filePath->hide();
    ui->textLabel1->hide();
    packageName = QInputDialog::getText(0,"Package Name", "Package Name");
    QString packagePath = QFileDialog::getExistingDirectory(0,"Where do you want to save the package?","Where do you want to save the package?");
    tempDir = QDir::homePath()+"/.config/mudlet/profiles/"+mpHost->getName()+"/tmp/";
    packagePath.replace("\\", "/");
    tempDir = tempDir + "/" + packageName;
    QDir packageDir = QDir(tempDir);
    if ( !packageDir.exists() ){
        packageDir.mkpath(tempDir);
    }
    zipFile = packagePath + "/" + packageName + ".zip";
    filePath = tempDir + "/" + packageName + ".xml";

    QString luaConfig = tempDir + "/config.lua";
    QFile configFile(luaConfig);
    QStringList strings;
    if (configFile.open(QIODevice::WriteOnly | QIODevice::Text))
    {
        QTextStream out(&configFile);
        out << "mpackage = \"" << packageName << "\"\n";
        out.flush();
        configFile.close();
    }
    connect(ui->addFiles, SIGNAL(clicked()), this, SLOT(slot_addFiles()));
//#else
//    ui->addFiles->hide();
//    ui->textLabel1_2->hide();
//    connect(ui->browseButton, SIGNAL(clicked()), this, SLOT(slot_browse_button()));
//    exportButton->setDisabled(true); // disabled by default until the user selects a location
//#endif

    ui->buttonBox->addButton(exportButton, QDialogButtonBox::ResetRole);
    connect(exportButton, SIGNAL(clicked()), this, SLOT(slot_export_package()));

    listTriggers();
    listAliases();
    listKeys();
    listScripts();
    listActions();
    listTimers();
}
Пример #2
0
dlgPackageExporter::dlgPackageExporter(QWidget *parent, Host* host) :
    QDialog(parent),
    ui(new Ui::dlgPackageExporter)
{
    mpHost = host;
    ui->setupUi(this);
    treeWidget = ui->treeWidget;
    connect(ui->browseButton, SIGNAL(clicked()), this, SLOT(slot_browse_button()));

    closeButton = ui->buttonBox->addButton (QDialogButtonBox::Close);

    exportButton = new QPushButton(tr("&Export"));
    exportButton->setDisabled(true); // disabled by default until the user selects a location
    ui->buttonBox->addButton(exportButton, QDialogButtonBox::ResetRole);
    connect(exportButton, SIGNAL(clicked()), this, SLOT(slot_export_package()));

    listTriggers();
    listAliases();
    listKeys();
    listScripts();
    listActions();
    listTimers();
}