2 ***************************************************************************
4 * 4F, No. 2 Technology 5th Rd.
5 * Science-based Industrial Park
6 * Hsin-chu, Taiwan, R.O.C.
8 * (c) Copyright 2002, Ralink Technology, Inc.
10 * All rights reserved. Ralink's source code is an unpublished work and the
11 * use of a copyright notice does not imply otherwise. This source code
12 * contains confidential trade secret material of Ralink Tech. Any attemp
13 * or participation in deciphering, decoding, reverse engineering or in any
14 * way altering the source code is stricitly prohibited, unless the prior
15 * written consent of Ralink Technology, Inc. is obtained.
16 ***************************************************************************
22 Implement card select Dialog.
26 -------- ---------- ----------------------------------------------
27 Paul Wu 01-22-2003 created
28 Paul Wu 11-10-2003 Modify for RT2500 ApConfig
32 #include "cardselect.h"
35 #include <qapplication.h>
38 #include <qlistview.h>
40 #include <qpushbutton.h>
42 #include <qdragobject.h>
45 #include <qwhatsthis.h>
48 #include <qmessagebox.h>
50 static QPixmap
uic_load_pixmap_CardSelect( const QString
&name
)
52 const QMimeSource
*m
= QMimeSourceFactory::defaultFactory()->data( name
);
56 QImageDrag::decode( m
, pix
);
60 * Constructs a CardSelect which is a child of 'parent', with the
61 * name 'name' and widget flags set to 'f'.
63 * The dialog will by default be modeless, unless you set 'modal' to
64 * TRUE to construct a modal dialog.
66 CardSelect::CardSelect( int Socket_Id
, PRT_DEVICE_ADAPTER prtAdapter
, QWidget
* parent
, const char* name
, bool modal
, WFlags fl
)
67 : QDialog( parent
, name
, modal
, fl
)
70 setName( "CardSelect" );
72 setMinimumSize( 493, 224 );
73 setMaximumSize( 493, 224 );
74 setCaption("Select Wireless Adapter");
76 qApp
->setStyle("Windows");
78 TextLabel1
= new QLabel(this, "TextLabel1" );
79 TextLabel1
->setGeometry( QRect( 20, 20, 400, 20 ) );
80 TextLabel1
->setText("Please select a adapter to configure :");
82 OkPushButton
= new QPushButton( this, "OkPushButton" );
83 OkPushButton
->setGeometry( QRect( 216, 180, 60, 30 ) );
84 OkPushButton
->setText("&Ok");
86 AdapterListView
= new QListView( this, "AdapterListView" );
87 AdapterListView
->addColumn("");
88 AdapterListView
->addColumn(" Device Name ");
89 AdapterListView
->addColumn(" Type ");
90 AdapterListView
->addColumn(" MAC Address ");
91 AdapterListView
->setGeometry( QRect( 20, 50, 450, 111 ) );
92 AdapterListView
->setSelectionMode( QListView::Single
);
93 AdapterListView
->setHScrollBarMode( QListView::AlwaysOn
);
94 AdapterListView
->setAllColumnsShowFocus( TRUE
);
103 Item
= new QListViewItem(AdapterListView
, 0);
104 sprintf(tmp
, " %d ", index
++);
105 Item
-> setText(0, tmp
);
106 Item
-> setPixmap(0, uic_load_pixmap_CardSelect("adapter.xpm"));
107 Item
-> setText(1, (const char *)prtAdapter
->Device_Name
);
108 Item
-> setText(2, " Wireless Ethernet ");
109 NDIS_802_11_MAC_ADDRESS CurrentAddress
;
111 if( OidQueryInformation(OID_802_3_CURRENT_ADDRESS
, Socket_Id
, prtAdapter
->Device_Name
, &CurrentAddress
, sizeof(CurrentAddress
)) >= 0)
113 sprintf(tmp
, "%02X-%02X-%02X-%02X-%02X-%02X", CurrentAddress
[0], CurrentAddress
[1],
114 CurrentAddress
[2], CurrentAddress
[3], CurrentAddress
[4], CurrentAddress
[5]);
115 Item
-> setText(3, (const char *)tmp
);
120 AdapterListView
->setSelected(Item
, TRUE
);
123 prtAdapter
= prtAdapter
->Next
;
126 // signals and slots connections
127 connect( OkPushButton
, SIGNAL( clicked() ), this, SLOT( OkPushButton_Clicked() ) );
128 connect( AdapterListView
, SIGNAL( doubleClicked(QListViewItem
*) ), this, SLOT( AdapterListView_doubleClicked() ) );
134 * Destroys the object and frees any allocated resources
136 CardSelect::~CardSelect()
138 // no need to delete child widgets, Qt does it all for us
141 void CardSelect::AdapterListView_doubleClicked()
143 OkPushButton_Clicked();
146 const char *CardSelect::Get_Device_Name()
148 return device
.ascii();
151 void CardSelect::OkPushButton_Clicked()
156 Item
= AdapterListView
->currentItem();
159 QMessageBox::warning(this, "Warning", "Please select a adapter first.!");
162 device
=Item
->text(1);
167 bool CardSelect::isClickOk()