diff --git a/frame/qqtpassworddialog.cpp b/frame/qqtpassworddialog.cpp
new file mode 100644
index 00000000..32b02828
--- /dev/null
+++ b/frame/qqtpassworddialog.cpp
@@ -0,0 +1,46 @@
+#include "qqtpassworddialog.h"
+#include "ui_qqtpassworddialog.h"
+
+QQTPasswordDialog::QQTPasswordDialog(QWidget *parent) :
+ QQTDialog(parent),
+ ui(new Ui::QQTPasswordDialog)
+{
+ ui->setupUi(this);
+ setAttribute(Qt::WA_DeleteOnClose, false);
+ /*
+ * 阻挡父亲窗口内其他控件,除非本dialog关闭 show的功能强大起来 可以使用输入法
+ */
+ setWindowModality(Qt::WindowModal);
+ ui->lineEdit_ssid_password->setEchoMode(QLineEdit::Password);
+ ui->pushButton_ssid_connect->setEnabled(false);
+ connect(ui->pushButton_ssid_connect, SIGNAL(clicked()), this, SLOT(connectClicked()));
+ connect(ui->lineEdit_ssid_password, SIGNAL(textChanged(QString)), SLOT(btnEnabled(QString)));
+ connect(ui->btnCancel, SIGNAL(clicked()), this, SLOT(reject()));
+}
+
+QQTPasswordDialog::~QQTPasswordDialog()
+{
+ delete ui;
+}
+
+void QQTPasswordDialog::setWifiName(QString name)
+{
+ ui->label_ssid_name->setText(name);
+}
+
+QString QQTPasswordDialog::wifiPwd()
+{
+ return ui->lineEdit_ssid_password->text();
+}
+
+void QQTPasswordDialog::connectClicked()
+{
+ emit connectClicked(ui->lineEdit_ssid_password->text());
+ accept();
+}
+
+void QQTPasswordDialog::btnEnabled(QString pas)
+{
+ bool enable = pas.length()<8?false:true;
+ ui->pushButton_ssid_connect->setEnabled(enable);
+}
diff --git a/frame/qqtpassworddialog.h b/frame/qqtpassworddialog.h
new file mode 100644
index 00000000..98eeb8a6
--- /dev/null
+++ b/frame/qqtpassworddialog.h
@@ -0,0 +1,31 @@
+#ifndef QQTPASSWORDDIALOG_H
+#define QQTPASSWORDDIALOG_H
+
+#include "qqtdialog.h"
+
+namespace Ui {
+class QQTPasswordDialog;
+}
+
+class QQTPasswordDialog : public QQTDialog
+{
+ Q_OBJECT
+
+public:
+ explicit QQTPasswordDialog(QWidget *parent = 0);
+ ~QQTPasswordDialog();
+
+ void setWifiName(QString name);
+ QString wifiPwd();
+
+signals:
+ void connectClicked(QString password);
+private slots:
+ void connectClicked();
+ void btnEnabled(QString);
+
+private:
+ Ui::QQTPasswordDialog *ui;
+};
+
+#endif // QQTPASSWORDDIALOG_H
diff --git a/frame/qqtpassworddialog.ui b/frame/qqtpassworddialog.ui
new file mode 100644
index 00000000..d88b357f
--- /dev/null
+++ b/frame/qqtpassworddialog.ui
@@ -0,0 +1,94 @@
+
+
+ QQTPasswordDialog
+
+
+
+ 0
+ 0
+ 413
+ 202
+
+
+
+ Password
+
+
+
+
+ 9
+ 30
+ 61
+ 17
+
+
+
+ WIFI:
+
+
+
+
+
+ 10
+ 80
+ 391
+ 27
+
+
+
+
+
+
+ 270
+ 150
+ 85
+ 27
+
+
+
+ Connect
+
+
+
+
+
+ 80
+ 31
+ 311
+ 17
+
+
+
+ SSID NAME
+
+
+
+
+
+ 50
+ 150
+ 85
+ 27
+
+
+
+ Cancel
+
+
+
+
+
+ QQTPushButton
+ QPushButton
+
+
+
+ QQTDialog
+ QWidget
+
+ 1
+
+
+
+
+
diff --git a/frame/qqtpreviewwidget.cpp b/frame/qqtpreviewwidget.cpp
new file mode 100644
index 00000000..90c85b5b
--- /dev/null
+++ b/frame/qqtpreviewwidget.cpp
@@ -0,0 +1,323 @@
+#include "qqtpreviewwidget.h"
+#include "ui_qqtpreviewwidget.h"
+
+QQTPreviewWidget::QQTPreviewWidget(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::QQTPreviewWidget)
+{
+ ui->setupUi(this);
+
+ memset(&sinfo, 0, sizeof(struct sensor_info));
+ pre_bpp = 16;
+ rate = 15; /* default to 15fps */
+ addr = 0;
+ phys = 0;
+
+ pre_size.w = 720;
+ pre_size.h = 480;
+
+ fd = 0;
+
+ memset( & pre_memory, 0, sizeof(struct camera_memory));
+ memset( & pre_buf, 0, sizeof(struct camera_buffer));
+ memset( & pre_size, 0, sizeof(struct frm_size));
+
+ tlb_base_phys = 0;
+ format = HAL_PIXEL_FORMAT_YCbCr_422_I;
+
+ bFullScreen = false;
+ m_parent = parent;
+
+ timer = new QTimer(this);
+ timer->setSingleShot(false);
+ connect(timer, SIGNAL(timeout()), this, SLOT(update()));
+}
+
+QQTPreviewWidget::~QQTPreviewWidget()
+{
+ delete ui;
+}
+
+int QQTPreviewWidget::play()
+{
+ /*
+ * 这块代码放在哪里
+ */
+ dmmu_init();
+ dmmu_get_page_table_base_phys(&tlb_base_phys);
+
+ fd = ::open("/dev/cim", O_RDWR); //av
+ if (fd < 0) {
+ qDebug() << "Open device fail\n";
+ }
+ ioctl(fd, CIMIO_SELECT_SENSOR, sinfo.sensor_id);
+
+ ioctl(fd, CIMIO_GET_SENSORINFO, &sinfo);
+
+ ioctl(fd, CIMIO_SET_TLB_BASE, tlb_base_phys);//?????????
+
+ int i = 0;
+
+ if(pre_buf.common && pre_buf.common->data)
+ {
+ dmmu_unmap_user_memory(&(pre_buf.dmmu_info));
+ free(pre_buf.common->data);
+ }
+
+ pre_buf.fd = fd;
+ pre_buf.nr = 5;
+ pre_buf.size = pre_size.w * pre_size.h * 3;
+ pre_buf.common = &pre_memory;
+ pre_buf.common->size = pre_buf.size * pre_buf.nr;
+ pre_buf.common->data = memalign(4096, pre_buf.size * pre_buf.nr);
+ memset(pre_buf.common->data, 0xa5, (pre_buf.size * pre_buf.nr));
+ if (pre_buf.common->data == NULL)
+ {
+ printf("==<%s L%d: null pointer!\n", __func__, __LINE__);
+ return false;
+ }
+
+ pre_buf.paddr = 0;
+ pre_buf.dmmu_info.vaddr = pre_buf.common->data;
+ pre_buf.dmmu_info.size = pre_buf.common->size;
+
+ for (i = 0; i < (int)(pre_buf.common->size); i += 0x1000)
+ {
+ ((uint8_t*)(pre_buf.common->data))[i] = 0xff;
+ }
+
+ ((uint8_t*)(pre_buf.common->data))[pre_buf.common->size - 1] = 0xff;
+ dmmu_map_user_memory(&(pre_buf.dmmu_info));
+
+ for (i= 0; i < pre_buf.nr; ++i) {
+ pre_buf.yuvMeta[i].index = i;
+ pre_buf.yuvMeta[i].width = pre_size.w;
+ pre_buf.yuvMeta[i].height = pre_size.h;
+ pre_buf.yuvMeta[i].format = format;
+ pre_buf.yuvMeta[i].count = pre_buf.nr;
+#ifdef __LINUX64__
+ pre_buf.yuvMeta[i].yAddr = (int64_t)pre_buf.common->data + (pre_buf.size) * i;
+#else
+ pre_buf.yuvMeta[i].yAddr = (int32_t)pre_buf.common->data + (pre_buf.size) * i;
+#endif
+ pre_buf.yuvMeta[i].yPhy = pre_buf.paddr + i * (pre_buf.size);
+ if (pre_buf.yuvMeta[i].format == HAL_PIXEL_FORMAT_YCbCr_422_I) { //yuv422 packed
+ pre_buf.yuvMeta[i].uAddr = pre_buf.yuvMeta[i].yAddr;
+ pre_buf.yuvMeta[i].vAddr = pre_buf.yuvMeta[i].uAddr;
+ pre_buf.yuvMeta[i].uPhy = pre_buf.yuvMeta[i].yPhy;
+ pre_buf.yuvMeta[i].vPhy = pre_buf.yuvMeta[i].uPhy;
+ pre_buf.yuvMeta[i].yStride = pre_buf.yuvMeta[i].width<<1;
+ pre_buf.yuvMeta[i].uStride = pre_buf.yuvMeta[i].yStride;
+ pre_buf.yuvMeta[i].vStride = pre_buf.yuvMeta[i].yStride;
+ } else if (pre_buf.yuvMeta[i].format == HAL_PIXEL_FORMAT_JZ_YUV_420_P) { //yuv420 planar
+ pre_buf.yuvMeta[i].uAddr = pre_buf.yuvMeta[i].yAddr + pre_size.w * pre_size.h;
+ pre_buf.yuvMeta[i].vAddr = pre_buf.yuvMeta[i].uAddr + pre_size.w * pre_size.h / 4;
+ pre_buf.yuvMeta[i].uPhy = pre_buf.yuvMeta[i].yPhy + pre_size.w * pre_size.h;
+ pre_buf.yuvMeta[i].vPhy = pre_buf.yuvMeta[i].uPhy + pre_size.w * pre_size.h / 4;
+ pre_buf.yuvMeta[i].yStride = pre_buf.yuvMeta[i].width<<1;
+ pre_buf.yuvMeta[i].uStride = pre_buf.yuvMeta[i].width / 2;
+ pre_buf.yuvMeta[i].vStride = pre_buf.yuvMeta[i].width / 2;
+ } else if (pre_buf.yuvMeta[i].format == HAL_PIXEL_FORMAT_RAW_SENSOR) { //raw bayer
+ pre_buf.yuvMeta[i].uAddr = pre_buf.yuvMeta[i].yAddr + pre_size.w * pre_size.h;
+ pre_buf.yuvMeta[i].vAddr = pre_buf.yuvMeta[i].uAddr;
+ pre_buf.yuvMeta[i].uPhy = pre_buf.yuvMeta[i].yPhy;
+ pre_buf.yuvMeta[i].vPhy = pre_buf.yuvMeta[i].uPhy;
+ pre_buf.yuvMeta[i].yStride = pre_buf.yuvMeta[i].width;
+ pre_buf.yuvMeta[i].uStride = pre_buf.yuvMeta[i].yStride;
+ pre_buf.yuvMeta[i].vStride = pre_buf.yuvMeta[i].yStride;
+ }
+ }
+
+ ioctl(fd, CIMIO_SET_PREVIEW_FMT, format);
+ ioctl(fd, CIMIO_SET_PREVIEW_SIZE, &pre_size);
+
+ ioctl(fd, CIMIO_SET_PREVIEW_MEM, (unsigned long)(pre_buf.yuvMeta));
+
+ ioctl(fd, CIMIO_START_PREVIEW);
+
+ pp = (unsigned char *)malloc(pre_size.w * pre_size.h * 3 * sizeof(char));
+ frame = new QImage(pp, pre_size.w, pre_size.h, QImage::Format_RGB888);
+ timer->start(100);
+
+ return fd;
+}
+
+int QQTPreviewWidget::close()
+{
+ bool ret = false;
+
+ if(fd <= 0)
+ printf("fd < 0\n");
+ ret = ioctl(fd, CIMIO_SHUTDOWN);
+
+ ::close(fd);
+ fd = 0;
+
+ dmmu_unmap_user_memory(&(pre_buf.dmmu_info));
+ dmmu_deinit();
+
+ memset(pre_buf.yuvMeta, 0, pre_buf.nr * sizeof (CameraYUVMeta));
+ pre_buf.size = 0;
+ pre_buf.nr = 0;
+ pre_buf.paddr = 0;
+ pre_buf.fd = -1;
+
+ if((pre_buf.common != NULL) && (pre_buf.common->data != NULL)) {
+ free(pre_buf.common->data);
+ pre_buf.common->data = NULL;
+ }
+
+ phys = 0;
+
+ timer->stop();
+ free(pp);
+ delete frame;
+
+ return ret;
+}
+
+
+int QQTPreviewWidget::convert_yuv_to_rgb_pixel(int y, int u, int v)
+{
+ unsigned int pixel32 = 0;
+ unsigned char *pixel = (unsigned char *)&pixel32;
+ int r, g, b;
+ b = y + ((443 * (u - 128)) >> 8);
+ b = (b < 0) ? 0 : ((b > 255 ) ? 255 : b);
+ g = y - ((179 * (v - 128) + 86 * (u - 128)) >> 8);
+ g = (g < 0) ? 0 : ((g > 255 ) ? 255 : g);
+ r = y + ((351 * (v - 128)) >> 8);
+ r = (r < 0) ? 0 : ((r > 255 ) ? 255 : r);
+ pixel[0] = r;
+ pixel[1] = g;
+ pixel[2] = b;
+ return pixel32;
+}
+
+int QQTPreviewWidget::convert_yuv_to_rgb_buffer(unsigned char *yuv, unsigned char *rgb, unsigned int width, unsigned int height)
+{
+ unsigned int in, out = 0;
+ unsigned int pixel_16;
+ unsigned char pixel_24[3];
+ unsigned int pixel32;
+ int y0, u, y1, v;
+ for(in = 0; in < width * height * 2; in += 4) {
+ pixel_16 =
+ yuv[in + 3] << 24 |
+ yuv[in + 2] << 16 |
+ yuv[in + 1] << 8 |
+ yuv[in + 0];
+ y0 = (pixel_16 & 0x000000ff);
+ u = (pixel_16 & 0x0000ff00) >> 8;
+ y1 = (pixel_16 & 0x00ff0000) >> 16;
+ v = (pixel_16 & 0xff000000) >> 24;
+ pixel32 = convert_yuv_to_rgb_pixel(y0, u, v);
+ pixel_24[0] = (pixel32 & 0x000000ff);
+ pixel_24[1] = (pixel32 & 0x0000ff00) >> 8;
+ pixel_24[2] = (pixel32 & 0x00ff0000) >> 16;
+ rgb[out++] = pixel_24[0];
+ rgb[out++] = pixel_24[1];
+ rgb[out++] = pixel_24[2];
+ pixel32 = convert_yuv_to_rgb_pixel(y1, u, v);
+ pixel_24[0] = (pixel32 & 0x000000ff);
+ pixel_24[1] = (pixel32 & 0x0000ff00) >> 8;
+ pixel_24[2] = (pixel32 & 0x00ff0000) >> 16;
+ rgb[out++] = pixel_24[0];
+ rgb[out++] = pixel_24[1];
+ rgb[out++] = pixel_24[2];
+ }
+ return 0;
+}
+
+
+void QQTPreviewWidget::paintEvent(QPaintEvent *)
+{
+ if(fd <= 0)
+ return;
+
+ QStylePainter painter(this);
+
+ /*
+ * 此处采集视频为多线程采集 上边的log证明 数据已经被修改
+ */
+ addr = ioctl(fd, CIMIO_GET_FRAME);
+ p = (uchar*)addr;
+
+ /*
+ * 不具备优化能力,yuv缺少alpha。
+ */
+ convert_yuv_to_rgb_buffer(p, pp, pre_size.w, pre_size.h);
+ //frame->loadFromData((uchar *)pp, w * h * 3 * sizeof(char));
+ /*
+ * 采集的图像左边上边有黑边 更换摄像头或许回有所改善 待调试
+ */
+ QRect srcRect(2, 6, pre_size.w, pre_size.h);
+ QRect dstRect = rect();
+ painter.scale(1.01, 1.02);
+ /*
+ * 缩放OK
+ */
+ painter.drawImage(dstRect, *frame, srcRect );
+ //painter.drawPixmap(dstRect,QPixmap::fromImage(*frame,Qt::AutoColor),srcRect);;
+ /*
+ * 裁切OK
+ */
+ //painter.drawItemPixmap(srcRect, Qt::AlignCenter, QPixmap::fromImage(*frame,Qt::AutoColor));
+ /*
+ * 30ms 屏幕有闪烁
+ */
+ //update();
+}
+
+
+void QQTPreviewWidget::mousePressEvent(QMouseEvent *e)
+{
+ static bool bGInit = false;
+ if(!bGInit && !bFullScreen)
+ {
+ flags = windowFlags();
+ flags |= Qt::FramelessWindowHint;
+ geome = geometry();
+ bGInit = true;
+ }
+
+#ifdef __MIPS_LINUX__
+ //pline() << e->pos() << e->globalPos();
+ if(e->pos().x() < 0 || e->pos().y() < 0 ||
+ e->pos().x() > geome.width() || e->pos().y() > geome.height())
+ {
+ //在mips板上,全屏返回的时候,点击其他位置,会多响应一次,在此处过滤。
+ pline() << "warning!";
+ Q_UNUSED(e);
+ return;
+ }
+#endif
+
+ setAttribute(Qt::WA_TranslucentBackground, true);
+ setAttribute(Qt::WA_NoMousePropagation, true);
+ setAttribute(Qt::WA_OpaquePaintEvent, true);
+
+ if(bFullScreen)
+ {
+ flags ^= Qt::Window;
+ flags |= Qt::Widget;
+ setParent(m_parent, flags);
+ setGeometry(geome);
+ show();
+ bFullScreen = false;
+ }
+ else
+ {
+ int QQT_SCRN_WIDTH = QApplication::desktop()->availableGeometry().width();
+ int QQT_SCRN_HEIGHT = QApplication::desktop()->availableGeometry().height();
+ flags ^= Qt::Widget;
+ flags |= Qt::Window;
+ setParent(0, flags);
+ setGeometry(0, 0, QQT_SCRN_WIDTH, QQT_SCRN_HEIGHT);
+ show();
+ bFullScreen = true;
+ }
+
+ pline() << flags;
+ QWidget::mousePressEvent(e);
+}
diff --git a/frame/qqtpreviewwidget.h b/frame/qqtpreviewwidget.h
new file mode 100644
index 00000000..5e79251b
--- /dev/null
+++ b/frame/qqtpreviewwidget.h
@@ -0,0 +1,72 @@
+
+#ifndef QPREVIEWUI_H
+#define QPREVIEWUI_H
+
+#include "qqtgui-qt.h"
+#include "qqtlinux.h"
+#include "qqtdefine.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "graphics.h"
+#include "dmmu.h"
+#include "hal.h"
+#include "jz_cim.h"
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+namespace Ui {
+class QQTPreviewWidget;
+}
+
+class QQTPreviewWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit QQTPreviewWidget(QWidget *parent = 0);
+ ~QQTPreviewWidget();
+ int play();
+ int close();
+
+private:
+ Ui::QQTPreviewWidget *ui;
+
+ struct sensor_info sinfo;
+ int pre_bpp;
+ int rate; /* default to 15fps */
+ unsigned int addr;
+ unsigned int phys;
+
+ int fd;
+ int format;
+
+ struct camera_memory pre_memory;
+ struct camera_buffer pre_buf;
+ struct frm_size pre_size;
+ unsigned int tlb_base_phys;
+
+ uchar *pp;
+ uchar * p;
+ QImage *frame;
+ QTimer *timer;
+
+ bool bFullScreen;
+ QWidget* m_parent;
+ QRect geome;
+ Qt::WindowFlags flags;
+
+ int convert_yuv_to_rgb_pixel(int y, int u, int v);
+ int convert_yuv_to_rgb_buffer(unsigned char *yuv, unsigned char *rgb, unsigned int width, unsigned int height);
+
+ // QWidget interface
+protected:
+ void paintEvent(QPaintEvent *);
+ void mousePressEvent(QMouseEvent *e);
+};
+
+#endif // QPREVIEWUI_H
diff --git a/frame/qqtpreviewwidget.ui b/frame/qqtpreviewwidget.ui
new file mode 100644
index 00000000..8a4cf3d4
--- /dev/null
+++ b/frame/qqtpreviewwidget.ui
@@ -0,0 +1,41 @@
+
+
+ QQTPreviewWidget
+
+
+
+ 0
+ 0
+ 498
+ 202
+
+
+
+ Form
+
+
+ -
+
+
+ QQT
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 199
+
+
+
+
+
+
+
+
+
diff --git a/frame/qqtprogressdialog.cpp b/frame/qqtprogressdialog.cpp
new file mode 100644
index 00000000..7b33fe6b
--- /dev/null
+++ b/frame/qqtprogressdialog.cpp
@@ -0,0 +1,65 @@
+#include "qqtprogressdialog.h"
+#include "ui_qqtprogressdialog.h"
+#include "qqtdefine.h"
+#include "qqtobjectfactory.h"
+
+QQTProgressDialog::QQTProgressDialog(QWidget *parent) :
+ QQTDialog(parent),
+ ui(new Ui::QQTProgressDialog)
+{
+ ui->setupUi(this);
+ bar = ui->widgetBar;
+ bar->setRange(0, 100);
+ bar->setValue(0);
+
+ connect(ui->btnCancel, SIGNAL(clicked()),
+ this, SLOT(reject()));
+
+ //setFixedWidth(260);
+
+#ifdef __QQTWIDGETS_K1160__
+ setFixedSize(526, 283);
+ bar->setFixedSize(481, 31);
+ bar->move(20, 50);
+
+ ui->btnCancel->setText("");
+ ui->btnCancel->setFixedSize(104, 40);
+ ui->btnCancel->iconTable().initNormal("./skin/default/bt_back_normal.png",
+ "./skin/default/bt_back_press.png" );
+ ui->btnCancel->iconTable().initOther("./skin/default/bt_back_hover.png",
+ "./skin/default/bt_back_disable.png");
+
+ ui->widgetBar->setPixMap("./skin/default/bk_progress_background.png",
+ "./skin/default/bk_progress_chunk.png");
+#endif
+
+ QQTObjectFactory::registerObject(this);
+ QQTObjectFactory::registerObject(ui->btnCancel);
+}
+
+QQTProgressDialog::~QQTProgressDialog()
+{
+ delete ui;
+}
+
+void QQTProgressDialog::initAll()
+{
+ bar->setRange(0, 100);
+ bar->setValue(0);
+}
+
+void QQTProgressDialog::setRange(int min, int max)
+{
+ bar->setRange(min, max);
+}
+
+void QQTProgressDialog::setContent(QString content)
+{
+ ui->label->setText(content);
+}
+
+void QQTProgressDialog::setValue(int value)
+{
+ bar->setValue(value);
+}
+
diff --git a/frame/qqtprogressdialog.h b/frame/qqtprogressdialog.h
new file mode 100644
index 00000000..9e9ed920
--- /dev/null
+++ b/frame/qqtprogressdialog.h
@@ -0,0 +1,31 @@
+#ifndef QPROGRESSWINDOW_H
+#define QPROGRESSWINDOW_H
+
+#include "qqtdialog.h"
+#include "qqtprogressbar.h"
+
+namespace Ui {
+class QQTProgressDialog;
+}
+
+class QQTProgressDialog : public QQTDialog
+{
+ Q_OBJECT
+
+public:
+ explicit QQTProgressDialog(QWidget *parent = 0);
+ ~QQTProgressDialog();
+
+ void initAll();
+ void setRange(int min, int max);
+ void setContent(QString content);
+
+public slots:
+ void setValue(int value);
+
+private:
+ Ui::QQTProgressDialog *ui;
+ QQTProgressBar* bar;
+};
+
+#endif // QPROGRESSWINDOW_H
diff --git a/frame/qqtprogressdialog.ui b/frame/qqtprogressdialog.ui
new file mode 100644
index 00000000..023c53ae
--- /dev/null
+++ b/frame/qqtprogressdialog.ui
@@ -0,0 +1,74 @@
+
+
+ QQTProgressDialog
+
+
+
+ 0
+ 0
+ 526
+ 283
+
+
+
+ Dialog
+
+
+
+
+ 220
+ 220
+ 85
+ 27
+
+
+
+ Cancel
+
+
+
+
+
+ 20
+ 50
+ 481
+ 31
+
+
+
+
+
+
+ 20
+ 100
+ 281
+ 31
+
+
+
+ Progressing
+
+
+
+
+
+ QQTPushButton
+ QPushButton
+
+
+
+ QQTDialog
+ QWidget
+
+ 1
+
+
+ QQTProgressBar
+ QWidget
+
+ 1
+
+
+
+
+
diff --git a/frame/qqtwifiwidget.cpp b/frame/qqtwifiwidget.cpp
new file mode 100644
index 00000000..4ea257a6
--- /dev/null
+++ b/frame/qqtwifiwidget.cpp
@@ -0,0 +1,147 @@
+#include "qqtwifiwidget.h"
+#include "ui_qqtwifiwidget.h"
+#include "qqtlinux.h"
+#include "qqtdefine.h"
+#include "qqtethenetmanager.h"
+#include "qqtmsgbox.h"
+
+
+void QQTWIFIIDTextDelegate::drawCheck(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect, Qt::CheckState state) const
+{
+#if 0
+ if (!rect.isValid())
+ return;
+ QStyleOptionViewItem opt(option);
+ opt.rect = rect;
+ opt.state = opt.state & ~QStyle::State_HasFocus;
+ switch (state) {
+ case Qt::Unchecked:
+ opt.state |= QStyle::State_Off;
+ break;
+ case Qt::PartiallyChecked:
+ opt.state |= QStyle::State_NoChange;
+ break;
+ case Qt::Checked:
+ opt.state |= QStyle::State_On;
+ break;
+ }
+ QApplication::style()->drawPrimitive(QStyle::PE_IndicatorViewItemCheck, &opt, painter);
+#else
+ QItemDelegate::drawCheck(painter, option, rect, state);
+#endif
+}
+
+void QQTWIFIIDTextDelegate::drawDisplay(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect, const QString &text) const
+{
+ if("COMPLETED" == text)
+ painter->drawImage(rect, QImage("./skin/default/bk_sel.png"));
+}
+
+QQTWIFIWidget::QQTWIFIWidget(QWidget *parent) :
+ QQTTableView(parent),
+ ui(new Ui::QQTWIFIWidget)
+{
+ ui->setupUi(this);
+
+ connect(this, SIGNAL(clicked(QModelIndex)),
+ this, SLOT(clickWIFI()), Qt::QueuedConnection);
+ m_pass = new QQTPasswordDialog(this);
+
+ m_pManager = QQTEthenetManager::Instance(this);
+ connect(m_pManager, SIGNAL(sigRefreshed()), this, SLOT(wifiRefreshed()));
+
+ m_model = new QQTStandardItemModel(this);
+ m_model->setColumnCount(ESSID_MAX);
+ setModel(m_model);
+
+ setSelectionMode(QAbstractItemView::SingleSelection);
+ setSelectionBehavior(QAbstractItemView::SelectRows);
+ setEditTriggers(QAbstractItemView::NoEditTriggers);
+ horizontalHeader()->setHidden(true);
+ verticalHeader()->setHidden(true);
+ resizeColumnsToContents();
+ horizontalHeader()->setStretchLastSection(true);
+ setShowGrid(true);
+
+#ifdef __MIPS_LINUX__
+ setFocusPolicy(Qt::NoFocus);
+#endif
+ dg = new QQTWIFIIDTextDelegate(this);
+ setItemDelegateForColumn(ESSID_STATUS, dg);
+ for(int i = ESSID_TYPE; i < ESSID_MAX; i++)
+ setColumnHidden(i, true);
+#ifdef __QT5__
+ horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed);
+#else
+ horizontalHeader()->setResizeMode(0, QHeaderView::Fixed);
+#endif
+ setColumnWidth(ESSID_STATUS, 40);
+
+}
+
+QQTWIFIWidget::~QQTWIFIWidget()
+{
+ delete ui;
+}
+
+
+TWifi QQTWIFIWidget::currentWifi()
+{
+ return m_pManager->currentWifi();
+}
+
+
+bool QQTWIFIWidget::setCurrentWifi(QString bssid_mac, QString password)
+{
+ return m_pManager->setCurrentWifi(bssid_mac, password);
+}
+
+void QQTWIFIWidget::wifiRefreshed()
+{
+ int row = 0;
+ m_model->removeRows(row, m_model->rowCount());
+ QList& list = m_pManager->wifiList();
+ m_model->insertRows(row, list.size());
+ for(QList::Iterator it = list.begin();
+ it != list.end(); it++)
+ {
+ TWifi wifi = *(TWifi*)(&*it);
+ for(int i = ESSID_STATUS; i < ESSID_MAX; i++)
+ m_model->setData(m_model->index(row, i), wifi[i]);
+ row++;
+ }
+ m_model->submit();
+}
+
+void QQTWIFIWidget::clickWIFI()
+{
+ QString name = m_model->data(m_model->index(currentIndex().row(), ESSID_NAME)).toString();
+ QString encryt = m_model->data(m_model->index(currentIndex().row(), ESSID_ENCRYP)).toString();
+ QString type = m_model->data(m_model->index(currentIndex().row(), ESSID_TYPE)).toString();
+ QString mac = m_model->data(m_model->index(currentIndex().row(), ESSID_BSSID)).toString();
+
+ QQTEthenetManager::Instance()->setRefresh(false);
+ do
+ {
+ if("YES" == encryt)
+ {
+ m_pass->setWifiName(name);
+ if(QQTPasswordDialog::Rejected == m_pass->exec())
+ break;
+ }
+
+ bool ok = setCurrentWifi(mac, m_pass->wifiPwd());
+
+ pline() << ok;
+
+ if(!ok)
+ {
+ QQTMsgBox::warning(this, tr("Password error"));
+ break;
+ }
+
+ pline() << name << encryt << m_pass->wifiPwd();
+ }while(0);
+ QQTEthenetManager::Instance()->setRefresh();
+}
+
diff --git a/frame/qqtwifiwidget.h b/frame/qqtwifiwidget.h
new file mode 100644
index 00000000..beafaf3c
--- /dev/null
+++ b/frame/qqtwifiwidget.h
@@ -0,0 +1,58 @@
+#ifndef QQTWIFIWIDGET_H
+#define QQTWIFIWIDGET_H
+
+#include "qqtstandarditemmodel.h"
+#include "qqtgui-qt.h"
+#include "qqtgui.h"
+#include "qqtpassworddialog.h"
+#include
+#include
+#include "qqtdefine.h"
+
+class QQTWIFIIDTextDelegate : public QItemDelegate
+{
+ Q_OBJECT
+public:
+ QQTWIFIIDTextDelegate(QObject *parent = 0): QItemDelegate(parent), parent(parent) { }
+
+private:
+ QObject* parent;
+
+ // QItemDelegate interface
+protected:
+ void drawCheck(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect, Qt::CheckState state) const;
+
+ // QItemDelegate interface
+protected:
+ void drawDisplay(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect, const QString &text) const;
+};
+
+namespace Ui {
+class QQTWIFIWidget;
+}
+
+class QQTWIFIWidget : public QQTTableView
+{
+ Q_OBJECT
+
+public:
+ explicit QQTWIFIWidget(QWidget *parent = 0);
+ ~QQTWIFIWidget();
+
+private slots:
+ void clickWIFI();
+ void wifiRefreshed();
+protected:
+ TWifi currentWifi();
+ bool setCurrentWifi(QString bssid_mac, QString password = "");
+private:
+ QQTEthenetManager* m_pManager;
+ QQTWIFIIDTextDelegate* dg;
+
+private:
+ Ui::QQTWIFIWidget *ui;
+ QQTStandardItemModel* m_model;
+ QQTPasswordDialog* m_pass;
+};
+
+#endif // QQTWIFIWIDGET_H
diff --git a/frame/qqtwifiwidget.ui b/frame/qqtwifiwidget.ui
new file mode 100644
index 00000000..e4c502dc
--- /dev/null
+++ b/frame/qqtwifiwidget.ui
@@ -0,0 +1,21 @@
+
+
+
+
+ QQTWIFIWidget
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Form
+
+
+
+
+
diff --git a/qqtfoundation.pri b/qqtfoundation.pri
index ed6b88d1..0f3f1826 100755
--- a/qqtfoundation.pri
+++ b/qqtfoundation.pri
@@ -16,7 +16,8 @@ DEFINES += _TTY_POSIX_
INCLUDEPATH += $$PWD \
$$PWD/customplot \
$$PWD/pluginwatcher \
- $$PWD/dmmu
+ $$PWD/dmmu \
+ $$PWD/frame
QT_KIT = $$(QKIT)
@@ -69,19 +70,43 @@ unix {
} else {
SOURCES += $$PWD/pluginwatcher/qdevicewatcher_linux.cpp
}
-
+#frame
+ SOURCES += $$PWD/frame/qqtprogressdialog.cpp \
+ $$PWD/frame/qqtpassworddialog.cpp \
+ $$PWD/frame/qqtpreviewwidget.cpp \
+ $$PWD/frame/qqtwifiwidget.cpp
+ HEADERS += $$PWD/frame/qqtprogressdialog.h \
+ $$PWD/frame/qqtpassworddialog.h \
+ $$PWD/frame/qqtpreviewwidget.h \
+ $$PWD/frame/qqtwifiwidget.h
+ FORMS += $$PWD/frame/qqtprogressdialog.ui \
+ $$PWD/frame/qqtpassworddialog.ui \
+ $$PWD/frame/qqtpreviewwidget.ui \
+ $$PWD/frame/qqtwifiwidget.ui
+#dmmu
+ SOURCES += $$PWD/dmmu/dmmu.c
HEADERS += $$PWD/dmmu/dmmu.h \
$$PWD/dmmu/jz_cim.h \
$$PWD/dmmu/graphics.h \
- $$PWD/dmmu/hal.h \
- $$PWD/qqtethenetmanager.h \
- #linux base type
+ $$PWD/dmmu/hal.h
+#
+ SOURCES += $$PWD/qqtethenetmanager.cpp
+ HEADERS += $$PWD/qqtethenetmanager.h \
$$PWD/qqtlinux.h
-
- SOURCES += $$PWD/dmmu/dmmu.c \
- $$PWD/qqtethenetmanager.cpp
}
+#customplot
+SOURCES += $$PWD/customplot/qcpdocumentobject.cpp \
+ $$PWD/customplot/qcustomplot.cpp
+HEADERS += $$PWD/customplot/qcpdocumentobject.h \
+ $$PWD/customplot/qcustomplot.h
+#pluginwatcher
+SOURCES += $$PWD/pluginwatcher/qdevicewatcher.cpp \
+ $$PWD/pluginwatcher/qqtpluginwatcher.cpp
+HEADERS += $$PWD/pluginwatcher/qqtpluginwatcher.h \
+ $$PWD/pluginwatcher/qdevicewatcher.h \
+ $$PWD/pluginwatcher/qdevicewatcher_p.h
+
SOURCES += $$PWD/qqtcheckbox.cpp \
$$PWD/qqtdefine.cpp \
$$PWD/qqtdialog.cpp \
@@ -124,11 +149,7 @@ SOURCES += $$PWD/qqtcheckbox.cpp \
$$PWD/qqtnetworkmessage.cpp \
$$PWD/qqtuserserialprotocol.cpp \
$$PWD/qqtlanprotocol.cpp \
- $$PWD/qqtanimation.cpp \
- $$PWD/customplot/qcpdocumentobject.cpp \
- $$PWD/customplot/qcustomplot.cpp \
- $$PWD/pluginwatcher/qdevicewatcher.cpp \
- $$PWD/pluginwatcher/qqtpluginwatcher.cpp
+ $$PWD/qqtanimation.cpp
HEADERS += $$PWD/qqtcheckbox.h \
$$PWD/qqtdefine.h \
@@ -177,11 +198,6 @@ HEADERS += $$PWD/qqtcheckbox.h \
$$PWD/qqtuserserialprotocol.h \
$$PWD/qqtlanprotocol.h \
$$PWD/qqtanimation.h \
- $$PWD/customplot/qcpdocumentobject.h \
- $$PWD/customplot/qcustomplot.h \
- $$PWD/pluginwatcher/qqtpluginwatcher.h \
- $$PWD/pluginwatcher/qdevicewatcher.h \
- $$PWD/pluginwatcher/qdevicewatcher_p.h
FORMS += $$PWD/qqtcheckbox.ui \