3
3
4
4
Marco::Marco (QWidget *parent)
5
5
{
6
- /* Faire un constructeur vide pour le viewer */
7
6
8
7
QHBoxLayout *layout_main = new QHBoxLayout;
9
8
QVBoxLayout *layout_infos = new QVBoxLayout;
10
- QHBoxLayout *layout_radio = new QHBoxLayout;
9
+
11
10
QList<QString> header ;
12
11
13
12
sum_manga = new QSummaryManga;
14
13
sum_show = new QSummaryShow;
15
14
16
- button_circular = new QRadioButton (" Circular" );
17
- button_normal = new QRadioButton (" Normal" );
18
-
19
- header << " Name" << " Next" << " Status" ;
15
+ header << " Name" << " Last" << " Next" ;
20
16
21
- button_normal->setChecked (true );
22
17
table_infos_scans = new QTableWidget (0 ,3 );
23
18
table_infos_shows = new QTableWidget (0 ,3 );
24
19
@@ -61,12 +56,9 @@ Marco::Marco(QWidget *parent)
61
56
62
57
fill_table (infos_vu);
63
58
64
- layout_radio->addWidget (button_normal);
65
- layout_radio->addWidget (button_circular);
66
- layout_radio->addStretch (1 );
67
59
layout_infos->addWidget (table_infos_shows,1 );
68
60
layout_infos->addWidget (table_infos_scans,1 );
69
- layout_infos-> addItem (layout_radio);
61
+
70
62
layout_infos->addWidget (sum_manga);
71
63
72
64
layout_main->addLayout (layout_infos);
@@ -86,6 +78,7 @@ void Marco::fill_table(map<string,string> infos)
86
78
{
87
79
name = i->first ;
88
80
info = i->second ;
81
+
89
82
if (info[0 ] == ' S' )
90
83
{
91
84
table_infos_shows->insertRow (c_show);
@@ -97,48 +90,47 @@ void Marco::fill_table(map<string,string> infos)
97
90
{
98
91
table_infos_scans->insertRow (c_scan);
99
92
table_infos_scans->setItem (c_scan,0 ,new QTableWidgetItem (Easylast::stoqs (name)));
100
- table_infos_scans->setItem (c_scan,1 ,new QTableWidgetItem (Easylast::itoqs (atoi (info.c_str ())+1 )));
101
93
102
- if (Easylast::stoi (info)+1 <= Easylast::stoi (infos_dl[name]))
103
- table_infos_scans->setItem (c_scan,2 ,new QTableWidgetItem (" Ready" ));
104
- else
105
- table_infos_scans->setItem (c_scan,2 ,new QTableWidgetItem (" Not Ready" ));
94
+ set_row_scan (c_scan,name,Easylast::stoi (info));
106
95
c_scan++;
107
96
}
108
- }
109
-
97
+ }
98
+ }
99
+
100
+ void Marco::set_row_scan (int row,string name_scan,int num_scan)
101
+ {
102
+ table_infos_scans->setItem (row,1 ,new QTableWidgetItem (Easylast::itoqs (num_scan)));
103
+
104
+ if (num_scan+1 <= Easylast::stoi (infos_dl[name_scan]))
105
+ table_infos_scans->setItem (row,2 ,new QTableWidgetItem (Easylast::itoqs (num_scan+1 )+" Ready" ));
106
+ else
107
+ table_infos_scans->setItem (row,2 ,new QTableWidgetItem (Easylast::itoqs (num_scan+1 )+" Not Ready" ));
110
108
}
111
109
112
110
void Marco::set_new_scan (string scan_cur,int num_cur)
113
111
{
114
112
string cmd = " client_last --VU --inc -t " +scan_cur;
115
113
int row_count = table_infos_scans->rowCount ();
116
- system (cmd.c_str ());
117
-
114
+
118
115
sum_manga->setName (scan_cur);
119
116
sum_manga->setChap (num_cur);
120
117
121
118
summary = sum_manga;
122
119
123
- if (button_normal-> isChecked ( ))
120
+ if (num_cur > Easylast::stoi (infos_vu[scan_cur] ))
124
121
{
125
- if (num_cur < Easylast::stoi (infos_dl[scan_cur]))
126
- viewer->setScan (scan_cur,num_cur+1 );
127
- else
128
- {
129
- int curr_row = table_infos_scans->currentRow ();
130
- if (curr_row < row_count)
131
- {
132
- string new_name = table_infos_scans->item (curr_row+1 ,0 )->text ().toStdString ();
133
- int new_num = Easylast::stoi (table_infos_scans->item (curr_row+1 ,1 )->text ().toStdString ());
134
- table_infos_scans->setCurrentCell (curr_row+1 ,0 );
135
- viewer->setScan (new_name,new_num);
136
- }
137
- }
122
+ for (int i = 0 ;i<table_infos_scans->rowCount ();i++)
123
+
124
+ if (table_infos_scans->item (i,0 )->text ().toStdString () == scan_cur)
125
+ set_row_scan (i,scan_cur,num_cur);
126
+
127
+ system (cmd.c_str ());
138
128
}
139
-
140
- if (button_circular->isChecked ())
141
- {
129
+
130
+ if (num_cur < Easylast::stoi (infos_dl[scan_cur]))
131
+ viewer->setScan (scan_cur,num_cur+1 );
132
+ else
133
+ {
142
134
int curr_row = table_infos_scans->currentRow ();
143
135
if (curr_row < row_count)
144
136
{
@@ -148,6 +140,8 @@ void Marco::set_new_scan(string scan_cur,int num_cur)
148
140
viewer->setScan (new_name,new_num);
149
141
}
150
142
}
143
+
144
+
151
145
152
146
153
147
}
0 commit comments