1 // Copyright 2010 Ilkka Tengvall
3 // This file is part of Woller.
5 // Woller is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
10 // Woller is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Woller. If not, see <http://www.gnu.org/licenses/>.
26 #include <QHostAddress>
28 #include <QPushButton>
30 #include <QVBoxLayout>
31 #include <QHBoxLayout>
49 class HostWidget : public QWidget
54 HostWidget(QWidget *parent = 0, host_s *host = 0);
69 QHBoxLayout *host_row;
77 QHBoxLayout *button_row;
82 class ConfigWidget : public QWidget
87 ConfigWidget(QWidget *parent = 0, QList<host_s> *hosts = 0);
89 //QListWidget *lista(QWidget *parent = 0);
103 void hosts_changed();
106 // QPushButton *add_host;
108 QVBoxLayout *button_layout;
110 QPushButton *add_host;
111 QPushButton *edit_host;
112 QPushButton *del_host;
113 QPushButton *save_btn;
114 QPushButton *close_btn;
115 HostWidget *host_widget;
116 QList<host_s> *hosts_list;
128 int get_mac( QString *gmac);
129 int set_mac( const QString mac );
130 int get_ip( QHostAddress *ip );
131 int set_ip( const QHostAddress );
134 #define WOL_MAGIC_MAC_CNT 16
135 #define WOL_MAGIC_UDP_PORT 9
138 QByteArray *magic_pkt;
139 int create_magic_pkt( const QString *mac );
144 #define MAX_MAC_LEN 12
145 #define MAX_IP_LEN 15
148 class Woller : public QWidget
152 #define WOLLER_RC_FILE ".wollerrc"
156 Woller(QWidget *parent = 0);
162 void targets_act(int);
163 void add_new(host_s *host);
164 void hosts_changed();
168 QTimer *status_timer;
170 QString *status_orig;
171 QPushButton *fire_btn;
172 QComboBox *targets_cb;
173 QVBoxLayout *vlayout;
174 QHBoxLayout *hlayout;
177 ConfigWidget *config_win;
181 QList<host_s> *hosts_list;
186 class MainWindow : public QMainWindow