OSDN Git Service

[GENERAL][Qt] Adjust indent.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Tue, 10 Nov 2015 10:20:13 +0000 (19:20 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Tue, 10 Nov 2015 10:20:13 +0000 (19:20 +0900)
source/src/qt/common/qt_main.cpp
source/src/qt/common/sdl_sound.cpp

index 67f53ad..934da71 100644 (file)
@@ -54,7 +54,72 @@ bool now_menuloop = false;
 static int close_notified = 0;
 // timing control
 
+// screen
+unsigned int desktop_width;
+unsigned int desktop_height;
+//int desktop_bpp;
+int prev_window_mode = 0;
+bool now_fullscreen = false;
+
+int window_mode_count;
+
+
+
+void Ui_MainWindow::set_window(int mode)
+{
+       QMenuBar *hMenu;
+       //      static LONG style = WS_VISIBLE;
+
+       if(mode >= 0 && mode < _SCREEN_MODE_NUM) {
+               if(mode >= screen_mode_count) return;
+               // window
+               int width = emu->get_window_width(mode);
+               int height = emu->get_window_height(mode);
+               
+               this->resize(width + 10, height + 100); // OK?
+               int dest_x = 0;
+               int dest_y = 0;
+               dest_x = (dest_x < 0) ? 0 : dest_x;
+               dest_y = (dest_y < 0) ? 0 : dest_y;
+               
+               config.window_mode = prev_window_mode = mode;
+               
+               // set screen size to emu class
+               emu->suspend();
+               emu->set_display_size(width, height, true);
+               if(rMainWindow) {
+                       rMainWindow->getGraphicsView()->resize(width, height);
+                       rMainWindow->resize_statusbar(width, height);
+               }
+       } else if(!now_fullscreen) {
+               // fullscreen
+               if(mode >= screen_mode_count) return;
+               int width;
+               int height;
+               if(mode < 0) {
+                       width = desktop_width;
+                       height = desktop_height;
+               } else {
+                       double nd = actionScreenSize[mode]->binds->getDoubleValue();
+                       width = (int)(nd * (double)SCREEN_WIDTH);
+                       height = (int)(nd * (double)SCREEN_HEIGHT);
+#if defined(USE_SCREEN_ROTATE)
+                       if(config.rotate_type) {
+                               int tmp_w = width;
+                               width = height;
+                               height = tmp_w;
+                       }
+#endif    
 
+               }
+               config.window_mode = mode;
+               emu->suspend();
+               // set screen size to emu class
+               emu->set_display_size(width, height, false);
+               graphicsView->resize(width, height);
+               this->resize_statusbar(width, height);
+       }
+}
 
 
 void Ui_MainWindow::doChangeMessage_EmuThread(QString message)
@@ -325,18 +390,6 @@ void get_short_filename(_TCHAR *dst, _TCHAR *file, int maxlen)
        return;
 }
 
-
-// screen
-unsigned int desktop_width;
-unsigned int desktop_height;
-//int desktop_bpp;
-int prev_window_mode = 0;
-bool now_fullscreen = false;
-
-int window_mode_count;
-
-//void set_window(QMainWindow * hWnd, int mode);
-
 void Ui_MainWindow::OnWindowRedraw(void)
 {
        if(emu) {
@@ -484,7 +537,6 @@ int MainLoop(int argc, char *argv[])
   
        
        // disenable ime
-       //ImmAssociateContext(hWnd, 0);
        
        // initialize emulation core
        rMainWindow->getWindow()->show();
@@ -517,68 +569,6 @@ int MainLoop(int argc, char *argv[])
        GuiMain->exec();
        return 0;
 }
-
-
-
-void Ui_MainWindow::set_window(int mode)
-{
-       QMenuBar *hMenu;
-       //      static LONG style = WS_VISIBLE;
-
-       if(mode >= 0 && mode < _SCREEN_MODE_NUM) {
-               if(mode >= screen_mode_count) return;
-               // window
-               int width = emu->get_window_width(mode);
-               int height = emu->get_window_height(mode);
-               
-               this->resize(width + 10, height + 100); // OK?
-               int dest_x = 0;
-               int dest_y = 0;
-               dest_x = (dest_x < 0) ? 0 : dest_x;
-               dest_y = (dest_y < 0) ? 0 : dest_y;
-               
-               config.window_mode = prev_window_mode = mode;
-               
-               // set screen size to emu class
-               emu->suspend();
-               emu->set_display_size(width, height, true);
-               if(rMainWindow) {
-                       rMainWindow->getGraphicsView()->resize(width, height);
-                       rMainWindow->resize_statusbar(width, height);
-               }
-       } else if(!now_fullscreen) {
-               // fullscreen
-               if(mode >= screen_mode_count) return;
-               int width;
-               int height;
-               if(mode < 0) {
-                       width = desktop_width;
-                       height = desktop_height;
-               } else {
-                       double nd = actionScreenSize[mode]->binds->getDoubleValue();
-                       width = (int)(nd * (double)SCREEN_WIDTH);
-                       height = (int)(nd * (double)SCREEN_HEIGHT);
-#if defined(USE_SCREEN_ROTATE)
-                       if(config.rotate_type) {
-                               int tmp_w = width;
-                               width = height;
-                               height = tmp_w;
-                       }
-#endif    
-
-               }
-               config.window_mode = mode;
-               emu->suspend();
-               // set screen size to emu class
-               emu->set_display_size(width, height, false);
-               graphicsView->resize(width, height);
-               this->resize_statusbar(width, height);
-       }
-}
-
-
-
-
 /*
  * This is main for Qt.
  */
@@ -651,7 +641,7 @@ int main(int argc, char *argv[])
        printf("Architecture: %s\n", archstr.c_str());
        printf(" -? is print help(s).\n");
    
-        /* Print SIMD features */ 
+       /* Print SIMD features */ 
        simdstr[0] = '\0';
 #if defined(__x86_64__) || defined(__i386__)
         if(pCpuID != NULL) {
@@ -746,14 +736,6 @@ int main(int argc, char *argv[])
        sRssDir = RSSDIR;
 #endif
    
-       //setlocale(LC_ALL, "");
-       //bindtextdomain("messages", sRssDir.c_str());
-       //textdomain("messages");
-       //AGAR_DebugLog(AGAR_LOG_DEBUG, "I18N via gettext initialized."); // Will move to Qt;
-       //AGAR_DebugLog(AGAR_LOG_DEBUG, "I18N resource dir: %s", sRssDir.c_str());
-
-       //SDL_Init(SDL_INIT_EVERYTHING | SDL_INIT_TIMER);
-
 #if ((AGAR_VER <= 2) && defined(FMTV151))
        bFMTV151 = TRUE;
 #endif                         /*  */
@@ -763,7 +745,7 @@ int main(int argc, char *argv[])
        nErrorCode = MainLoop(argc, argv);
        return nErrorCode;
 }
-#if defined(Q_OS_WIN32)
+#if defined(Q_OS_WIN
 int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
 {
    char *arg[1] = {""};
index 340eb65..6c64f50 100644 (file)
@@ -163,7 +163,7 @@ void EMU::initialize_sound()
         nAudioDevid = 1;
    
        // secondary buffer
-       uBufSize = (100 * SndSpecPresented.freq * SndSpecPresented.channels * 2) / 1000;
+               uBufSize = (100 * SndSpecPresented.freq * SndSpecPresented.channels * 2) / 1000;
         //uBufSize = sound_samples * 2;
         pSoundBuf = (Sint16 *)malloc(uBufSize * sizeof(Sint16)); 
         if(pSoundBuf == NULL) {
@@ -200,10 +200,8 @@ void EMU::release_sound()
         SDL_CloseAudio();
 #endif   
         if(pSndApplySem != NULL) {
-          //SDL_SemWait(pSndApplySem);
-          //SDL_SemPost(pSndApplySem);
-          SDL_DestroySemaphore(pSndApplySem);
-       }
+                       SDL_DestroySemaphore(pSndApplySem);
+               }
         if(pSoundBuf != NULL) free(pSoundBuf);
        // stop recording
        stop_rec_sound();
@@ -356,7 +354,6 @@ void EMU::mute_sound()
                        nSndDataPos = (nSndDataPos + ssize) % uBufSize;
 //                     SDL_UnlockAudio();
                        SDL_SemPost(*snddata.pSndApplySem);
-//             }
 //             SDL_PauseAudioDevice(nAudioDevid, 0);
        }
        now_mute = true;
@@ -407,7 +404,7 @@ void EMU::stop_rec_sound()
                        // update wave header
                        wavheader_t header;
 
-                       header.dwRIFF = EndianToLittle_DWORD(0x46464952);
+               header.dwRIFF = EndianToLittle_DWORD(0x46464952);
                        header.dwFileSize = EndianToLittle_DWORD(rec_bytes + sizeof(wavheader_t) - 8);
                        header.dwWAVE = EndianToLittle_DWORD(0x45564157);
                        header.dwfmt_ = EndianToLittle_DWORD(0x20746d66);