Revision: 6474
Author: nogu.dev
Date: Wed Jun 23 03:26:43 2010
Log: * qt4/immodule/candidatetablewindow.cpp
  - Sort position of function definitions.
* qt4/immodule/candidatetablewindow.h
  - Sort position of function declarations.
http://code.google.com/p/uim/source/detail?r=6474

Modified:
 /trunk/qt4/immodule/candidatetablewindow.cpp
 /trunk/qt4/immodule/candidatetablewindow.h

=======================================
--- /trunk/qt4/immodule/candidatetablewindow.cpp        Sun Jun 20 04:42:59 2010
+++ /trunk/qt4/immodule/candidatetablewindow.cpp        Wed Jun 23 03:26:43 2010
@@ -106,22 +106,11 @@
         free(table);
 }

-QGridLayout *CandidateTableWindow::createLayout(int row, int column,
-        int rowOffset, int columnOffset)
-{
-    QGridLayout *layout = new QGridLayout;
-    layout->setSpacing(HOMEPOSITION_SPACING);
-    layout->setMargin(0);
-    for (int i = 0; i < row; i++) {
-        for (int j = 0; j < column; j++) {
-            KeyButton *button = new KeyButton;
-            connect(button, SIGNAL(candidateClicked(int)),
-                this, SLOT(slotCandidateClicked(int)));
-            buttonArray[i + rowOffset][j + columnOffset] = button;
-            layout->addWidget(button, i, j);
-        }
-    }
-    return layout;
+void CandidateTableWindow::slotCandidateClicked(int index)
+{
+    if (ic && ic->uimContext())
+        uim_set_candidate_index(ic->uimContext(), index);
+    updateLabel();
 }

 static char *initTableInternal()
@@ -162,11 +151,67 @@
     table = static_cast<char *>(ret);
 }

-void CandidateTableWindow::slotCandidateClicked(int index)
-{
-    if (ic && ic->uimContext())
-        uim_set_candidate_index(ic->uimContext(), index);
-    updateLabel();
+QGridLayout *CandidateTableWindow::createLayout(int row, int column,
+        int rowOffset, int columnOffset)
+{
+    QGridLayout *layout = new QGridLayout;
+    layout->setSpacing(HOMEPOSITION_SPACING);
+    layout->setMargin(0);
+    for (int i = 0; i < row; i++) {
+        for (int j = 0; j < column; j++) {
+            KeyButton *button = new KeyButton;
+            connect(button, SIGNAL(candidateClicked(int)),
+                this, SLOT(slotCandidateClicked(int)));
+            buttonArray[i + rowOffset][j + columnOffset] = button;
+            layout->addWidget(button, i, j);
+        }
+    }
+    return layout;
+}
+
+static bool isEmptyBlock(QGridLayout *layout)
+{
+    for (int i = 0; i < layout->count(); i++) {
+        QWidget *widget = layout->itemAt(i)->widget();
+        if (widget && widget->isEnabled())
+            return false;
+    }
+    return true;
+}
+
+void CandidateTableWindow::setBlockVisible(QLayout *layout, bool visible)
+{
+    if (visible == layout->isEnabled())
+        return;
+    layout->setEnabled(visible);
+    for (int i = 0; i < layout->count(); i++) {
+        QWidget *widget = layout->itemAt(i)->widget();
+        if (widget)
+            widget->setVisible(visible);
+    }
+}
+
+void CandidateTableWindow::setTable()
+{
+    // hide empty blocks.
+    // pattern0 (full table)
+    //   blockLR  blockA
+    //   blockLRS blockAS (for shift key)
+    // pattern1 (minimal blocks)
+    //   blockLR
+    // pattern2 (without shift blocks)
+    //   blockLR  blockA
+    // pattern3 (without symbol blocks)
+    //   blockLR
+    //   blockLRS
+    bool hasBlockA = !isEmptyBlock(aLayout);
+    bool hasBlockAs = !isEmptyBlock(asLayout);
+    bool hasBlockLrs = !(isEmptyBlock(lsLayout) && isEmptyBlock(rsLayout));
+
+    setBlockVisible(aLayout, hasBlockA || hasBlockAs);
+    setBlockVisible(asLayout, hasBlockAs);
+    setBlockVisible(lsLayout, hasBlockLrs || hasBlockAs);
+    setBlockVisible(rsLayout, hasBlockLrs || hasBlockAs);
 }

 void CandidateTableWindow::setPage(int page)
@@ -181,7 +226,7 @@
     int newpage;
     if (page < 0)
         newpage = lastpage;
-    else if ( page > lastpage)
+    else if (page > lastpage)
         newpage = 0;
     else
         newpage = page;
@@ -252,51 +297,6 @@
     else
         updateLabel();
 }
-
-static bool isEmptyBlock(QGridLayout *layout)
-{
-    for (int i = 0; i < layout->count(); i++) {
-        QWidget *widget = layout->itemAt(i)->widget();
-        if (widget && widget->isEnabled())
-            return false;
-    }
-    return true;
-}
-
-void CandidateTableWindow::setBlockVisible(QLayout *layout, bool visible)
-{
-    if (visible == layout->isEnabled())
-        return;
-    layout->setEnabled(visible);
-    for (int i = 0; i < layout->count(); i++) {
-        QWidget *widget = layout->itemAt(i)->widget();
-        if (widget)
-            widget->setVisible(visible);
-    }
-}
-
-void CandidateTableWindow::setTable()
-{
-    // hide empty blocks.
-    // pattern0 (full table)
-    //   blockLR  blockA
-    //   blockLRS blockAS (for shift key)
-    // pattern1 (minimal blocks)
-    //   blockLR
-    // pattern2 (without shift blocks)
-    //   blockLR  blockA
-    // pattern3 (without symbol blocks)
-    //   blockLR
-    //   blockLRS
-    bool hasBlockA = !isEmptyBlock(aLayout);
-    bool hasBlockAs = !isEmptyBlock(asLayout);
-    bool hasBlockLrs = !(isEmptyBlock(lsLayout) && isEmptyBlock(rsLayout));
-
-    setBlockVisible(aLayout, hasBlockA || hasBlockAs);
-    setBlockVisible(asLayout, hasBlockAs);
-    setBlockVisible(lsLayout, hasBlockLrs || hasBlockAs);
-    setBlockVisible(rsLayout, hasBlockLrs || hasBlockAs);
-}

 KeyButton::KeyButton() : m_index(-1)
 {
=======================================
--- /trunk/qt4/immodule/candidatetablewindow.h  Sun Jun 20 03:45:40 2010
+++ /trunk/qt4/immodule/candidatetablewindow.h  Wed Jun 23 03:26:43 2010
@@ -56,12 +56,12 @@
         void slotCandidateClicked(int index);

     private:
-        void setPage(int page);
+        void initTable();
         QGridLayout *createLayout(int row, int column,
             int rowOffset, int columnOffset);
-        void initTable();
-        void setTable();
         void setBlockVisible(QLayout *layout, bool visible);
+        void setTable();
+        void setPage(int page);

         QGridLayout *lsLayout;
         QGridLayout *rsLayout;

Reply via email to