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";
|
||||
}
|
||||
|
||||
void ServiceItemModel::addItem(const QString &name, const QString &type) {
|
||||
ServiceItem *item = new ServiceItem(name, type);
|
||||
item->setSelected(false);
|
||||
item->setActive(false);
|
||||
addItem(item);
|
||||
}
|
||||
// void ServiceItemModel::addItem(const QString &name, const QString &type) {
|
||||
// ServiceItem *item = new ServiceItem(name, type);
|
||||
// item->setSelected(false);
|
||||
// item->setActive(false);
|
||||
// addItem(item);
|
||||
// }
|
||||
|
||||
void ServiceItemModel::addItem(const QString &name, const QString &type,
|
||||
const QString &background, const QString &backgroundType) {
|
||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType);
|
||||
item->setSelected(false);
|
||||
item->setActive(false);
|
||||
addItem(item);
|
||||
}
|
||||
// void ServiceItemModel::addItem(const QString &name, const QString &type,
|
||||
// const QString &background, const QString &backgroundType) {
|
||||
// ServiceItem *item = new ServiceItem(name, type, background, backgroundType);
|
||||
// item->setSelected(false);
|
||||
// item->setActive(false);
|
||||
// addItem(item);
|
||||
// }
|
||||
|
||||
void ServiceItemModel::addItem(const QString &name, const QString &type,
|
||||
const QString &background, const QString &backgroundType,
|
||||
const QStringList &text) {
|
||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType, text);
|
||||
item->setSelected(false);
|
||||
item->setActive(false);
|
||||
addItem(item);
|
||||
qDebug() << name << type << background;
|
||||
}
|
||||
// void ServiceItemModel::addItem(const QString &name, const QString &type,
|
||||
// const QString &background, const QString &backgroundType,
|
||||
// const QStringList &text) {
|
||||
// ServiceItem *item = new ServiceItem(name, type, background, backgroundType, text);
|
||||
// item->setSelected(false);
|
||||
// item->setActive(false);
|
||||
// addItem(item);
|
||||
// qDebug() << name << type << background;
|
||||
// }
|
||||
|
||||
void ServiceItemModel::addItem(const QString &name, const QString &type,
|
||||
const QString &background, const QString &backgroundType,
|
||||
const QStringList &text, const QString &audio) {
|
||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
||||
text, audio);
|
||||
item->setSelected(false);
|
||||
item->setActive(false);
|
||||
addItem(item);
|
||||
qDebug() << name << type << background;
|
||||
}
|
||||
// void ServiceItemModel::addItem(const QString &name, const QString &type,
|
||||
// const QString &background, const QString &backgroundType,
|
||||
// const QStringList &text, const QString &audio) {
|
||||
// ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
||||
// text, audio);
|
||||
// item->setSelected(false);
|
||||
// item->setActive(false);
|
||||
// addItem(item);
|
||||
// qDebug() << name << type << background;
|
||||
// }
|
||||
|
||||
void ServiceItemModel::addItem(const QString &name, const QString &type,
|
||||
const QString &background, const QString &backgroundType,
|
||||
const QStringList &text, const QString &audio,
|
||||
const QString &font, const int &fontSize) {
|
||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
||||
text, audio, font, fontSize);
|
||||
item->setSelected(false);
|
||||
item->setActive(false);
|
||||
addItem(item);
|
||||
qDebug() << "#################################";
|
||||
qDebug() << name << type << font << fontSize;
|
||||
qDebug() << "#################################";
|
||||
}
|
||||
// void ServiceItemModel::addItem(const QString &name, const QString &type,
|
||||
// const QString &background, const QString &backgroundType,
|
||||
// const QStringList &text, const QString &audio,
|
||||
// const QString &font, const int &fontSize) {
|
||||
// ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
||||
// text, audio, font, fontSize);
|
||||
// item->setSelected(false);
|
||||
// item->setActive(false);
|
||||
// addItem(item);
|
||||
// qDebug() << "#################################";
|
||||
// qDebug() << name << type << font << fontSize;
|
||||
// qDebug() << "#################################";
|
||||
// }
|
||||
|
||||
void ServiceItemModel::addItem(const QString &name, const QString &type,
|
||||
const QString &background, const QString &backgroundType,
|
||||
const QStringList &text, const QString &audio,
|
||||
const QString &font, const int &fontSize,
|
||||
const int &slideNumber, SlideModel &slideModel) {
|
||||
qDebug() << "*************************";
|
||||
qDebug() << "Plain adding item: " << name;
|
||||
qDebug() << "*************************";
|
||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
||||
text, audio, font, fontSize, slideNumber);
|
||||
item->setSelected(false);
|
||||
|
@ -317,56 +320,57 @@ void ServiceItemModel::addItem(const QString &name, const QString &type,
|
|||
qDebug() << "#################################";
|
||||
}
|
||||
|
||||
void ServiceItemModel::insertItem(const int &index, const QString &name, const QString &type) {
|
||||
ServiceItem *item = new ServiceItem(name, type);
|
||||
item->setSelected(false);
|
||||
item->setActive(false);
|
||||
insertItem(index, item);
|
||||
qDebug() << name << type;
|
||||
}
|
||||
// void ServiceItemModel::insertItem(const int &index, const QString &name, const QString &type) {
|
||||
// ServiceItem *item = new ServiceItem(name, type);
|
||||
// item->setSelected(false);
|
||||
// item->setActive(false);
|
||||
// insertItem(index, item);
|
||||
// qDebug() << name << type;
|
||||
// }
|
||||
|
||||
void ServiceItemModel::insertItem(const int &index, const QString &name, const QString &type,
|
||||
const QString &background, const QString &backgroundType) {
|
||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType);
|
||||
item->setSelected(false);
|
||||
item->setActive(false);
|
||||
insertItem(index, item);
|
||||
qDebug() << name << type << background;
|
||||
}
|
||||
// void ServiceItemModel::insertItem(const int &index, const QString &name, const QString &type,
|
||||
// const QString &background, const QString &backgroundType) {
|
||||
// ServiceItem *item = new ServiceItem(name, type, background, backgroundType);
|
||||
// item->setSelected(false);
|
||||
// item->setActive(false);
|
||||
// insertItem(index, item);
|
||||
// qDebug() << name << type << background;
|
||||
// }
|
||||
|
||||
void ServiceItemModel::insertItem(const int &index, const QString &name, const QString &type,
|
||||
const QString &background, const QString &backgroundType,
|
||||
const QStringList &text) {
|
||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType, text);
|
||||
insertItem(index, item);
|
||||
qDebug() << name << type << background << text;
|
||||
}
|
||||
// void ServiceItemModel::insertItem(const int &index, const QString &name, const QString &type,
|
||||
// const QString &background, const QString &backgroundType,
|
||||
// const QStringList &text) {
|
||||
// ServiceItem *item = new ServiceItem(name, type, background, backgroundType, text);
|
||||
// insertItem(index, item);
|
||||
// qDebug() << name << type << background << text;
|
||||
// }
|
||||
|
||||
void ServiceItemModel::insertItem(const int &index, const QString &name,
|
||||
const QString &type,const QString &background,
|
||||
const QString &backgroundType,const QStringList &text,
|
||||
const QString &audio) {
|
||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
||||
text, audio);
|
||||
item->setSelected(false);
|
||||
item->setActive(false);
|
||||
insertItem(index, item);
|
||||
qDebug() << name << type << background << text;
|
||||
}
|
||||
// void ServiceItemModel::insertItem(const int &index, const QString &name,
|
||||
// const QString &type,const QString &background,
|
||||
// const QString &backgroundType,const QStringList &text,
|
||||
// const QString &audio) {
|
||||
// ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
||||
// text, audio);
|
||||
// item->setSelected(false);
|
||||
// item->setActive(false);
|
||||
// insertItem(index, item);
|
||||
// qDebug() << name << type << background << text;
|
||||
// }
|
||||
|
||||
void ServiceItemModel::insertItem(const int &index, const QString &name,
|
||||
const QString &type,const QString &background,
|
||||
const QString &backgroundType,const QStringList &text,
|
||||
const QString &audio, const QString &font, const int &fontSize) {
|
||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
||||
text, audio, font, fontSize);
|
||||
item->setSelected(false);
|
||||
item->setActive(false);
|
||||
insertItem(index, item);
|
||||
qDebug() << "#################################";
|
||||
qDebug() << name << type << font << fontSize;
|
||||
qDebug() << "#################################";
|
||||
}
|
||||
// void ServiceItemModel::insertItem(const int &index, const QString &name,
|
||||
// const QString &type,const QString &background,
|
||||
// const QString &backgroundType,const QStringList &text,
|
||||
// const QString &audio, const QString &font, const int &fontSize) {
|
||||
// ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
||||
// text, audio, font, fontSize);
|
||||
// item->setSelected(false);
|
||||
// item->setActive(false);
|
||||
// insertItem(index, item);
|
||||
// qDebug() << "#################################";
|
||||
// qDebug() << "missing slidenumber and slidemodel";
|
||||
// qDebug() << name << type << font << fontSize;
|
||||
// qDebug() << "#################################";
|
||||
// }
|
||||
|
||||
void ServiceItemModel::insertItem(const int &index, const QString &name,
|
||||
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 int &fontSize, const int &slideNumber,
|
||||
SlideModel &slideModel) {
|
||||
qDebug() << "*************************";
|
||||
qDebug() << "Inserting serviceItem: " << name << " and index is " << index;
|
||||
qDebug() << "*************************";
|
||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType,
|
||||
text, audio, font, fontSize, slideNumber);
|
||||
item->setSelected(false);
|
||||
|
|
|
@ -48,47 +48,47 @@ public:
|
|||
// Helper methods
|
||||
void addItem(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,
|
||||
// const QString &background);
|
||||
Q_INVOKABLE void addItem(const QString &name, const QString &type,
|
||||
const QString &background,
|
||||
const QString &backgroundType);
|
||||
Q_INVOKABLE void addItem(const QString &name, const QString &type,
|
||||
const QString &background,
|
||||
const QString &backgroundType,
|
||||
const QStringList &text);
|
||||
Q_INVOKABLE void addItem(const QString &name, const QString &type,
|
||||
const QString &background,
|
||||
const QString &backgroundType,
|
||||
const QStringList &text, const QString &audio);
|
||||
Q_INVOKABLE void addItem(const QString &name, const QString &type,
|
||||
const QString &background,
|
||||
const QString &backgroundType,
|
||||
const QStringList &text, const QString &audio,
|
||||
const QString &font, const int &fontSize);
|
||||
// const QString &background,
|
||||
// const QString &backgroundType);
|
||||
// Q_INVOKABLE void addItem(const QString &name, const QString &type,
|
||||
// const QString &background,
|
||||
// const QString &backgroundType,
|
||||
// const QStringList &text);
|
||||
// Q_INVOKABLE void addItem(const QString &name, const QString &type,
|
||||
// const QString &background,
|
||||
// const QString &backgroundType,
|
||||
// const QStringList &text, const QString &audio);
|
||||
// Q_INVOKABLE void addItem(const QString &name, const QString &type,
|
||||
// const QString &background,
|
||||
// const QString &backgroundType,
|
||||
// const QStringList &text, const QString &audio,
|
||||
// const QString &font, const int &fontSize);
|
||||
Q_INVOKABLE void addItem(const QString &name, const QString &type,
|
||||
const QString &background,
|
||||
const QString &backgroundType,
|
||||
const QStringList &text, const QString &audio,
|
||||
const QString &font, const int &fontSize,
|
||||
const int &slideNumber, SlideModel &slideModel);
|
||||
Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
||||
const QString &type);
|
||||
Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
||||
const QString &type, const QString &background,
|
||||
const QString &backgroundType);
|
||||
Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
||||
const QString &type, const QString &background,
|
||||
const QString &backgroundType, const QStringList &text);
|
||||
Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
||||
const QString &type, const QString &background,
|
||||
const QString &backgroundType, const QStringList &text,
|
||||
const QString &audio);
|
||||
Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
||||
const QString &type, const QString &background,
|
||||
const QString &backgroundType, const QStringList &text,
|
||||
const QString &audio, const QString &font, const int &fontSize);
|
||||
// Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
||||
// const QString &type);
|
||||
// Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
||||
// const QString &type, const QString &background,
|
||||
// const QString &backgroundType);
|
||||
// Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
||||
// const QString &type, const QString &background,
|
||||
// const QString &backgroundType, const QStringList &text);
|
||||
// Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
||||
// const QString &type, const QString &background,
|
||||
// const QString &backgroundType, const QStringList &text,
|
||||
// const QString &audio);
|
||||
// Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
||||
// const QString &type, const QString &background,
|
||||
// const QString &backgroundType, const QStringList &text,
|
||||
// const QString &audio, const QString &font, const int &fontSize);
|
||||
Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
||||
const QString &type, const QString &background,
|
||||
const QString &backgroundType, const QStringList &text,
|
||||
|
@ -110,6 +110,17 @@ public:
|
|||
Q_INVOKABLE bool load(QUrl file, 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:
|
||||
|
||||
QList<ServiceItem *> m_items;
|
||||
|
|
|
@ -82,6 +82,17 @@ public:
|
|||
Q_INVOKABLE void clearAll();
|
||||
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:
|
||||
QList<Slide *> m_items;
|
||||
};
|
||||
|
|
|
@ -139,6 +139,9 @@ int main(int argc, char *argv[])
|
|||
QScopedPointer<SlideObject> slideobject(new SlideObject);
|
||||
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());
|
||||
|
||||
// apparently mpv needs this class set
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue