init
This commit is contained in:
@@ -34,7 +34,7 @@ void cImportIngredientDialog::initIngredientList()
|
||||
{
|
||||
m_lpIngredientListModel = new QStandardItemModel(0, 1);
|
||||
ui->m_lpIngredientList->setModel(m_lpIngredientListModel);
|
||||
connect(ui->m_lpIngredientList->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SLOT(onIngredientListSelectionChanged(QItemSelection,QItemSelection)));
|
||||
connect(ui->m_lpIngredientList->selectionModel(), &QItemSelectionModel::selectionChanged, this, &cImportIngredientDialog::onIngredientListSelectionChanged);
|
||||
}
|
||||
m_lpIngredientListModel->clear();
|
||||
}
|
||||
|
||||
@@ -345,11 +345,24 @@ QString cIngredient::valueFormatted(cIngredient::iIngredient i)
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
str = QString("%1").arg(dValue);
|
||||
break;
|
||||
}
|
||||
|
||||
return(str);
|
||||
}
|
||||
|
||||
cIngredient::MEASURE cIngredient::measure(cIngredient::iIngredient i)
|
||||
{
|
||||
for(int z = 0;z < (int)sizeof(g_groupname)/(int)sizeof(GROUPNAME);z++)
|
||||
{
|
||||
if(g_groupname[z].iIngredient == i)
|
||||
return(g_groupname[z].measure);
|
||||
}
|
||||
return(cIngredient::MEASURE::MEASURE_None);
|
||||
}
|
||||
|
||||
void cIngredient::setValue(cIngredient::iIngredient i, qreal dValue)
|
||||
{
|
||||
m_dValue[i] = dValue;
|
||||
|
||||
@@ -219,6 +219,7 @@ public:
|
||||
void setValue(cIngredient::iIngredient i, qreal dValue);
|
||||
qreal value(cIngredient::iIngredient i);
|
||||
QString valueFormatted(cIngredient::iIngredient i);
|
||||
MEASURE measure(cIngredient::iIngredient i);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
|
||||
+144
-12
@@ -34,7 +34,14 @@ cMainWindow::cMainWindow(QWidget *parent) :
|
||||
m_lpIngredientsListEdit(0),
|
||||
m_lpIngredientsListMenu(0),
|
||||
m_lpDB(0),
|
||||
m_szLastImportPlugin("")
|
||||
m_szLastImportPlugin(""),
|
||||
m_lpWindowMenuCloseAct(0),
|
||||
m_lpWindowMenuCloseAllAct(0),
|
||||
m_lpWindowMenuTileAct(0),
|
||||
m_lpWindowMenuCascadeAct(0),
|
||||
m_lpWindowMenuNextAct(0),
|
||||
m_lpWindowMenuPreviousAct(0),
|
||||
m_lpWindowMenuSeparatorAct(0)
|
||||
{
|
||||
QThread::msleep(2000);
|
||||
init();
|
||||
@@ -76,28 +83,32 @@ void cMainWindow::init()
|
||||
ui->m_lpIngredientsList->header()->setStretchLastSection(false);
|
||||
ui->m_lpIngredientsList->header()->setSectionResizeMode(0, QHeaderView::Stretch);
|
||||
|
||||
connect(ui->m_lpMenu_File_Exit, SIGNAL(triggered(bool)), this, SLOT(menuFileExitTriggered()));
|
||||
connect(ui->m_lpMenu_Tools_Options, SIGNAL(triggered(bool)), this, SLOT(menuToolsOptionsTriggered()));
|
||||
connect(ui->m_lpMenu_File_Exit, &QAction::triggered, this, &cMainWindow::menuFileExitTriggered);
|
||||
connect(ui->m_lpMenu_Tools_Options, &QAction::triggered, this, &cMainWindow::menuToolsOptionsTriggered);
|
||||
|
||||
ui->m_lpIngredientsList->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(ui->m_lpIngredientsList, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(ingredientsListCustomContextMenu(const QPoint &)));
|
||||
connect(ui->m_lpIngredientsList, &QTreeView::customContextMenuRequested, this, &cMainWindow::ingredientsListCustomContextMenu);
|
||||
m_lpIngredientsListMenu = new QMenu(ui->m_lpIngredientsList);
|
||||
|
||||
m_lpIngredientsListNew = new QAction("&New", m_lpIngredientsListMenu);
|
||||
m_lpIngredientsListMenu->addAction(m_lpIngredientsListNew);
|
||||
connect(m_lpIngredientsListNew, SIGNAL(triggered(bool)), this, SLOT(ingredientsListNewTriggered()));
|
||||
connect(m_lpIngredientsListNew, &QAction::triggered, this, &cMainWindow::ingredientsListNewTriggered);
|
||||
|
||||
m_lpIngredientsListImport = new QAction("&Import", m_lpIngredientsListMenu);
|
||||
m_lpIngredientsListMenu->addAction(m_lpIngredientsListImport);
|
||||
connect(m_lpIngredientsListImport, SIGNAL(triggered(bool)), this, SLOT(ingredientsListImportTriggered()));
|
||||
connect(m_lpIngredientsListImport, &QAction::triggered, this, &cMainWindow::ingredientsListImportTriggered);
|
||||
|
||||
m_lpIngredientsListDelete = new QAction("&Delete", m_lpIngredientsListMenu);
|
||||
m_lpIngredientsListMenu->addAction(m_lpIngredientsListDelete);
|
||||
connect(m_lpIngredientsListDelete, SIGNAL(triggered(bool)), this, SLOT(ingredientsListDeleteTriggered()));
|
||||
connect(m_lpIngredientsListDelete, &QAction::triggered, this, &cMainWindow::ingredientsListDeleteTriggered);
|
||||
|
||||
m_lpIngredientsListEdit = new QAction("&Edit", m_lpIngredientsListMenu);
|
||||
m_lpIngredientsListMenu->addAction(m_lpIngredientsListEdit);
|
||||
connect(m_lpIngredientsListEdit, SIGNAL(triggered(bool)), this, SLOT(ingredientsListEditTriggered()));
|
||||
connect(m_lpIngredientsListEdit, &QAction::triggered, this, &cMainWindow::ingredientsListEditTriggered);
|
||||
|
||||
connect(ui->m_lpIngredientsList, &QTreeView::doubleClicked, this, &cMainWindow::ingredientsListDoubleClicked);
|
||||
|
||||
connect(ui->m_lpMDIArea, &cMdiArea::subWindowActivated, this, &cMainWindow::updateMenus);
|
||||
|
||||
bool bConnected = false;
|
||||
|
||||
@@ -137,6 +148,40 @@ void cMainWindow::init()
|
||||
bConnected = true;
|
||||
}
|
||||
loadIngredients();
|
||||
|
||||
m_lpWindowMenuCloseAct = new QAction(tr("Cl&ose"), this);
|
||||
m_lpWindowMenuCloseAct->setStatusTip(tr("Close the active window"));
|
||||
connect(m_lpWindowMenuCloseAct, &QAction::triggered, ui->m_lpMDIArea, &QMdiArea::closeActiveSubWindow);
|
||||
|
||||
m_lpWindowMenuCloseAllAct = new QAction(tr("Close &All"), this);
|
||||
m_lpWindowMenuCloseAllAct->setStatusTip(tr("Close all the windows"));
|
||||
connect(m_lpWindowMenuCloseAllAct, &QAction::triggered, ui->m_lpMDIArea, &QMdiArea::closeAllSubWindows);
|
||||
|
||||
m_lpWindowMenuTileAct = new QAction(tr("&Tile"), this);
|
||||
m_lpWindowMenuTileAct->setStatusTip(tr("Tile the windows"));
|
||||
connect(m_lpWindowMenuTileAct, &QAction::triggered, ui->m_lpMDIArea, &QMdiArea::tileSubWindows);
|
||||
|
||||
m_lpWindowMenuCascadeAct = new QAction(tr("&Cascade"), this);
|
||||
m_lpWindowMenuCascadeAct->setStatusTip(tr("Cascade the windows"));
|
||||
connect(m_lpWindowMenuCascadeAct, &QAction::triggered, ui->m_lpMDIArea, &QMdiArea::cascadeSubWindows);
|
||||
|
||||
m_lpWindowMenuNextAct = new QAction(tr("Ne&xt"), this);
|
||||
m_lpWindowMenuNextAct->setShortcuts(QKeySequence::NextChild);
|
||||
m_lpWindowMenuNextAct->setStatusTip(tr("Move the focus to the next window"));
|
||||
connect(m_lpWindowMenuNextAct, &QAction::triggered, ui->m_lpMDIArea, &QMdiArea::activateNextSubWindow);
|
||||
|
||||
m_lpWindowMenuPreviousAct = new QAction(tr("Pre&vious"), this);
|
||||
m_lpWindowMenuPreviousAct->setShortcuts(QKeySequence::PreviousChild);
|
||||
m_lpWindowMenuPreviousAct->setStatusTip(tr("Move the focus to the previous window"));
|
||||
connect(m_lpWindowMenuPreviousAct, &QAction::triggered, ui->m_lpMDIArea, &QMdiArea::activatePreviousSubWindow);
|
||||
|
||||
m_lpWindowMenuSeparatorAct = new QAction(this);
|
||||
m_lpWindowMenuSeparatorAct->setSeparator(true);
|
||||
|
||||
connect(ui->m_lpMenu_Window, &QMenu::aboutToShow, this, &cMainWindow::updateWindowMenu);
|
||||
|
||||
updateMenus();
|
||||
updateWindowMenu();
|
||||
}
|
||||
|
||||
void cMainWindow::initDefaultSettings()
|
||||
@@ -187,7 +232,7 @@ void cMainWindow::loadPlugins(const QString& szPluginDir)
|
||||
QAction* lpAction = new QAction(this);
|
||||
ui->m_lpMenu_Plugins_Import->addAction(lpAction);
|
||||
lpAction->setText(lpPlugin->pluginName());
|
||||
connect(lpAction, SIGNAL(triggered()), this, SLOT(pluginImportTriggered()));
|
||||
connect(lpAction, &QAction::triggered, this, &cMainWindow::pluginImportTriggered);
|
||||
lpPlugin->setAction(lpAction);
|
||||
m_pluginList.append(lpPlugin);
|
||||
}
|
||||
@@ -206,7 +251,7 @@ void cMainWindow::loadPlugins(const QString& szPluginDir)
|
||||
QAction* lpAction = new QAction(this);
|
||||
ui->m_lpMenu_Plugins_Export->addAction(lpAction);
|
||||
lpAction->setText(lpPlugin->pluginName());
|
||||
connect(lpAction, SIGNAL(triggered()), this, SLOT(pluginExportTriggered()));
|
||||
connect(lpAction, &QAction::triggered, this, &cMainWindow::pluginExportTriggered);
|
||||
lpPlugin->setAction(lpAction);
|
||||
m_pluginList.append(lpPlugin);
|
||||
}
|
||||
@@ -225,7 +270,7 @@ void cMainWindow::loadPlugins(const QString& szPluginDir)
|
||||
QAction* lpAction = new QAction(this);
|
||||
ui->m_lpMenu_Plugins_Database->addAction(lpAction);
|
||||
lpAction->setText(lpPlugin->pluginName());
|
||||
connect(lpAction, SIGNAL(triggered()), this, SLOT(pluginDBTriggered()));
|
||||
connect(lpAction, &QAction::triggered, this, &cMainWindow::pluginDBTriggered);
|
||||
lpPlugin->setAction(lpAction);
|
||||
m_pluginList.append(lpPlugin);
|
||||
if(settings.value(QString("plugins/%1/enabled").arg(lpPlugin->pluginName()), QVariant(false)).toBool())
|
||||
@@ -290,6 +335,7 @@ void cMainWindow::loadIngredients()
|
||||
|
||||
void cMainWindow::pluginImportTriggered()
|
||||
{
|
||||
/*
|
||||
QAction* lpAction = qobject_cast<QAction *>(sender());
|
||||
if(lpAction)
|
||||
{
|
||||
@@ -319,7 +365,7 @@ void cMainWindow::pluginImportTriggered()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
void cMainWindow::pluginExportTriggered()
|
||||
@@ -444,3 +490,89 @@ void cMainWindow::ingredientsListEditTriggered()
|
||||
lpIngredientWindow->show();
|
||||
}
|
||||
}
|
||||
|
||||
QMdiSubWindow* cMainWindow::activeMdiChild() const
|
||||
{
|
||||
if (QMdiSubWindow* activeSubWindow = ui->m_lpMDIArea->activeSubWindow())
|
||||
return(activeSubWindow);
|
||||
return(0);
|
||||
}
|
||||
|
||||
void cMainWindow::ingredientsListDoubleClicked(QModelIndex /*modelIndex*/)
|
||||
{
|
||||
this->ingredientsListEditTriggered();
|
||||
}
|
||||
|
||||
void cMainWindow::updateMenus()
|
||||
{
|
||||
QMdiSubWindow* lpActiveChild = activeMdiChild();
|
||||
bool hasMdiChild = (lpActiveChild != 0);
|
||||
|
||||
// saveAct->setEnabled(hasMdiChild);
|
||||
// saveAsAct->setEnabled(hasMdiChild);
|
||||
//#ifndef QT_NO_CLIPBOARD
|
||||
// pasteAct->setEnabled(hasMdiChild);
|
||||
//#endif
|
||||
m_lpWindowMenuCloseAct->setEnabled(hasMdiChild);
|
||||
m_lpWindowMenuCloseAllAct->setEnabled(hasMdiChild);
|
||||
m_lpWindowMenuTileAct->setEnabled(hasMdiChild);
|
||||
m_lpWindowMenuCascadeAct->setEnabled(hasMdiChild);
|
||||
m_lpWindowMenuNextAct->setEnabled(hasMdiChild);
|
||||
m_lpWindowMenuPreviousAct->setEnabled(hasMdiChild);
|
||||
m_lpWindowMenuSeparatorAct->setVisible(hasMdiChild);
|
||||
|
||||
//#ifndef QT_NO_CLIPBOARD
|
||||
// bool hasSelection = (activeMdiChild() &&
|
||||
// activeMdiChild()->textCursor().hasSelection());
|
||||
// cutAct->setEnabled(hasSelection);
|
||||
// copyAct->setEnabled(hasSelection);
|
||||
//#endif
|
||||
}
|
||||
|
||||
|
||||
class ActiveMdiSubWindowFunctor
|
||||
{
|
||||
public:
|
||||
explicit ActiveMdiSubWindowFunctor(QMdiArea *mdiArea, QMdiSubWindow *activeWindow) : m_mdiArea(mdiArea), m_activeWindow(activeWindow) {}
|
||||
void operator()() const { m_mdiArea->setActiveSubWindow(m_activeWindow); }
|
||||
|
||||
private:
|
||||
QMdiArea* m_mdiArea;
|
||||
QMdiSubWindow* m_activeWindow;
|
||||
};
|
||||
|
||||
void cMainWindow::updateWindowMenu()
|
||||
{
|
||||
ui->m_lpMenu_Window->clear();
|
||||
|
||||
ui->m_lpMenu_Window->addAction(m_lpWindowMenuCloseAct);
|
||||
ui->m_lpMenu_Window->addAction(m_lpWindowMenuCloseAllAct);
|
||||
ui->m_lpMenu_Window->addSeparator();
|
||||
ui->m_lpMenu_Window->addAction(m_lpWindowMenuTileAct);
|
||||
ui->m_lpMenu_Window->addAction(m_lpWindowMenuCascadeAct);
|
||||
ui->m_lpMenu_Window->addSeparator();
|
||||
ui->m_lpMenu_Window->addAction(m_lpWindowMenuNextAct);
|
||||
ui->m_lpMenu_Window->addAction(m_lpWindowMenuPreviousAct);
|
||||
ui->m_lpMenu_Window->addAction(m_lpWindowMenuSeparatorAct);
|
||||
|
||||
QList<QMdiSubWindow*> windowsList = ui->m_lpMDIArea->subWindowList();
|
||||
m_lpWindowMenuSeparatorAct->setVisible(!windowsList.isEmpty());
|
||||
|
||||
QMdiSubWindow* lpActiveChild = activeMdiChild();
|
||||
|
||||
for(int i = 0; i < windowsList.size(); i++)
|
||||
{
|
||||
QMdiSubWindow* lpMdiSubWindow = windowsList.at(i);
|
||||
|
||||
QString str;
|
||||
|
||||
if(i < 9)
|
||||
str = tr("&%1 %2").arg(i + 1).arg(lpMdiSubWindow->windowTitle());
|
||||
else
|
||||
str = tr("%1 %2").arg(i + 1).arg(lpMdiSubWindow->windowTitle());
|
||||
|
||||
QAction* lpAction = ui->m_lpMenu_Window->addAction(str, lpMdiSubWindow, ActiveMdiSubWindowFunctor(ui->m_lpMDIArea, lpMdiSubWindow));
|
||||
lpAction->setCheckable(true);
|
||||
lpAction->setChecked(lpMdiSubWindow == lpActiveChild);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <QList>
|
||||
#include <QMainWindow>
|
||||
#include <QStandardItemModel>
|
||||
#include <QMdiSubWindow>
|
||||
|
||||
|
||||
namespace Ui
|
||||
@@ -117,6 +118,9 @@ private slots:
|
||||
*
|
||||
*/
|
||||
void ingredientsListEditTriggered();
|
||||
void ingredientsListDoubleClicked(QModelIndex modelIndex);
|
||||
void updateMenus();
|
||||
void updateWindowMenu();
|
||||
|
||||
private:
|
||||
Ui::cMainWindow* ui; /**< the main window GUI */
|
||||
@@ -130,6 +134,15 @@ private:
|
||||
|
||||
cPlugin* m_lpDB;
|
||||
QString m_szLastImportPlugin;
|
||||
|
||||
QAction* m_lpWindowMenuCloseAct;
|
||||
QAction* m_lpWindowMenuCloseAllAct;
|
||||
QAction* m_lpWindowMenuTileAct;
|
||||
QAction* m_lpWindowMenuCascadeAct;
|
||||
QAction* m_lpWindowMenuNextAct;
|
||||
QAction* m_lpWindowMenuPreviousAct;
|
||||
QAction* m_lpWindowMenuSeparatorAct;
|
||||
|
||||
/**
|
||||
* \brief Initialized main windows.
|
||||
*
|
||||
@@ -153,6 +166,7 @@ private:
|
||||
* \return cPlugin Plugin corresponding to the action, NULL if not found.
|
||||
*/
|
||||
cPlugin* plugin(QAction* lpAction);
|
||||
QMdiSubWindow* activeMdiChild() const;
|
||||
protected:
|
||||
};
|
||||
|
||||
|
||||
+16
-10
@@ -53,14 +53,14 @@
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="cMdiArea" name="m_lpMDIArea">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="cMdiArea" name="m_lpMDIArea">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -105,15 +105,21 @@
|
||||
<addaction name="m_lpMenu_Plugins_Export"/>
|
||||
<addaction name="m_lpMenu_Plugins_Database"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_Tools">
|
||||
<widget class="QMenu" name="m_lpMenu_Tools">
|
||||
<property name="title">
|
||||
<string>&Tools</string>
|
||||
</property>
|
||||
<addaction name="m_lpMenu_Tools_Options"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="m_lpMenu_Window">
|
||||
<property name="title">
|
||||
<string>&Window</string>
|
||||
</property>
|
||||
</widget>
|
||||
<addaction name="m_lpMenu_File"/>
|
||||
<addaction name="m_lpMenuPlugins"/>
|
||||
<addaction name="menu_Tools"/>
|
||||
<addaction name="m_lpMenu_Tools"/>
|
||||
<addaction name="m_lpMenu_Window"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="m_lpMainToolBar">
|
||||
<attribute name="toolBarArea">
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
|
||||
#include <QMdiArea>
|
||||
#include <QImage>
|
||||
#include <QMdiSubWindow>
|
||||
|
||||
|
||||
class cMdiArea : public QMdiArea
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
cMdiArea(QWidget * parent = 0);
|
||||
private:
|
||||
|
||||
@@ -34,7 +34,7 @@ void cMessageAnimateDialog::setMessage(const QString& szMessage)
|
||||
delete m_lpTimer;
|
||||
|
||||
m_lpTimer = new QTimer(this);
|
||||
connect(m_lpTimer, SIGNAL(timeout()), this, SLOT(update()));
|
||||
connect(m_lpTimer, &QTimer::timeout, this, &cMessageAnimateDialog::update);
|
||||
m_lpTimer->start(500);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -48,7 +48,7 @@ void cOptions::init()
|
||||
ui->m_lpSplitter->setStretchFactor(0, 0);
|
||||
ui->m_lpSplitter->setStretchFactor(1, 1);
|
||||
|
||||
connect(ui->m_lpOptionsTree->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SLOT(onOptionsTreeSelectionChanged(QItemSelection,QItemSelection)));
|
||||
connect(ui->m_lpOptionsTree->selectionModel(), &QItemSelectionModel::selectionChanged, this, &cOptions::onOptionsTreeSelectionChanged);
|
||||
}
|
||||
|
||||
void cOptions::onOptionsTreeSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected)
|
||||
@@ -87,7 +87,7 @@ void cOptions::onOptionsTreeSelectionChanged(const QItemSelection& selected, con
|
||||
cOptionsPlugins* lpOptionsPlugins = new cOptionsPlugins(this);
|
||||
lpOptionsPlugins->setPlugins(m_pluginList);
|
||||
ui->m_lpOptionsScrollArea->setWidget(lpOptionsPlugins);
|
||||
connect(lpOptionsPlugins, SIGNAL(somethingChanged()), this, SLOT(somethingChanged()));
|
||||
connect(lpOptionsPlugins, &cOptionsPlugins::somethingChanged, this, &cOptions::somethingChanged);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -104,7 +104,7 @@ void cOptions::somethingChanged()
|
||||
ui->m_lpButtonBox->button(QDialogButtonBox::Apply)->setEnabled(true);
|
||||
}
|
||||
|
||||
bool cOptions::saveData(QStandardItem* lpItem)
|
||||
bool cOptions::saveData(QStandardItem* /*lpItem*/)
|
||||
{
|
||||
return(true);
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ void cOptionsPlugins::init()
|
||||
QStringList headerLabels = QStringList() << tr("") << tr("Name") << tr("Version") << tr("Capability") << tr("File");
|
||||
m_lpPluginsListModel->setHorizontalHeaderLabels(headerLabels);
|
||||
|
||||
connect(ui->m_lpPluginsList->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SLOT(onOptionsPluginTreeSelectionChanged(QItemSelection,QItemSelection)));
|
||||
connect(ui->m_lpPluginsList, SIGNAL(doubleClicked(QModelIndex)), SLOT(onOptionsPluginTreeDoubleClicked(QModelIndex)));
|
||||
connect(ui->m_lpPluginsList->selectionModel(), &QItemSelectionModel::selectionChanged, this, &cOptionsPlugins::onOptionsPluginTreeSelectionChanged);
|
||||
connect(ui->m_lpPluginsList, &QTreeView::doubleClicked, this, &cOptionsPlugins::onOptionsPluginTreeDoubleClicked);
|
||||
}
|
||||
|
||||
void cOptionsPlugins::setPlugins(QList<cPlugin*> &plugins)
|
||||
@@ -45,7 +45,7 @@ void cOptionsPlugins::setPlugins(QList<cPlugin*> &plugins)
|
||||
QCheckBox* lpCheckBox = new QCheckBox(this);
|
||||
lpCheckBox->setChecked(settings.value(QString("plugins/%1/enabled").arg(plugins.at(z)->pluginName()), QVariant(false)).toBool());
|
||||
ui->m_lpPluginsList->setIndexWidget(m_lpPluginsListModel->index(index.row(), 0), lpCheckBox);
|
||||
connect(lpCheckBox, SIGNAL(toggled(bool)), this, SLOT(onOptionsPluginTreePluginToggled(bool)));
|
||||
connect(lpCheckBox, &QCheckBox::toggled, this, &cOptionsPlugins::onOptionsPluginTreePluginToggled);
|
||||
QStandardItem* lpItemText = new QStandardItem(plugins.at(z)->pluginName());
|
||||
m_lpPluginsListModel->setItem(index.row(), 1, lpItemText);
|
||||
QStandardItem* lpItemVersion = new QStandardItem(QString("%1").arg(plugins.at(z)->pluginVersion()));
|
||||
|
||||
@@ -266,7 +266,8 @@ QString cSQLitePlugin::name(qint32 id)
|
||||
m_szLastError = query.lastError().text();
|
||||
return("");
|
||||
}
|
||||
query.first();
|
||||
if(!query.first())
|
||||
return("");
|
||||
return(query.value("name").toString());
|
||||
}
|
||||
|
||||
@@ -276,12 +277,13 @@ QString cSQLitePlugin::group(qint32 id)
|
||||
return("");
|
||||
|
||||
QSqlQuery query(m_db);
|
||||
if(!query.exec(QString("SELECT ingredient_group.name FROM ingredient, ingredient_group WHERE ingredient.ingredient_group_id=ingredient_group.id AND ingredient.id=%1").arg(id).arg(id)))
|
||||
if(!query.exec(QString("SELECT ingredient_group.name FROM ingredient, ingredient_group WHERE ingredient.ingredient_group_id=ingredient_group.id AND ingredient.id=%1").arg(id)))
|
||||
{
|
||||
m_szLastError = query.lastError().text();
|
||||
return("");
|
||||
}
|
||||
query.first();
|
||||
if(!query.first())
|
||||
return("");
|
||||
return(query.value("name").toString());
|
||||
}
|
||||
|
||||
@@ -296,7 +298,8 @@ qreal cSQLitePlugin::get(qint32 id, qint16 ingredientNumber)
|
||||
m_szLastError = query.lastError().text();
|
||||
return(-1);
|
||||
}
|
||||
query.first();
|
||||
if(!query.first())
|
||||
return(0);
|
||||
return(query.value("value").toReal());
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ QStringList cBleibFitPlugin::search(const QString& szSearch, const QString&)
|
||||
QNetworkReply* reply = networkManager.get(request);
|
||||
QEventLoop loop;
|
||||
|
||||
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
|
||||
QObject::connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
|
||||
loop.exec();
|
||||
|
||||
QByteArray szData = reply->readAll();
|
||||
@@ -177,7 +177,7 @@ bool cBleibFitPlugin::load(qint16 iIndex)
|
||||
QNetworkReply* reply = networkManager.get(request);
|
||||
QEventLoop loop;
|
||||
|
||||
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
|
||||
QObject::connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
|
||||
loop.exec();
|
||||
|
||||
QByteArray szData = reply->readAll();
|
||||
|
||||
Reference in New Issue
Block a user