mirror of
https://github.com/Lurkki14/tuxclocker.git
synced 2024-11-24 17:20:17 -06:00
65 lines
1.6 KiB
C++
65 lines
1.6 KiB
C++
#ifndef NEWPROFILE_H
|
|
#define NEWPROFILE_H
|
|
|
|
#include <QDialog>
|
|
#include <QAbstractButton>
|
|
#include <QSettings>
|
|
#include <QListWidget>
|
|
#include <QStyledItemDelegate>
|
|
|
|
namespace Ui {
|
|
class newProfile;
|
|
}
|
|
|
|
class newProfile : public QDialog
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit newProfile(QWidget *parent = nullptr);
|
|
~newProfile();
|
|
|
|
signals:
|
|
void mousePressEvent(QMouseEvent* event);
|
|
|
|
private slots:
|
|
void on_saveButton_clicked();
|
|
void on_profileNameEdit_textChanged(const QString &arg1);
|
|
void on_cancelButton_clicked();
|
|
void listProfiles();
|
|
//void editEntryName(QListWidgetItem *item);
|
|
|
|
void on_addButton_pressed();
|
|
|
|
void saveChange();
|
|
void on_removeButton_pressed();
|
|
|
|
private:
|
|
Ui::newProfile *ui;
|
|
QString newProfileName;
|
|
QStyledItemDelegate *deleg = new QStyledItemDelegate(this);
|
|
QStringList origProfileList;
|
|
QStringList newProfileList;
|
|
QStringList removedList;
|
|
int latestIndex = 0;
|
|
};
|
|
|
|
// New class for editing so we can detect when the editing has finished
|
|
class SignalItemDelegate : public QStyledItemDelegate
|
|
{
|
|
Q_OBJECT
|
|
Q_DISABLE_COPY(SignalItemDelegate)
|
|
public:
|
|
explicit SignalItemDelegate(QObject* parent = Q_NULLPTR):QStyledItemDelegate(parent){
|
|
QObject::connect(this,&SignalItemDelegate::closeEditor,this,&SignalItemDelegate::editFinished);
|
|
}
|
|
void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE {
|
|
void editStarted();
|
|
return QStyledItemDelegate::setEditorData(editor,index);
|
|
}
|
|
Q_SIGNALS:
|
|
void editStarted();
|
|
void editFinished();
|
|
};
|
|
#endif // NEWPROFILE_H
|