Esempio n. 1
0
void LteMainWindow::loadPlugins()
{
    QObjectList objList = QPluginLoader::staticInstances();
    for(QObjectList::iterator it = objList.begin(); it != objList.end(); ++it)
    {
        populateMenus(*it);
    }

    pluginsDir = QDir(qApp->applicationDirPath());
    pluginsDir.cd("plugins");

    QStringList fileList = pluginsDir.entryList(QDir::Files);
    for(QStringList::iterator it = fileList.begin(); it != fileList.end(); ++it)
    {
        QPluginLoader loader(pluginsDir.absoluteFilePath(*it));
        QObject *plugin = loader.instance();
        if(plugin)
        {
            populateMenus(plugin);
            pluginFileNames += *it;
        }
    }

    lteMenu->setEnabled(!lteMenu->actions().isEmpty());
    miscMenu->setEnabled(!miscMenu->actions().isEmpty());
}
Esempio n. 2
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    myHandler = new Handler(this);
    if(myHandler->findWorkingDir()){
        dispDefaultOutputText();
        populateMenus();
    } else {
        ui->outputBox->setText("Error: missing " FWCONFIG_FILENAME);
        this->setEnabled(false);
    }

}
Esempio n. 3
0
void CommandManager::updateActions()
{
    qDeleteAll(mActions);
    mActions.clear();

    const QList<Command> &commands = mModel->allCommands();

    for (int i = 0; i < commands.size(); ++i) {
        const Command &command = commands.at(i);

        if (!command.isEnabled)
            continue;

        QAction *mAction = new QAction(command.name, this);
        mAction->setShortcut(command.shortcut);

        connect(mAction, &QAction::triggered, [this,i] { mModel->execute(i); });

        mActions.append(mAction);
    }

    // Add Edit Commands action
    QAction *mSeparator = new QAction(this);
    mSeparator->setSeparator(true);

    mActions.append(mSeparator);

    mEditCommands = new QAction(this);
    mEditCommands->setIcon(
            QIcon(QLatin1String(":/images/24x24/system-run.png")));
    Utils::setThemeIcon(mEditCommands, "system-run");

    connect(mEditCommands, &QAction::triggered, this, &CommandManager::showDialog);

    mActions.append(mEditCommands);

    retranslateUi();
    populateMenus();
}
Esempio n. 4
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
	_core.loadPlugins("limbs");

	ui->setupUi(this);

	_pluginsManager = new PluginsManagerWidget(this);
	_pluginsManager->setModal(true);
	_pluginsManager->setCore(&_core);
	_pluginsManager->close();

	_settingsWidget = new SettingsWidget(this);
	_settingsWidget->setModal(true);
	_settingsWidget->setCore(&_core);

	connectActions();

	populateMenus();
	populateToolbars();
	populateDocks();
	populateViews();

	populateCommands();

	/*TreeInterface *iTree;
	SerializerInterface *iSerializer;

	foreach(QObject *object, _core.plugins())
	{
		iTree = qobject_cast<TreeInterface *>(object);

		if ( !iTree )
			continue;

		break;
	}

	foreach(QObject *object, _core.plugins())
	{
		iSerializer = qobject_cast<SerializerInterface *>(object);

		if ( !iSerializer )
			continue;

		break;
	}

	_root = iTree->create();

	iSerializer->deserialize(QString("test2.yml"), _root);

	foreach(QObject *object, _core.plugins())
	{
		MainWindowViewInterface *iView;

		iView = qobject_cast<MainWindowViewInterface *>(object);

		if ( !iView )
			continue;

		ui->viewTabs->addTab(iView->newView(_root, this), tr("321"));
		break;
	}*/
}