void WebsocketServer::starten() { if (!K_Server->listen(K_IPAdresse,K_Anschluss)) Q_EMIT Fehler(tr("Konnte den Server nicht starten. %1").arg(K_Server->errorString())); else qCInfo(qalarm_serverWebsocketServer)<<tr("Der Server lauscht auf der Adresse %1 und dem Anschluss %2").arg(K_Server->serverAddress().toString()) .arg(K_Server->serverPort()); }
void Werkzeugtabelle::WZTabLaden(QString wztabfile) { wzTabfilename=wztabfile; QFile wzTabfile(wzTabfilename); if (!wzTabfile.open(QIODevice::ReadOnly|QIODevice::Text)) { Fehler(tr("Ошибка открытия файла")); return; } QTextStream WZTs(&wzTabfile); while (!WZTs.atEnd()) { QString linie = WZTs.readLine(); QStringList lst=linie.split(" ",QString::SkipEmptyParts); bool res=false; int N = lst.at(0).toInt(&res); if (!res) { Fehler(tr("Ошибка файла таблицы инструмента")); break; } res = false; float R = lst.at(2).toFloat(&res); if (!res) { Fehler(tr("Ошибка файла таблицы инструмента")); break; } res = false; float H = lst.at(3).toFloat(&res); if (!res) { Fehler(tr("Ошибка файла таблицы инструмента")); break; } res = false; float L = lst.at(4).toFloat(&res); if (!res) { Fehler(tr("Ошибка файла таблицы инструмента")); break; } ToolDef(N,R,H,L,lst.at(1)); } }
QFile* WebsocketServer::DateiLaden(const QString &datei,const QString &fehlertext) { QFile* Datei=new QFile(datei,this); if (Datei->exists()) { qCDebug(qalarm_serverWebsocketServer)<<tr("Datei %1 existiert").arg(datei); if (Datei->open(QFile::ReadOnly)) return Datei; } qCDebug(qalarm_serverWebsocketServer)<<tr("Datei %1 konnte nicht geladen werden.\n\tFehler: %2").arg(datei).arg(Datei->errorString()).toUtf8().constData(); K_Initfehler=true; Q_EMIT Fehler(fehlertext); return Q_NULLPTR; }
void Werkzeugtabelle::WZTabSpeichern(QString wztabfile) { QFile wzTabfile(wztabfile); if (!wzTabfile.open(QIODevice::WriteOnly|QIODevice::Text)) { Fehler(tr("Ошибка сохранения файла")); return; } QTextStream WZTs(&wzTabfile); QMap<int,Werkzeug*>::iterator it = wzTab.begin(); for (;it!=wzTab.end();++it) { WZTs<<QString::number(it.key())<<" " <<it.value()->WZNam()<<" " <<it.value()->Rwz()<<" " <<it.value()->Hwz()<<" " <<it.value()->Lwz()<<"\n"; } wzTabfile.close(); }
NUMERISCH& operator[](DIMENSION d) { if( d >= Dim ) throw Fehler( "ungueltige Dimenson.", d ); return _koordinaten[d]; }
//----------------------------------------------------------------------- // Purpose: Loads a TGA File from Disk. // Supports: BGR TGA24, BGRA TGA32, BGR TGA24 (RLE compressed), // BGRA TGA32 (RLE compressed ) //----------------------------------------------------------------------- bool PrecacheTgaImage( const char *pFilename, int index, texture_t &tex, int textureTarget, bool flipY, bool srgb ) { tex.filename = pFilename; tex.index = index; //Load a TGA-Image from Disk int i; tgafile_t tgaImage; //Open File! fs::ifstream ffsfile( tex.filename, std::ios::binary ); if( ffsfile.bad() || !ffsfile.is_open() ) { ffsfile.close(); //Fehler( "File is invalid" ); return false; } //Read out the Targa-File //For docs see tga.h //-----Header ffsfile.read((char*)&tgaImage.CharsInIdentField, sizeof(tgaImage.CharsInIdentField)); ffsfile.read((char*)&tgaImage.ColorMapType, sizeof(tgaImage.ColorMapType)); ffsfile.read((char*)&tgaImage.ImageType, sizeof(tgaImage.ImageType)); if( ( tgaImage.ColorMapType != 0 ) && ( tgaImage.ColorMapType != 1 ) ) { ffsfile.close(); Fehler( "Invalid Image" ); return false; } if( tgaImage.ImageType != 2 && tgaImage.ImageType != 10 ) //2 = uncompressed RGB, 10 = RLE RGB { ffsfile.close(); Fehler( "Wrong type of Image, only type 2(unmapped RGB image) and 10(unmapped compressed RGB image) is supported!" ); return false; } //-----color map specifications ffsfile.read((char*)&tgaImage.colormapspec, 5 ); //5 Byte Size //-----Image specifications ffsfile.read((char*)&tgaImage.imagespec, 10 ); //10 Byte Size if( tgaImage.imagespec.pixelSize < 24 || tgaImage.imagespec.pixelSize > 32 ) { ffsfile.close(); Fehler( "Wrong type of Image, only 24 and 32 bits per pixel are supported!" ); return false; } tgaImage._hasalpha = (tgaImage.imagespec.pixelSize == 32) ? true : false; //-----Identification String tgaImage.imageident.pIdentString = NULL; if( tgaImage.CharsInIdentField > 0 ) { //Setze die Größe des Ident-Strings tgaImage.imageident.pIdentString = new char[tgaImage.CharsInIdentField]; //Lese Ident-String! ffsfile.read((char*)tgaImage.imageident.pIdentString, tgaImage.CharsInIdentField); } //-----Color-Map if( tgaImage.ColorMapType != 0 ) { tgaImage.colormap.pB = new BYTE[tgaImage.colormapspec.length]; tgaImage.colormap.pG = new BYTE[tgaImage.colormapspec.length]; tgaImage.colormap.pR = new BYTE[tgaImage.colormapspec.length]; tgaImage.colormap.pA = new BYTE[tgaImage.colormapspec.length]; for(i = 0; i < tgaImage.colormapspec.length; i++) { ffsfile.read((char*)&tgaImage.colormap.pB[i], sizeof(tgaImage.colormap.pB[i])); ffsfile.read((char*)&tgaImage.colormap.pG[i], sizeof(tgaImage.colormap.pG[i])); ffsfile.read((char*)&tgaImage.colormap.pR[i], sizeof(tgaImage.colormap.pR[i])); if( tgaImage.colormapspec.size > 24 ) ffsfile.read((char*)&tgaImage.colormap.pA[i], sizeof(tgaImage.colormap.pA[i])); } } BYTE *pTexture; pTexture = NULL; //-----Image Data int iPixelCount = tgaImage.imagespec.width * tgaImage.imagespec.heigth; if( tgaImage.ImageType == 2 ) { if( tgaImage._hasalpha ) //Targa 32 { pTexture = new BYTE[iPixelCount * 4]; ffsfile.read((char*)pTexture, iPixelCount * 4 ); //4 Bytes Size BindTexture( tex.index, pTexture, tgaImage.imagespec.width, tgaImage.imagespec.heigth, 4, textureTarget, srgb ); } else //Targa 24 { pTexture = new BYTE[iPixelCount * 3]; ffsfile.read((char*)pTexture, iPixelCount * 3 ); //4 Bytes Size BindTexture( tex.index, pTexture, tgaImage.imagespec.width, tgaImage.imagespec.heigth, 3, textureTarget, srgb ); } } else //Compressed BGR/BGRA { if( tgaImage._hasalpha ) //Targa 32 { pTexture = new BYTE[iPixelCount*4]; ReadCompressed( pTexture, &ffsfile, iPixelCount, 4 ); BindTexture( tex.index, pTexture, tgaImage.imagespec.width, tgaImage.imagespec.heigth, 4, textureTarget, srgb ); } else //Targa 24 { pTexture = new BYTE[iPixelCount*3]; ReadCompressed( pTexture, &ffsfile, iPixelCount, 3 ); BindTexture( tex.index, pTexture, tgaImage.imagespec.width, tgaImage.imagespec.heigth, 3, textureTarget, srgb ); } } ffsfile.close(); tex.height = abs(tgaImage.imagespec.heigth); tex.width = abs(tgaImage.imagespec.width); delete[] pTexture; if( tgaImage.CharsInIdentField > 0 ) delete[] tgaImage.imageident.pIdentString; if( tgaImage.ColorMapType != 0 ) { delete [] tgaImage.colormap.pB; delete [] tgaImage.colormap.pG; delete [] tgaImage.colormap.pR; delete [] tgaImage.colormap.pA; } return true; }
void WebsocketServer::SSL_Serverfehler(QWebSocketProtocol::CloseCode fehlerkode) { Q_UNUSED(fehlerkode); Q_EMIT Fehler(tr("Fehler beim erstellen des WSS Socket. %1").arg(K_Server->errorString())); }
void Datenmodell::FehlerAufgetreten(QString fehler) { Q_EMIT Fehler(tr("Datenbankfehler:\r\n%1").arg(fehler)); }