mainwindow.cpp
changeset 6 ac3b45850c50
parent 2 0c23d71853fe
--- a/mainwindow.cpp	Mon Oct 11 08:55:38 2010 +0300
+++ b/mainwindow.cpp	Tue Oct 26 15:34:14 2010 +0300
@@ -38,7 +38,7 @@
 
 QString MainWindow::widgetName()
 {
-    return ui->widgetName->text().toLower();
+    return ui->widgetName->text();
 }
 
 QString MainWindow::widgetUid()
@@ -58,7 +58,7 @@
 
 QString MainWindow::rendererUid()
 {
-    return ui->rendererUid->text();
+    return ui->rendererUid->text().toLower();
 }
 
 void MainWindow::on_pushButton_clicked()
@@ -89,6 +89,14 @@
         return;
     }
 
+    if (widgetLayout().length() == 0 && !rendererCheckBox().isChecked())
+    {
+        QMessageBox msgBox;
+        msgBox.setText("Layout data not available yet.");
+        msgBox.exec();
+        return;
+    }
+
     generateMainBuildFile();
 
     PublisherCreator* publisherCreator = new PublisherCreator(*this);
@@ -126,8 +134,8 @@
 void MainWindow::generateMainBuildFile()
 {
     QDir dir;
-    dir.mkpath( widgetName() + "/group");
-    dir.setPath( widgetName() + "/group");
+    dir.mkpath( widgetName().toLower() + "/group");
+    dir.setPath( widgetName().toLower() + "/group");
     QFile file( dir.filePath("bld.inf"));
     if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
         return;
@@ -200,6 +208,7 @@
     {
         QString line = in.readLine();
         line.replace(QString("#replace#"), widgetName());
+
         if( noHexUid )
         {
             line.replace(QString("#replaceuid#"), widgetUidNoHex());
@@ -214,15 +223,19 @@
 
 void MainWindow::on_renderingCheckBox_stateChanged(int state )
 {
+    iTimer->stop();
     if( state == Qt::Unchecked )
     {
         ui->rendererName->setEnabled( false );
         ui->rendererUid->setEnabled( false );
+        ui->comboBox->setEnabled( true );
+        updateLayout();
     }
     else if ( state == Qt::Checked)
     {
         ui->rendererName->setEnabled( true );
         ui->rendererUid->setEnabled( true);
+        ui->comboBox->setEnabled( false );
     }
 
 }
@@ -251,7 +264,15 @@
             return QString( "graphictext" );
         }
         break;
+    case 4:
+        {
+            return QString( "graphiciconstext" );
+        }
+        break;
+
     };
+
+    return QString( "" );
 }
 
 void MainWindow::on_comboBox_currentIndexChanged(int index)
@@ -259,8 +280,6 @@
     iLayoutIndex = index;
     iLayoutCount = 3;
     updateLayout();
-
-
 }
 
 void MainWindow::updateLayout()
@@ -287,10 +306,40 @@
         break;
     case 3:
         {
-            showGraphicTextLayout();
+            showGraphicsTextLayout();
+            iTimer->start(2000);
+        }
+        break;
+    case 4:
+        {
+            showGraphicsIconTextLayout();
             iTimer->start(2000);
         }
         break;
+    case 5:
+        {
+            iTimer->stop();
+            showGraphicsGridLayout();
+        }
+        break;
+    case 6:
+        {
+            iTimer->stop();
+            showGraphicsGridTextLayout();
+        }
+        break;
+    case 7:
+        {
+            iTimer->stop();
+            showWidgeImageLayout();
+        }
+        break;
+    case 8:
+        {
+            iTimer->stop();
+            showGraphicsCarouselLayout();
+        }
+        break;
     };
 
     if( iLayoutCount > 1)
@@ -308,6 +357,26 @@
     ui->layoutGraphics->setPixmap(QPixmap(QString::fromUtf8(":/widgets/images/feeds_layout.jpg")));
 }
 
+void MainWindow::showGraphicsGridLayout()
+{
+    ui->layoutGraphics->setPixmap(QPixmap(QString::fromUtf8(":/widgets/images/graphicsgrid_layout.jpg")));
+}
+
+void MainWindow::showGraphicsGridTextLayout()
+{
+    ui->layoutGraphics->setPixmap(QPixmap(QString::fromUtf8(":/widgets/images/graphicsgridtext_layout.jpg")));
+}
+
+void MainWindow::showWidgeImageLayout()
+{
+    ui->layoutGraphics->setPixmap(QPixmap(QString::fromUtf8(":/widgets/images/wideimage_layout.jpg")));
+}
+
+void MainWindow::showGraphicsCarouselLayout()
+{
+    ui->layoutGraphics->setPixmap(QPixmap(QString::fromUtf8(":/widgets/images/graphicscarousel_layout.jpg")));
+}
+
 void MainWindow::showTextLayout()
 {
     QString imagePath(":/widgets/images/text_layout_");
@@ -328,12 +397,23 @@
     ui->layoutGraphics->setPixmap(QPixmap(imagePath));
 }
 
-void MainWindow::showGraphicTextLayout()
+void MainWindow::showGraphicsTextLayout()
 {
-    QString imagePath(":/widgets/images/graphictext_layout_");
+    QString imagePath(":/widgets/images/graphicstext_layout_");
     QString cnt;
     cnt.setNum( iLayoutCount );
     imagePath.append( cnt );
     imagePath.append( ".jpg" );
     ui->layoutGraphics->setPixmap(QPixmap(imagePath));
 }
+
+void MainWindow::showGraphicsIconTextLayout()
+{
+    QString imagePath(":/widgets/images/graphicsiconstext_layout_");
+    QString cnt;
+    cnt.setNum( iLayoutCount );
+    imagePath.append( cnt );
+    imagePath.append( ".jpg" );
+    ui->layoutGraphics->setPixmap(QPixmap(imagePath));
+}
+