forked from AttorneyOnline/AO2-Client
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathaonotepicker.cpp
53 lines (43 loc) · 1.48 KB
/
aonotepicker.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "aonotepicker.hpp"
#include "courtroom.h"
#include <QFileDialog>
#include <QDebug>
AONotePicker::AONotePicker(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
{
ao_app = p_ao_app;
}
AONotePicker::~AONotePicker()
{}
void Courtroom::on_file_selected()
{
for(int i=0; i < ui_note_area->m_layout->count() -1; ++i)
{
AONotePicker *f_notepicker = static_cast<AONotePicker*>(ui_note_area->m_layout->itemAt(i)->widget());
f_notepicker->m_hover->set_image("note_select.png");
}
AOButton *f_button = static_cast<AOButton*>(sender());
AONotePicker *f_notepicker = static_cast<AONotePicker*>(f_button->parent());
current_file = f_notepicker->real_file;
load_note();
f_button->set_image("note_select_selected.png");
}
void Courtroom::on_set_file_button_clicked()
{
AOButton *f_button = static_cast<AOButton*>(sender());
AONotePicker *f_notepicker = static_cast<AONotePicker*>(f_button->parent());
QString f_filename = QFileDialog::getOpenFileName(this, "Open File");
if(f_filename != "")
{
f_notepicker->m_line->setText(f_filename);
f_notepicker->real_file = f_filename;
set_note_files();
}
}
void Courtroom::on_delete_button_clicked()
{
AOButton *f_button = static_cast<AOButton*>(sender());
AONotePicker *f_notepicker = static_cast<AONotePicker*>(f_button->parent());
ui_note_area->m_layout->removeWidget(f_notepicker);
delete f_notepicker;
set_note_files();
}