DrewTechs
3 years ago
4 changed files with 273 additions and 0 deletions
@ -0,0 +1,84 @@ |
|||||
|
#include "unfiledNotes.h" |
||||
|
#include "ui_unfiledNotes.h" |
||||
|
|
||||
|
UnfiledNotes::UnfiledNotes(QList<ApplicationLaunchers*> appLaunchers, QWidget *parent) : |
||||
|
QDialog(parent), |
||||
|
ui(new Ui::UnfiledNotes) |
||||
|
{ |
||||
|
ui->setupUi(this); |
||||
|
setApplicationLauncher(appLaunchers); |
||||
|
init(); |
||||
|
} |
||||
|
|
||||
|
UnfiledNotes::~UnfiledNotes() |
||||
|
{ |
||||
|
delete ui; |
||||
|
} |
||||
|
|
||||
|
void UnfiledNotes::init() |
||||
|
{ |
||||
|
QStringList extensionItems; |
||||
|
QStringList extensions; |
||||
|
int appLauncher_idx = 0; |
||||
|
for(appLauncher_idx = 0; appLauncher_idx < applicationLaunchers.size(); appLauncher_idx++) |
||||
|
{ |
||||
|
int extensions_idx = 0; |
||||
|
for(extensions_idx = 0; extensions_idx < applicationLaunchers.at(appLauncher_idx)->getApplicationExtensions().size(); extensions_idx++) |
||||
|
{ |
||||
|
extensions.append(applicationLaunchers.at(appLauncher_idx)->getSingleApplicationExtension(extensions_idx)); |
||||
|
extensionItems.append(applicationLaunchers.at(appLauncher_idx)->getApplicationName() |
||||
|
+ " (" + applicationLaunchers.at(appLauncher_idx)->getSingleApplicationExtension(extensions_idx) + ")"); |
||||
|
} |
||||
|
} |
||||
|
setExtensionList(extensions); |
||||
|
ui->fileExtensionBox->addItems(extensionItems); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
void UnfiledNotes::on_buttonBox_accepted() |
||||
|
{ |
||||
|
if(ui->fileExtensionBox->currentText() != "") |
||||
|
{ |
||||
|
int idx = 0; |
||||
|
for(idx = 0; idx < getExtensionList().size(); idx++) |
||||
|
{ |
||||
|
if(idx == ui->fileExtensionBox->currentIndex()) |
||||
|
{ |
||||
|
QString extension = extensionList.at(idx); |
||||
|
setExtension(idx); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
accept(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
void UnfiledNotes::on_buttonBox_rejected() |
||||
|
{ |
||||
|
reject(); |
||||
|
} |
||||
|
|
||||
|
void UnfiledNotes::setApplicationLauncher(QList<ApplicationLaunchers*> appLaunchers) |
||||
|
{ |
||||
|
applicationLaunchers = appLaunchers; |
||||
|
} |
||||
|
void UnfiledNotes::setExtensionList(QStringList newExtensionList) |
||||
|
{ |
||||
|
extensionList = newExtensionList; |
||||
|
} |
||||
|
void UnfiledNotes::setExtension(int idx) |
||||
|
{ |
||||
|
extension = extensionList.at(idx); |
||||
|
} |
||||
|
ApplicationLaunchers* UnfiledNotes::getApplicationLauncherAt(int idx) |
||||
|
{ |
||||
|
return applicationLaunchers.at(idx); |
||||
|
} |
||||
|
QStringList UnfiledNotes::getExtensionList() |
||||
|
{ |
||||
|
return extensionList; |
||||
|
} |
||||
|
QString UnfiledNotes::getExtension() |
||||
|
{ |
||||
|
return extension; |
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
#ifndef UNFILEDNOTES_H |
||||
|
#define UNFILEDNOTES_H |
||||
|
|
||||
|
#include <QDialog> |
||||
|
#include "applicationlaunchers.h" |
||||
|
|
||||
|
namespace Ui { |
||||
|
class UnfiledNotes; |
||||
|
} |
||||
|
|
||||
|
class UnfiledNotes : public QDialog |
||||
|
{ |
||||
|
Q_OBJECT |
||||
|
|
||||
|
public: |
||||
|
explicit UnfiledNotes(QList<ApplicationLaunchers*> appLaunchers, QWidget *parent = nullptr); |
||||
|
~UnfiledNotes(); |
||||
|
|
||||
|
void init(); |
||||
|
|
||||
|
void setApplicationLauncher(QList<ApplicationLaunchers*> appLaunchers); |
||||
|
QStringList getExtensionList(); |
||||
|
void setExtension(int idx); |
||||
|
|
||||
|
void setExtensionList(QStringList newExtensionList); |
||||
|
ApplicationLaunchers* getApplicationLauncherAt(int idx); |
||||
|
QString getExtension(); |
||||
|
|
||||
|
private slots: |
||||
|
void on_buttonBox_accepted(); |
||||
|
void on_buttonBox_rejected(); |
||||
|
|
||||
|
private: |
||||
|
Ui::UnfiledNotes *ui; |
||||
|
QList<ApplicationLaunchers*> applicationLaunchers; |
||||
|
QStringList extensionList; |
||||
|
QString extension; |
||||
|
}; |
||||
|
|
||||
|
#endif // UNFILEDNOTES_H
|
@ -0,0 +1,132 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<ui version="4.0"> |
||||
|
<class>UnfiledNotes</class> |
||||
|
<widget class="QDialog" name="UnfiledNotes"> |
||||
|
<property name="geometry"> |
||||
|
<rect> |
||||
|
<x>0</x> |
||||
|
<y>0</y> |
||||
|
<width>473</width> |
||||
|
<height>140</height> |
||||
|
</rect> |
||||
|
</property> |
||||
|
<property name="windowTitle"> |
||||
|
<string>Create Unfiled Note</string> |
||||
|
</property> |
||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2"> |
||||
|
<item> |
||||
|
<layout class="QVBoxLayout" name="verticalLayout"> |
||||
|
<item> |
||||
|
<layout class="QHBoxLayout" name="horizontalLayout"> |
||||
|
<item> |
||||
|
<widget class="QLabel" name="label"> |
||||
|
<property name="font"> |
||||
|
<font> |
||||
|
<pointsize>12</pointsize> |
||||
|
</font> |
||||
|
</property> |
||||
|
<property name="text"> |
||||
|
<string>Select Application:</string> |
||||
|
</property> |
||||
|
</widget> |
||||
|
</item> |
||||
|
<item> |
||||
|
<spacer name="horizontalSpacer"> |
||||
|
<property name="orientation"> |
||||
|
<enum>Qt::Horizontal</enum> |
||||
|
</property> |
||||
|
<property name="sizeHint" stdset="0"> |
||||
|
<size> |
||||
|
<width>40</width> |
||||
|
<height>20</height> |
||||
|
</size> |
||||
|
</property> |
||||
|
</spacer> |
||||
|
</item> |
||||
|
</layout> |
||||
|
</item> |
||||
|
<item> |
||||
|
<spacer name="verticalSpacer_2"> |
||||
|
<property name="orientation"> |
||||
|
<enum>Qt::Vertical</enum> |
||||
|
</property> |
||||
|
<property name="sizeHint" stdset="0"> |
||||
|
<size> |
||||
|
<width>20</width> |
||||
|
<height>40</height> |
||||
|
</size> |
||||
|
</property> |
||||
|
</spacer> |
||||
|
</item> |
||||
|
<item> |
||||
|
<widget class="QComboBox" name="fileExtensionBox"> |
||||
|
<property name="font"> |
||||
|
<font> |
||||
|
<pointsize>12</pointsize> |
||||
|
</font> |
||||
|
</property> |
||||
|
</widget> |
||||
|
</item> |
||||
|
<item> |
||||
|
<spacer name="verticalSpacer"> |
||||
|
<property name="orientation"> |
||||
|
<enum>Qt::Vertical</enum> |
||||
|
</property> |
||||
|
<property name="sizeHint" stdset="0"> |
||||
|
<size> |
||||
|
<width>20</width> |
||||
|
<height>40</height> |
||||
|
</size> |
||||
|
</property> |
||||
|
</spacer> |
||||
|
</item> |
||||
|
<item> |
||||
|
<widget class="QDialogButtonBox" name="buttonBox"> |
||||
|
<property name="orientation"> |
||||
|
<enum>Qt::Horizontal</enum> |
||||
|
</property> |
||||
|
<property name="standardButtons"> |
||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
||||
|
</property> |
||||
|
</widget> |
||||
|
</item> |
||||
|
</layout> |
||||
|
</item> |
||||
|
</layout> |
||||
|
</widget> |
||||
|
<resources/> |
||||
|
<connections> |
||||
|
<connection> |
||||
|
<sender>buttonBox</sender> |
||||
|
<signal>accepted()</signal> |
||||
|
<receiver>UnfiledNotes</receiver> |
||||
|
<slot>accept()</slot> |
||||
|
<hints> |
||||
|
<hint type="sourcelabel"> |
||||
|
<x>248</x> |
||||
|
<y>254</y> |
||||
|
</hint> |
||||
|
<hint type="destinationlabel"> |
||||
|
<x>157</x> |
||||
|
<y>274</y> |
||||
|
</hint> |
||||
|
</hints> |
||||
|
</connection> |
||||
|
<connection> |
||||
|
<sender>buttonBox</sender> |
||||
|
<signal>rejected()</signal> |
||||
|
<receiver>UnfiledNotes</receiver> |
||||
|
<slot>reject()</slot> |
||||
|
<hints> |
||||
|
<hint type="sourcelabel"> |
||||
|
<x>316</x> |
||||
|
<y>260</y> |
||||
|
</hint> |
||||
|
<hint type="destinationlabel"> |
||||
|
<x>286</x> |
||||
|
<y>274</y> |
||||
|
</hint> |
||||
|
</hints> |
||||
|
</connection> |
||||
|
</connections> |
||||
|
</ui> |
@ -0,0 +1,17 @@ |
|||||
|
#ifndef UNFILEDNOTES_H |
||||
|
#define UNFILEDNOTES_H |
||||
|
|
||||
|
#include <QObject> |
||||
|
#include <QWidget> |
||||
|
|
||||
|
class UnfiledNotes |
||||
|
{ |
||||
|
Q_OBJECT |
||||
|
public: |
||||
|
UnfiledNotes(); |
||||
|
QString unfiledNoteName; |
||||
|
QString unfiledNoteLocation; |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
#endif // UNFILEDNOTES_H
|
Loading…
Reference in new issue