almost a working signal and slot mechanism
This commit is contained in:
parent
46f2d9d42f
commit
d1e0cc2fc0
4 changed files with 157 additions and 125 deletions
|
@ -223,61 +223,64 @@ void ServiceItemModel::insertItem(const int &index, ServiceItem *item) {
|
||||||
qDebug() << "Success";
|
qDebug() << "Success";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServiceItemModel::addItem(const QString &name, const QString &type) {
|
// void ServiceItemModel::addItem(const QString &name, const QString &type) {
|
||||||
ServiceItem *item = new ServiceItem(name, type);
|
// ServiceItem *item = new ServiceItem(name, type);
|
||||||
item->setSelected(false);
|
// item->setSelected(false);
|
||||||
item->setActive(false);
|
// item->setActive(false);
|
||||||
addItem(item);
|
// addItem(item);
|
||||||
}
|
// }
|
||||||
|
|
||||||
void ServiceItemModel::addItem(const QString &name, const QString &type,
|
// void ServiceItemModel::addItem(const QString &name, const QString &type,
|
||||||
const QString &background, const QString &backgroundType) {
|
// const QString &background, const QString &backgroundType) {
|
||||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType);
|
// ServiceItem *item = new ServiceItem(name, type, background, backgroundType);
|
||||||
item->setSelected(false);
|
// item->setSelected(false);
|
||||||
item->setActive(false);
|
// item->setActive(false);
|
||||||
addItem(item);
|
// addItem(item);
|
||||||
}
|
// }
|
||||||
|
|
||||||
void ServiceItemModel::addItem(const QString &name, const QString &type,
|
// void ServiceItemModel::addItem(const QString &name, const QString &type,
|
||||||
const QString &background, const QString &backgroundType,
|
// const QString &background, const QString &backgroundType,
|
||||||
const QStringList &text) {
|
// const QStringList &text) {
|
||||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType, text);
|
// ServiceItem *item = new ServiceItem(name, type, background, backgroundType, text);
|
||||||
item->setSelected(false);
|
// item->setSelected(false);
|
||||||
item->setActive(false);
|
// item->setActive(false);
|
||||||
addItem(item);
|
// addItem(item);
|
||||||
qDebug() << name << type << background;
|
// qDebug() << name << type << background;
|
||||||
}
|
// }
|
||||||
|
|
||||||
void ServiceItemModel::addItem(const QString &name, const QString &type,
|
// void ServiceItemModel::addItem(const QString &name, const QString &type,
|
||||||
const QString &background, const QString &backgroundType,
|
// const QString &background, const QString &backgroundType,
|
||||||
const QStringList &text, const QString &audio) {
|
// const QStringList &text, const QString &audio) {
|
||||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
// ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
||||||
text, audio);
|
// text, audio);
|
||||||
item->setSelected(false);
|
// item->setSelected(false);
|
||||||
item->setActive(false);
|
// item->setActive(false);
|
||||||
addItem(item);
|
// addItem(item);
|
||||||
qDebug() << name << type << background;
|
// qDebug() << name << type << background;
|
||||||
}
|
// }
|
||||||
|
|
||||||
void ServiceItemModel::addItem(const QString &name, const QString &type,
|
// void ServiceItemModel::addItem(const QString &name, const QString &type,
|
||||||
const QString &background, const QString &backgroundType,
|
// const QString &background, const QString &backgroundType,
|
||||||
const QStringList &text, const QString &audio,
|
// const QStringList &text, const QString &audio,
|
||||||
const QString &font, const int &fontSize) {
|
// const QString &font, const int &fontSize) {
|
||||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
// ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
||||||
text, audio, font, fontSize);
|
// text, audio, font, fontSize);
|
||||||
item->setSelected(false);
|
// item->setSelected(false);
|
||||||
item->setActive(false);
|
// item->setActive(false);
|
||||||
addItem(item);
|
// addItem(item);
|
||||||
qDebug() << "#################################";
|
// qDebug() << "#################################";
|
||||||
qDebug() << name << type << font << fontSize;
|
// qDebug() << name << type << font << fontSize;
|
||||||
qDebug() << "#################################";
|
// qDebug() << "#################################";
|
||||||
}
|
// }
|
||||||
|
|
||||||
void ServiceItemModel::addItem(const QString &name, const QString &type,
|
void ServiceItemModel::addItem(const QString &name, const QString &type,
|
||||||
const QString &background, const QString &backgroundType,
|
const QString &background, const QString &backgroundType,
|
||||||
const QStringList &text, const QString &audio,
|
const QStringList &text, const QString &audio,
|
||||||
const QString &font, const int &fontSize,
|
const QString &font, const int &fontSize,
|
||||||
const int &slideNumber, SlideModel &slideModel) {
|
const int &slideNumber, SlideModel &slideModel) {
|
||||||
|
qDebug() << "*************************";
|
||||||
|
qDebug() << "Plain adding item: " << name;
|
||||||
|
qDebug() << "*************************";
|
||||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
||||||
text, audio, font, fontSize, slideNumber);
|
text, audio, font, fontSize, slideNumber);
|
||||||
item->setSelected(false);
|
item->setSelected(false);
|
||||||
|
@ -317,56 +320,57 @@ void ServiceItemModel::addItem(const QString &name, const QString &type,
|
||||||
qDebug() << "#################################";
|
qDebug() << "#################################";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServiceItemModel::insertItem(const int &index, const QString &name, const QString &type) {
|
// void ServiceItemModel::insertItem(const int &index, const QString &name, const QString &type) {
|
||||||
ServiceItem *item = new ServiceItem(name, type);
|
// ServiceItem *item = new ServiceItem(name, type);
|
||||||
item->setSelected(false);
|
// item->setSelected(false);
|
||||||
item->setActive(false);
|
// item->setActive(false);
|
||||||
insertItem(index, item);
|
// insertItem(index, item);
|
||||||
qDebug() << name << type;
|
// qDebug() << name << type;
|
||||||
}
|
// }
|
||||||
|
|
||||||
void ServiceItemModel::insertItem(const int &index, const QString &name, const QString &type,
|
// void ServiceItemModel::insertItem(const int &index, const QString &name, const QString &type,
|
||||||
const QString &background, const QString &backgroundType) {
|
// const QString &background, const QString &backgroundType) {
|
||||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType);
|
// ServiceItem *item = new ServiceItem(name, type, background, backgroundType);
|
||||||
item->setSelected(false);
|
// item->setSelected(false);
|
||||||
item->setActive(false);
|
// item->setActive(false);
|
||||||
insertItem(index, item);
|
// insertItem(index, item);
|
||||||
qDebug() << name << type << background;
|
// qDebug() << name << type << background;
|
||||||
}
|
// }
|
||||||
|
|
||||||
void ServiceItemModel::insertItem(const int &index, const QString &name, const QString &type,
|
// void ServiceItemModel::insertItem(const int &index, const QString &name, const QString &type,
|
||||||
const QString &background, const QString &backgroundType,
|
// const QString &background, const QString &backgroundType,
|
||||||
const QStringList &text) {
|
// const QStringList &text) {
|
||||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType, text);
|
// ServiceItem *item = new ServiceItem(name, type, background, backgroundType, text);
|
||||||
insertItem(index, item);
|
// insertItem(index, item);
|
||||||
qDebug() << name << type << background << text;
|
// qDebug() << name << type << background << text;
|
||||||
}
|
// }
|
||||||
|
|
||||||
void ServiceItemModel::insertItem(const int &index, const QString &name,
|
// void ServiceItemModel::insertItem(const int &index, const QString &name,
|
||||||
const QString &type,const QString &background,
|
// const QString &type,const QString &background,
|
||||||
const QString &backgroundType,const QStringList &text,
|
// const QString &backgroundType,const QStringList &text,
|
||||||
const QString &audio) {
|
// const QString &audio) {
|
||||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
// ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
||||||
text, audio);
|
// text, audio);
|
||||||
item->setSelected(false);
|
// item->setSelected(false);
|
||||||
item->setActive(false);
|
// item->setActive(false);
|
||||||
insertItem(index, item);
|
// insertItem(index, item);
|
||||||
qDebug() << name << type << background << text;
|
// qDebug() << name << type << background << text;
|
||||||
}
|
// }
|
||||||
|
|
||||||
void ServiceItemModel::insertItem(const int &index, const QString &name,
|
// void ServiceItemModel::insertItem(const int &index, const QString &name,
|
||||||
const QString &type,const QString &background,
|
// const QString &type,const QString &background,
|
||||||
const QString &backgroundType,const QStringList &text,
|
// const QString &backgroundType,const QStringList &text,
|
||||||
const QString &audio, const QString &font, const int &fontSize) {
|
// const QString &audio, const QString &font, const int &fontSize) {
|
||||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
// ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
||||||
text, audio, font, fontSize);
|
// text, audio, font, fontSize);
|
||||||
item->setSelected(false);
|
// item->setSelected(false);
|
||||||
item->setActive(false);
|
// item->setActive(false);
|
||||||
insertItem(index, item);
|
// insertItem(index, item);
|
||||||
qDebug() << "#################################";
|
// qDebug() << "#################################";
|
||||||
qDebug() << name << type << font << fontSize;
|
// qDebug() << "missing slidenumber and slidemodel";
|
||||||
qDebug() << "#################################";
|
// qDebug() << name << type << font << fontSize;
|
||||||
}
|
// qDebug() << "#################################";
|
||||||
|
// }
|
||||||
|
|
||||||
void ServiceItemModel::insertItem(const int &index, const QString &name,
|
void ServiceItemModel::insertItem(const int &index, const QString &name,
|
||||||
const QString &type,const QString &background,
|
const QString &type,const QString &background,
|
||||||
|
@ -374,6 +378,9 @@ void ServiceItemModel::insertItem(const int &index, const QString &name,
|
||||||
const QString &audio, const QString &font,
|
const QString &audio, const QString &font,
|
||||||
const int &fontSize, const int &slideNumber,
|
const int &fontSize, const int &slideNumber,
|
||||||
SlideModel &slideModel) {
|
SlideModel &slideModel) {
|
||||||
|
qDebug() << "*************************";
|
||||||
|
qDebug() << "Inserting serviceItem: " << name << " and index is " << index;
|
||||||
|
qDebug() << "*************************";
|
||||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
||||||
text, audio, font, fontSize, slideNumber);
|
text, audio, font, fontSize, slideNumber);
|
||||||
item->setSelected(false);
|
item->setSelected(false);
|
||||||
|
|
|
@ -48,47 +48,47 @@ public:
|
||||||
// Helper methods
|
// Helper methods
|
||||||
void addItem(ServiceItem *item);
|
void addItem(ServiceItem *item);
|
||||||
void insertItem(const int &index, ServiceItem *item);
|
void insertItem(const int &index, ServiceItem *item);
|
||||||
Q_INVOKABLE void addItem(const QString &name, const QString &type);
|
// Q_INVOKABLE void addItem(const QString &name, const QString &type);
|
||||||
|
// // Q_INVOKABLE void addItem(const QString &name, const QString &type,
|
||||||
|
// // const QString &background);
|
||||||
// Q_INVOKABLE void addItem(const QString &name, const QString &type,
|
// Q_INVOKABLE void addItem(const QString &name, const QString &type,
|
||||||
// const QString &background);
|
// const QString &background,
|
||||||
Q_INVOKABLE void addItem(const QString &name, const QString &type,
|
// const QString &backgroundType);
|
||||||
const QString &background,
|
// Q_INVOKABLE void addItem(const QString &name, const QString &type,
|
||||||
const QString &backgroundType);
|
// const QString &background,
|
||||||
Q_INVOKABLE void addItem(const QString &name, const QString &type,
|
// const QString &backgroundType,
|
||||||
const QString &background,
|
// const QStringList &text);
|
||||||
const QString &backgroundType,
|
// Q_INVOKABLE void addItem(const QString &name, const QString &type,
|
||||||
const QStringList &text);
|
// const QString &background,
|
||||||
Q_INVOKABLE void addItem(const QString &name, const QString &type,
|
// const QString &backgroundType,
|
||||||
const QString &background,
|
// const QStringList &text, const QString &audio);
|
||||||
const QString &backgroundType,
|
// Q_INVOKABLE void addItem(const QString &name, const QString &type,
|
||||||
const QStringList &text, const QString &audio);
|
// const QString &background,
|
||||||
Q_INVOKABLE void addItem(const QString &name, const QString &type,
|
// const QString &backgroundType,
|
||||||
const QString &background,
|
// const QStringList &text, const QString &audio,
|
||||||
const QString &backgroundType,
|
// const QString &font, const int &fontSize);
|
||||||
const QStringList &text, const QString &audio,
|
|
||||||
const QString &font, const int &fontSize);
|
|
||||||
Q_INVOKABLE void addItem(const QString &name, const QString &type,
|
Q_INVOKABLE void addItem(const QString &name, const QString &type,
|
||||||
const QString &background,
|
const QString &background,
|
||||||
const QString &backgroundType,
|
const QString &backgroundType,
|
||||||
const QStringList &text, const QString &audio,
|
const QStringList &text, const QString &audio,
|
||||||
const QString &font, const int &fontSize,
|
const QString &font, const int &fontSize,
|
||||||
const int &slideNumber, SlideModel &slideModel);
|
const int &slideNumber, SlideModel &slideModel);
|
||||||
Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
// Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
||||||
const QString &type);
|
// const QString &type);
|
||||||
Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
// Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
||||||
const QString &type, const QString &background,
|
// const QString &type, const QString &background,
|
||||||
const QString &backgroundType);
|
// const QString &backgroundType);
|
||||||
Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
// Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
||||||
const QString &type, const QString &background,
|
// const QString &type, const QString &background,
|
||||||
const QString &backgroundType, const QStringList &text);
|
// const QString &backgroundType, const QStringList &text);
|
||||||
Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
// Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
||||||
const QString &type, const QString &background,
|
// const QString &type, const QString &background,
|
||||||
const QString &backgroundType, const QStringList &text,
|
// const QString &backgroundType, const QStringList &text,
|
||||||
const QString &audio);
|
// const QString &audio);
|
||||||
Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
// Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
||||||
const QString &type, const QString &background,
|
// const QString &type, const QString &background,
|
||||||
const QString &backgroundType, const QStringList &text,
|
// const QString &backgroundType, const QStringList &text,
|
||||||
const QString &audio, const QString &font, const int &fontSize);
|
// const QString &audio, const QString &font, const int &fontSize);
|
||||||
Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
||||||
const QString &type, const QString &background,
|
const QString &type, const QString &background,
|
||||||
const QString &backgroundType, const QStringList &text,
|
const QString &backgroundType, const QStringList &text,
|
||||||
|
@ -110,6 +110,17 @@ public:
|
||||||
Q_INVOKABLE bool load(QUrl file, SlideModel &slideModel);
|
Q_INVOKABLE bool load(QUrl file, SlideModel &slideModel);
|
||||||
Q_INVOKABLE bool loadLastSaved(SlideModel &slideModel);
|
Q_INVOKABLE bool loadLastSaved(SlideModel &slideModel);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void itemAdded(const int &index, const QString &type,
|
||||||
|
const QString &background, const QString &backgroundType,
|
||||||
|
const QStringList &text, const QString &audio,
|
||||||
|
const QString &font, const int &fontSize, const int &slideNumber);
|
||||||
|
|
||||||
|
void itemInserted(const int &index, const QString &type,
|
||||||
|
const QString &background, const QString &backgroundType,
|
||||||
|
const QStringList &text, const QString &audio,
|
||||||
|
const QString &font, const int &fontSize, const int &slideNumber);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
QList<ServiceItem *> m_items;
|
QList<ServiceItem *> m_items;
|
||||||
|
|
|
@ -82,6 +82,17 @@ public:
|
||||||
Q_INVOKABLE void clearAll();
|
Q_INVOKABLE void clearAll();
|
||||||
Q_INVOKABLE int findSlideIdFromServItm(int index);
|
Q_INVOKABLE int findSlideIdFromServItm(int index);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void addItemFromService(const int &index, const QString &type,
|
||||||
|
const QString &background, const QString &backgroundType,
|
||||||
|
const QStringList &text, const QString &audio,
|
||||||
|
const QString &font, const int &fontSize, const int &slideNumber);
|
||||||
|
|
||||||
|
void insertItemFromService(const int &index, const QString &type,
|
||||||
|
const QString &background, const QString &backgroundType,
|
||||||
|
const QStringList &text, const QString &audio,
|
||||||
|
const QString &font, const int &fontSize, const int &slideNumber);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<Slide *> m_items;
|
QList<Slide *> m_items;
|
||||||
};
|
};
|
||||||
|
|
|
@ -139,6 +139,9 @@ int main(int argc, char *argv[])
|
||||||
QScopedPointer<SlideObject> slideobject(new SlideObject);
|
QScopedPointer<SlideObject> slideobject(new SlideObject);
|
||||||
preswin->setSource(QUrl(QStringLiteral("qrc:qml/presenter/PresentationWindow.qml")));
|
preswin->setSource(QUrl(QStringLiteral("qrc:qml/presenter/PresentationWindow.qml")));
|
||||||
|
|
||||||
|
QObject::connect(serviceItemModel.get(), &ServiceItemModel::itemAdded,
|
||||||
|
slideModel.get(), &SlideModel::addItem())
|
||||||
|
|
||||||
bool loading = serviceItemModel.get()->loadLastSaved(*slideModel.get());
|
bool loading = serviceItemModel.get()->loadLastSaved(*slideModel.get());
|
||||||
|
|
||||||
// apparently mpv needs this class set
|
// apparently mpv needs this class set
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue